/* styles.css */
:root {
  --bg: #020203;
  --fg: #f7f5ff;
  --muted: #a4a1c2;
  --border-soft: rgba(255, 255, 255, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --glow-blue: #17a2b8;
}

/* Reset */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fg);
  line-height: 1.5;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.035), transparent 45%),
    radial-gradient(circle at 82% 88%, rgba(255,255,255,0.02), transparent 55%),
    #010102;
  min-height: 100vh;
}

/* Page */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Top */
.top {
  display: grid;
  grid-template-columns: 150px 1fr;
  column-gap: 28px;
  align-items: center;
  margin-bottom: 32px;
}

.site-header {
  position: sticky;
  top: 16px;
  z-index: 10;
  width: 150px;
  height: 150px;
}

.header-image {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 16px;
  display: block;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
}

.hero {
  padding: 0 4px 24px;
  text-align: right;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.1;
  margin: 0 0 12px;
  margin-left: auto;
  max-width: 720px;
}

.hero p {
  max-width: 520px;
  margin: 0 0 0 auto;
  font-size: 15px;
  color: var(--muted);
}

/* Sections */
.section { padding: 8px 4px 32px; }
.section h2 { font-size: 18px; margin: 0 0 16px; }

/* Practice header aligned with carousel width */
#practice h2 {
  width: 360px;
  margin: 0 auto 18px;
  text-align: left;
}

/* =========================
   Carousel
   ========================= */

.work-item {
  max-width: 360px;
  margin: 24px auto 0;
}

.glow-card { position: relative; }
.glow-card::before {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 20% 0%, rgba(23, 162, 184, 0.9), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(23, 162, 184, 0.5), transparent 55%);
  filter: blur(6px);
  z-index: 0;
}

.glow-card-inner {
  position: relative;
  z-index: 1;
  border-radius: 22px;
  overflow: visible;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.75);
}

.carousel {
  position: relative;
  width: 360px;
  height: 220px;
  margin: 0 auto;
  overflow: visible;
  user-select: none;
}

.carousel * { user-select: none; }

.carousel-stage { position: relative; width: 100%; height: 100%; }

.carousel-center {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  z-index: 20;
  cursor: pointer;
}

.carousel-center img { width: 100%; height: 100%; object-fit: cover; display: block; }

.carousel-stack {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.stack-card {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 22px;
  overflow: hidden;
  opacity: 0.2;
}

.stack-card img { width: 100%; height: 100%; object-fit: cover; }

.carousel-stack.right .stack-card {
  transform: translateX(50%) translateY(calc(var(--stack-i) * 3px)) scale(0.92);
}
.carousel-stack.left .stack-card {
  transform: translateX(-50%) translateY(calc(var(--stack-i) * 3px)) scale(0.92);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 28px;
  color: var(--fg);
  cursor: pointer;
  z-index: 40;
}

.carousel-btn.left { left: -32px; }
.carousel-btn.right { right: -32px; }

.carousel-btn:hover { color: var(--glow-blue); }
.carousel-btn:disabled { opacity: 0.25; cursor: default; }

/* Carousel overlay — balanced + scrollbars */
.work-overlay {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: rgba(6, 6, 10, 0.96);
  border: 3px solid #000;
  padding: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
}
.work-overlay.active { opacity: 1; pointer-events: auto; }

.overlay-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.overlay-close {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--fg);
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  line-height: 1;
  border-radius: 10px;
  z-index: 2;
}
.overlay-close:hover { color: var(--glow-blue); border-color: rgba(23,162,184,0.35); }

.overlay-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 34px 10px 12px; /* clears the floating X */
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23,162,184,0.55) transparent;
}
.overlay-scroll::-webkit-scrollbar { width: 6px; }
.overlay-scroll::-webkit-scrollbar-thumb { background: rgba(23,162,184,0.55); border-radius: 4px; }
.overlay-scroll::-webkit-scrollbar-thumb:hover { background: rgba(23,162,184,0.8); }
.overlay-scroll::-webkit-scrollbar-track { background: transparent; }

.overlay-text { font-size: 14px; color: rgba(247, 245, 255, 0.92); }
.overlay-text p { margin: 0 0 12px; }
.overlay-text p:last-child { margin-bottom: 0; }

.overlay-text a {
  color: #17a2b8;
  text-decoration: none;
  border-bottom: 1px solid rgba(23,162,184,0.4);
  transition: all 0.2s ease;
}
.overlay-text a:hover { color: #7fd3e0; border-bottom-color: rgba(23,162,184,0.8); }

.work-meta { margin-top: 12px; text-align: left; }
.work-meta h3 { margin: 0 0 6px; font-size: 15px; }

.project-title { cursor: pointer; }
.project-title:hover { color: var(--glow-blue); }

/* Gallery open button */
.gallery-open {
  display: inline-block;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(247,245,255,0.86);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.2px;
  box-shadow:
    0 10px 24px rgba(0,0,0,0.55),
    0 0 14px rgba(23,162,184,0.10);
}
.gallery-open:hover {
  color: var(--glow-blue);
  border-color: rgba(23,162,184,0.35);
}

/* =========================
   Fullscreen Gallery Modal (Snake ring)
   ========================= */

.gallery-modal{
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.50);

  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;

  display: none;          /* hard off when closed */
  place-items: center;
  padding: 24px;
}

/* FIX: must turn display ON when active */
.gallery-modal.active{
  display: grid;          /* <- this was your “button does nothing” bug */
  opacity: 1;
  pointer-events: auto;
}

.gallery-shell{
  position: relative;
  width: min(1100px, 96vw);
  height: min(760px, 90vh);
  background: rgba(6, 6, 10, 0.98);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.75);
  padding: 18px;
  overflow: hidden; /* keep everything inside the box */
}

.gallery-close{
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  width: 36px;
  height: 32px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.gallery-close:hover{
  color: var(--glow-blue);
  border-color: rgba(23,162,184,0.35);
}

.gallery-stage{
  position: relative;
  width: 100%;
  height: calc(100% - 34px);
  border-radius: 16px;
  overflow: hidden;
}

.gallery-main{
  position: absolute;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(23,162,184,0.30);
  box-shadow:
    0 18px 48px rgba(0,0,0,0.65),
    0 0 22px rgba(23,162,184,0.16);
  background: rgba(255,255,255,0.02);
}

.gallery-main img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery-ring{
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: auto;
}

.gallery-thumb{
  position: absolute;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 12px 26px rgba(0,0,0,0.45);
  transition: transform 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.gallery-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.92;
}

.gallery-thumb:hover{
  transform: translateY(-3px);
  border-color: rgba(23,162,184,0.55);
}
.gallery-thumb:hover img{ opacity: 1; }

.gallery-thumb.is-active{
  border: 2px solid rgba(23,162,184,0.85);
}

.gallery-caption{
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  text-align: center;
  font-size: 13px;
  color: rgba(247,245,255,0.75);
  z-index: 8;
  pointer-events: none;
}

/* =========================
   Reset + Starting area
   ========================= */

.practice-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 10px;
}

.practice-reset {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.55);
  color: rgb(23, 162, 184);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow:
    0 10px 24px rgba(0,0,0,0.55),
    0 0 14px rgba(23,162,184,0.14);
}
.practice-reset:hover { color: var(--glow-blue); border-color: rgba(23,162,184,0.35); }

.practice-label {
  font-size: 14px;
  color: var(--glow-blue);
  font-weight: 600;
  letter-spacing: 0.2px;
  text-shadow: 0 0 6px rgba(23,162,184,0.35);
}

.practice-desktop {
  position: relative;
  width: 100%;
  min-height: 360px;
  height: auto;
  margin: 0;
  border: none;
  border-radius: 16px;
  background: rgba(0,0,0,0.10);
  box-shadow: 0 18px 46px rgba(0,0,0,0.28);
  overflow: visible;
}

/* Window */
.pwin {
  position: absolute;
  width: var(--win-w, 300px);
  user-select: none;
}

.pwin-bar{
  height: var(--bar-h, 34px);
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  cursor: grab;
}
.pwin-bar:active { cursor: grabbing; }

.pwin-close{
  flex: 0 0 auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0.95;
}
.pwin-close:hover { color: var(--glow-blue); }

.pwin-title{
  flex: 1 1 auto;
  color: #fff;
  font-size: var(--title-size, 14px);
  font-weight: 600;
  letter-spacing: 0.2px;
  text-align: left;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.pwin-body {
  width: 100%;
  height: var(--img-h, 250px);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  border-top: none;
  overflow: hidden;
  box-shadow:
    0 10px 28px rgba(0,0,0,0.75),
    0 0 22px rgba(23,162,184,0.18);
  cursor: pointer;
}

.pwin-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pwin-overlay {
  position: absolute;
  left: 0;
  top: var(--bar-h, 34px);
  width: 100%;
  height: var(--img-h, 250px);
  background: rgba(6, 6, 10, 0.94);
  border: 1px solid rgba(255,255,255,0.10);
  border-top: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  padding: 10px;
}

.pwin-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.pwin-min {
  position: absolute;
  top: 6px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  width: 26px;
  height: 22px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  z-index: 3;
}
.pwin-min:hover { color: var(--glow-blue); border-color: rgba(23,162,184,0.35); }

.pwin-overlay-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 26px 6px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23,162,184,0.55) transparent;
}
.pwin-overlay-scroll::-webkit-scrollbar { width: 6px; }
.pwin-overlay-scroll::-webkit-scrollbar-thumb { background: rgba(23,162,184,0.55); border-radius: 4px; }
.pwin-overlay-scroll::-webkit-scrollbar-thumb:hover { background: rgba(23,162,184,0.8); }
.pwin-overlay-scroll::-webkit-scrollbar-track { background: transparent; }

.pwin-overlay-text {
  font-size: 13px;
  color: rgba(247,245,255,0.92);
}
.pwin-overlay-text p { margin: 0 0 10px; }
.pwin-overlay-text p:last-child { margin-bottom: 0; }

.pwin-overlay-text a {
  color: #17a2b8;
  text-decoration: none;
  border-bottom: 1px solid rgba(23,162,184,0.4);
}
.pwin-overlay-text a:hover {
  color: #7fd3e0;
  border-bottom-color: rgba(23,162,184,0.8);
}

.pwin.removing {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 140ms ease, transform 140ms ease;
}

/* Talking */
.talking-wrap{ max-width: 760px; margin: 0; }

.talking-row{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-start;
  margin: 10px 0 12px;
}

.talk-pixel{
  width: 20px;
  height: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  box-shadow:
    0 12px 26px rgba(0,0,0,0.48),
    0 0 16px rgba(23,162,184,0.10);
  opacity: 0.92;
  transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.talk-pixel:hover{
  opacity: 1;
  transform: translateY(-1px);
  box-shadow:
    0 14px 30px rgba(0,0,0,0.52),
    0 0 22px rgba(23,162,184,0.14);
}

.talk-pixel.is-active{
  opacity: 1;
  transform: translateY(-1px);
  outline: 2px solid rgba(255,255,255,0.18);
  outline-offset: 2px;
}

.talking-title{
  font-size: 14px;
  color: rgba(247,245,255,0.92);
  margin-bottom: 6px;
}

.talking-open{
  display: inline-block;
  font-size: 12px;
  color: var(--active-color, #17a2b8);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--active-color, #17a2b8) 45%, transparent);
  transition: color 140ms ease, border-color 140ms ease;
}

.talking-open:hover{
  color: color-mix(in srgb, var(--active-color, #17a2b8) 75%, white);
  border-bottom-color: color-mix(in srgb, var(--active-color, #17a2b8) 75%, transparent);
}

.talking-open[aria-disabled="true"]{
  opacity: 0.5;
  pointer-events: none;
  border-bottom-color: transparent;
}

.talking-description{
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.85;
  color: rgba(247,245,255,0.78);
  margin: 0 0 10px;
  max-width: 45ch;
}

/* About / Footer */
.about-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr); gap: 18px; }
.about-layout p { font-size: 14px; }
.about-meta { font-size: 13px; color: var(--muted); border-radius: var(--radius-md); border: 1px solid var(--border-soft); padding: 12px 14px; background: rgba(10, 10, 20, 0.9); }

.site-footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.06); display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.license-footer { display: flex; align-items: center; gap: 4px; }
.cc-icon { width: 14px; opacity: 0.8; }
.footer-note { opacity: 0.8; }

.cv-link {
  display: inline-block;
  margin-left: 10px;
  margin-top: 10px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.cv-link:hover { color: var(--glow-blue); border-bottom-color: rgba(23,162,184,0.35); }

/* Responsive */
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr; row-gap: 18px; }
  .hero { text-align: left; }
  .about-layout { grid-template-columns: 1fr; }
  #practice h2 { width: 100%; }

  .practice-desktop.is-mobile {
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
  }

  .practice-desktop.is-mobile .pwin {
    position: relative;
    width: 100%;
    --bar-h: 34px;
    --img-h: 140px;
    --title-size: 12px;
  }

  @media (max-width: 360px) {
    .practice-desktop.is-mobile { grid-template-columns: 1fr; }
  }
}
