:root {
  /* Mirrors the fills in assets/scene/*.svg. Change both together. */
  --sky-top:    #FFFDFC;
  --sky-mid:    #FFF2EF;
  --sky-low:    #FCDEDC;

  --ink:        #3B2150;
  --ink-soft:   #6B4C7E;
  --pink:       #E5276E;
  --pink-deep:  #C41C5C;
  --purple:     #4A2C6D;

  --card:       rgba(255, 255, 255, 0.9);
  --card-line:  rgba(196, 130, 160, 0.28);
  --card-hi:    rgba(255, 255, 255, 0.97);

  --shadow-sm:  0 2px 8px rgba(122, 52, 96, 0.10);
  --shadow-md:  0 10px 28px rgba(122, 52, 96, 0.16);

  --display:    'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text:       'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter:     clamp(18px, 4vw, 56px);
  --radius:     16px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  height: 100dvh;
  overflow: hidden;
  font-family: var(--text);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 42%, var(--sky-low) 100%);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  --scene-h: clamp(420px, 74dvh, 100vw);
}

#scene .layer {
  position: absolute;
  left: 0;
  width: 100%;
  background-repeat: repeat-x;
  background-position: 0 bottom;
  background-size: auto 100%;
  will-change: background-position;
}

#scene .layer.is-still { background-repeat: no-repeat; }

#scene-haze {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(130% 50% at 50% 0%, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0) 70%),
    /* Footer scrim: keeps the credit legible over whatever ground drifts beneath it. */
    linear-gradient(180deg, rgba(51,25,78,0) calc(100% - 110px), rgba(51,25,78,0.5) 100%);
}

.stage {
  position: relative;
  z-index: 2;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  padding: clamp(16px, 3vh, 36px) var(--gutter) clamp(10px, 2vh, 18px);
}

.center {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  justify-content: safe center;
  gap: clamp(22px, 5vh, 52px);
  padding-bottom: 4vh;           /* optical centring */
}

.lang {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 5;
  padding: 6px 14px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--purple);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .18s ease, transform .18s ease;
}
.lang:hover { background: #fff; transform: translateY(-1px); }
.lang:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.hero { text-align: center; min-width: 0; }

.eyebrow {
  margin: 0 0 clamp(4px, 0.8vh, 10px);
  font-family: var(--display);
  font-size: clamp(0.68rem, 1.4vw, 0.84rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pink);
  text-wrap: balance;
}

.name {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.1rem, 6.2vw, 4.1rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--purple);
}

.bio {
  margin: clamp(8px, 1.4vh, 16px) auto 0;
  max-width: 100%;
  font-size: clamp(0.92rem, 1.6vw, 1.06rem);
  line-height: 1.6;
  color: var(--ink-soft);
  text-wrap: balance;
}

.bio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--pink);
  font-family: var(--display);
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.bio-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.bio-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.bio-toggle:hover { color: var(--pink-deep); }
.bio-toggle:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* Animating grid rows 0fr → 1fr opens it to its natural height. */
.bio-more {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .35s cubic-bezier(.22,1,.36,1), opacity .25s ease, margin .35s ease;
}
.bio-more.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: clamp(10px, 1.6vh, 16px);
}
.bio-more-clip { min-height: 0; overflow: hidden; }

.bio-more-text {
  max-width: min(74ch, 100%);
  max-height: clamp(130px, calc(100dvh - 560px), 320px);
  margin: 0 auto;
  padding: 16px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--ink-soft);
}
.bio-more-text:focus { outline: none; }
.bio-more-text p { margin: 0 0 0.8em; }
.bio-more-text p:last-child {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  color: var(--purple);
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: clamp(12px, 2vh, 20px);
}

.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: var(--card);
  color: var(--purple);
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.link-pill svg { width: 16px; height: 16px; flex: none; }
.link-pill:hover { background: #fff; color: var(--pink); transform: translateY(-1px); }
.link-pill:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.work {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.2vh, 12px);
}

.work-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.work-head h2 {
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);   /* stays readable over the dark pine */
  backdrop-filter: blur(6px);
  font-family: var(--display);
  font-size: clamp(0.68rem, 1.3vw, 0.8rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.rail-nav { display: flex; gap: 8px; }

.rail-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--card-line);
  border-radius: 50%;
  background: var(--card);
  color: var(--purple);
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.rail-btn svg,
.detail-nav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rail-btn:hover { background: var(--card-hi); transform: translateY(-1px); }
.rail-btn:active { transform: translateY(0) scale(0.95); }
.rail-btn[disabled] { opacity: 0.32; cursor: default; transform: none; }

/* Bleeds to the screen edges; the padding keeps the first card aligned with the heading. */
.rail {
  display: flex;
  gap: clamp(12px, 1.4vw, 16px);
  min-width: 0;
  margin: 0 calc(var(--gutter) * -1);
  padding: 6px var(--gutter) 10px;
  scroll-padding-inline: var(--gutter);
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.rail::-webkit-scrollbar { display: none; }
.rail:focus-visible { outline: 2px solid var(--pink); outline-offset: -2px; border-radius: 12px; }
.rail.dragging { scroll-behavior: auto; scroll-snap-type: none; cursor: grabbing; }
.rail.dragging .card { pointer-events: none; }

.rail > li {
  flex: 0 0 auto;
  width: clamp(200px, 20vw, 240px);
  scroll-snap-align: start;
  display: flex;
}

.card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px 16px 14px;
  border: 1px solid var(--card-line);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  background: var(--card-hi);
  box-shadow: var(--shadow-md);
}
.card:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }

.card-tag {
  align-self: flex-start;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.card-tag[data-kind="personal"] { background: #FDE3EC; color: var(--pink-deep); }
.card-tag[data-kind="client"]   { background: #E9DDF6; color: var(--purple); }

.card-title {
  margin: 1px 0 0;
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--purple);
}

.card-desc {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.card-hint {
  margin-top: auto;
  padding-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--pink);
}
.card-hint svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.card:hover .card-hint svg { transform: translateX(3px); }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 2px 14px;
  padding-top: 8px;
  font-size: 0.68rem;
  color: rgba(255, 241, 245, 0.82);
  text-align: center;
}
.foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.foot a:hover { color: #fff; }

.detail {
  width: min(1080px, 94vw);
  height: min(700px, 88dvh);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--card-line);
  border-radius: clamp(16px, 2vw, 24px);
  /* Two-tone background on the panel, not the columns, so only content moves when
     sliding between projects. 58.33% is the 1.4fr gallery column. */
  --gallery-bg: linear-gradient(160deg, #FDE9E7 0%, #F6D3D6 100%);
  background:
    linear-gradient(90deg, transparent 58.33%, #FFFDFC 58.33%),
    var(--gallery-bg);
  box-shadow: 0 24px 70px rgba(58, 24, 58, 0.30);
  color: var(--ink);
  overflow: hidden;
  transform-origin: top left;
}

.detail::backdrop {
  background: rgba(58, 24, 58, 0.45);
  backdrop-filter: blur(3px);
}

.detail-close,
.detail-nav {
  z-index: 3;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--card-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--purple);
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  transition: background .18s ease, transform .18s ease;
}
.detail-close { position: absolute; top: 12px; right: 12px; }
.detail-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.detail-close:hover { background: #fff; transform: rotate(90deg); }
.detail-close:focus-visible,
.detail-nav:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* Fixed, to escape the panel's overflow clip and sit on the backdrop beside it. */
.detail-nav {
  position: fixed;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
}
.detail-nav.is-prev { left:  max(10px, calc((100vw - min(1080px, 94vw)) / 2 - 64px)); }
.detail-nav.is-next { right: max(10px, calc((100vw - min(1080px, 94vw)) / 2 - 64px)); }
.detail-nav:hover { background: #fff; transform: scale(1.06); }
.detail-nav:active { transform: scale(0.96); }

.detail-inner {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.detail-inner:has(.detail-gallery[hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.detail:has(.detail-gallery[hidden]) { background: #FFFDFC; }

.detail-gallery {
  position: relative;
  min-width: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(14px, 2vw, 22px);
}

/* The frame hugs the shot at its own aspect ratio, whether desktop or phone. */
.shot-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.shot-main {
  position: absolute;
  inset: 0;
  margin: auto;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(122, 52, 96, 0.22);
  animation: shot-in .32s ease both;
}

@keyframes shot-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.shot-credit {
  margin-top: -4px;
  font-size: 0.66rem;
  color: var(--ink-soft);
  opacity: 0.85;
}

.shot-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shot-thumb {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--purple);
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s ease;
}
.shot-thumb[aria-current="true"] { background: #fff; box-shadow: var(--shadow-sm); }
.shot-thumb:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.detail-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(22px, 3vw, 36px) clamp(20px, 2.8vw, 34px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-title {
  margin: 0;
  padding-right: 36px;       /* clear the close button */
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--purple);
}

.detail-desc {
  margin: 0;
  font-size: clamp(0.9rem, 1.4vw, 0.98rem);
  line-height: 1.7;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.detail-desc p { margin: 0 0 0.85em; }
.detail-desc p:last-child { margin-bottom: 0; }
.detail-desc a { color: var(--pink); font-weight: 600; text-underline-offset: 2px; }
.detail-desc a:hover { color: var(--pink-deep); }

.detail-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-tech:empty { display: none; }

.detail-tech .tech-label {
  width: 100%;
  margin-bottom: 2px;
  font-family: var(--display);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0.75;
}

.detail-tech span:not(.tech-label) {
  padding: 3px 11px;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  /* Stays visible while a long description scrolls under it. */
  position: sticky;
  bottom: calc(clamp(22px, 3vw, 36px) * -1);
  padding-bottom: clamp(22px, 3vw, 36px);
  margin-bottom: calc(clamp(22px, 3vw, 36px) * -1);
  background: linear-gradient(180deg, rgba(255, 253, 252, 0) 0%, #FFFDFC 28%);
}
.detail-links:empty { display: none; }

.detail-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 17px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}
.detail-links a:hover { background: var(--pink-deep); transform: translateY(-1px); }
.detail-links a:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.detail-links a svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

@media (max-height: 580px) and (min-width: 761px) {
  .bio, .bio-more { display: none; }
}

@media (max-height: 480px) {
  .bio, .bio-more, .work-head { display: none; }
  .name { font-size: 1.9rem; }
  .eyebrow { margin-bottom: 2px; }
  .center { gap: 12px; }
  .links { margin-top: 8px; }
  .link-pill { padding: 5px 12px; }
  .card { padding: 12px 14px; gap: 4px; }
  .card-desc { -webkit-line-clamp: 2; line-clamp: 2; }
}

@media (max-width: 760px) {
  .stage { padding-top: max(58px, calc(env(safe-area-inset-top) + 46px)); }   /* clear the EN button */
  .center { gap: clamp(22px, 4vh, 36px); }
  .name { font-size: clamp(2rem, 9vw, 2.6rem); }
  .bio { font-size: 0.92rem; line-height: 1.55; }
  .bio-more-text { font-size: 0.86rem; padding: 14px 16px; max-height: clamp(120px, calc(100dvh - 590px), 300px); }

  /* Icon-only, so all three links fit on one row. */
  .link-pill:not(.is-mail) span { display: none; }
  .link-pill:not(.is-mail) { padding: 8px 10px; }

  .work-head .rail-nav { display: none; }
  .work-head { justify-content: center; }
  .rail > li { width: min(76vw, 300px); }
  .card { padding: 16px 18px; }
  .card-title { font-size: 1.02rem; }
  .card-desc { font-size: 0.84rem; }

  .detail {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    background:
      linear-gradient(180deg, transparent 44%, #FFFDFC 44%),
      var(--gallery-bg);
  }
  .detail-inner { grid-template-columns: minmax(0, 1fr); grid-template-rows: 44% minmax(0, 1fr); }
  .detail-gallery { padding: 64px 14px 12px; }
  .detail-body { padding: 20px 20px 28px; }
  .detail-links { bottom: -28px; padding-bottom: 28px; margin-bottom: -28px; }
  .detail-title { padding-right: 0; }

  .detail-close { top: max(12px, env(safe-area-inset-top)); right: 12px; }
  .detail-nav { top: max(12px, env(safe-area-inset-top)); margin-top: 0; width: 40px; height: 40px; }
  .detail-nav.is-prev { left: 12px; }
  .detail-nav.is-next { left: 60px; right: auto; }
}

@media (max-width: 760px) and (max-height: 480px) {
  .detail-inner { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .detail { background: linear-gradient(90deg, transparent 52.4%, #FFFDFC 52.4%), var(--gallery-bg); }
  .detail-gallery { padding-top: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .rail { scroll-behavior: auto; }
}
