/* =========================================================
   Tokens
   ========================================================= */
:root {
  --paper: #f4f1e8;
  --grid: #dadce6;
  --ink: #1c1d33;
  --ink-soft: #5b5d72;

  --navy: #1e1f3b;
  --indigo: #2d3a8c;
  --peri: #5b68c9;
  --mist: #a9b0e3;
  --kraft: #cbbe9b;

  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;

  /* folder geometry (read by script.js too) */
  --tw: 250px;      /* tab width */
  --th: 50px;       /* tab height */
  --step: 62px;     /* gap between stacked folders */
  --open-top: 62px; /* where folders sit when one is open */
  --pad: 48px;      /* page side padding */

  --ease: cubic-bezier(0.2, 0.9, 0.25, 1);
}

@media (max-width: 700px) {
  :root {
    --tw: 150px;
    --th: 40px;
    --step: 50px;
    --open-top: 52px;
    --pad: 20px;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.locked { overflow: hidden; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--peri);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================================
   Desk (the whole page)
   ========================================================= */
.desk {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

/* top bar */
.top {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px var(--pad);
}
.logo {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.logo span {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 3px;
  border-radius: 50%;
  background: var(--peri);
}
.nav { display: flex; gap: 26px; }
.nav a {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
}
.nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* hero */
.hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 40px;
  align-items: start;
  padding: clamp(32px, 6vh, 64px) var(--pad) 0;
}
.hello {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 13px;
}
.hello b { color: var(--indigo); font-weight: 500; }

.headline {
  max-width: 880px;
  margin: 0;
  font-size: clamp(31px, 3.7vw, 54px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.025em;
}
.headline u {
  text-decoration: none;
  background: linear-gradient(var(--peri), var(--peri)) 0 92% / 0% 3px no-repeat;
  padding-bottom: 2px;
  animation: underline 0.9s var(--ease) forwards;
  animation-delay: calc(1.1s + var(--u, 0) * 0.3s);
}

/* doodles */
.doodles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px 30px;
  padding-top: 8px;
}
.doodle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.doodle svg {
  width: 70px;
  height: 70px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease);
}
.doodle path, .doodle circle, .doodle rect {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.3s ease forwards;
  animation-delay: calc(0.6s + var(--d, 0) * 0.15s);
}
.doodle:hover svg { transform: rotate(-6deg) scale(1.06); }
.doodle:hover { color: var(--ink); }

/* hint */
.hint {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: clamp(24px, 4vh, 44px) var(--pad) 0;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 13px;
}
.hint svg {
  width: 60px;
  height: 44px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.hint path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1s ease 1.6s forwards;
}

/* hero leaves when a folder opens */
.top, .hero, .hint {
  transition: opacity 0.4s ease, transform 0.6s var(--ease), visibility 0s linear 0s;
}
.desk.is-open .top,
.desk.is-open .hero,
.desk.is-open .hint {
  opacity: 0;
  transform: translateY(-24px);
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.6s var(--ease), visibility 0s linear 0.6s;
}

/* =========================================================
   Folders
   ========================================================= */
.stack {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.folder {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--y);
  height: var(--h);
  z-index: var(--z);
  pointer-events: none;
  animation: rise 1s var(--ease) both;
  animation-delay: calc(0.15s + var(--i) * 0.08s);
  transition: top 0.75s var(--ease), height 0.75s var(--ease);
}
.desk.is-open .folder {
  top: var(--open-top);
  height: calc(100dvh - var(--open-top));
}
.folder.active { z-index: 50; }

.folder[data-tone="navy"]   { --c: var(--navy);   --on: #ffffff; --soft: #c9ccf2; --chip: rgba(255,255,255,.1); }
.folder[data-tone="indigo"] { --c: var(--indigo); --on: #ffffff; --soft: #d3d8ff; --chip: rgba(255,255,255,.1); }
.folder[data-tone="peri"]   { --c: var(--peri);   --on: #ffffff; --soft: #eef0ff; --chip: rgba(255,255,255,.14); }
.folder[data-tone="mist"]   { --c: var(--mist);   --on: var(--ink); --soft: #33355a; --chip: rgba(28,29,51,.08); }
.folder[data-tone="kraft"]  { --c: var(--kraft);  --on: var(--ink); --soft: #4d4733; --chip: rgba(28,29,51,.08); }

.tab {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--tw);
  height: var(--th);
  padding: 0 34px;
  border: 0;
  background: none;
  color: var(--on);
  font: 600 13px/var(--th) var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  transition: left 0.75s var(--ease), transform 0.3s var(--ease);
}
.desk.is-open .tab { left: var(--xo); width: var(--two, var(--tw)); }
.tab svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tab svg path { fill: var(--c); }
.tab-label {
  position: relative;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.desk:not(.is-open) .tab:hover { transform: translateY(-6px); }
.tab:focus-visible { outline: none; }
.tab:focus-visible .tab-label { text-decoration: underline; text-underline-offset: 5px; }

.fbody {
  position: absolute;
  top: calc(var(--th) - 1px);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: var(--c);
  color: var(--on);
  pointer-events: auto;
}

/* monogram on the front folder */
.mark {
  position: absolute;
  left: clamp(40px, 9vw, 130px);
  top: 30px;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border: 10px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.2);
  font-size: 80px;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.desk.is-open .mark { opacity: 0; }

/* =========================================================
   Folder contents
   ========================================================= */
.content {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(28px, 5vh, 44px) var(--pad) 80px;
  visibility: hidden;
}
.folder.active .content { visibility: visible; }

.content-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px 420px;
  gap: 56px;
  max-width: 1340px;
}
.content-grid.single { grid-template-columns: minmax(0, 1fr); }

/* staggered entrance for everything inside an open folder */
.reveal {
  opacity: 0;
  transform: translateY(16px);
}
.folder.active .reveal {
  animation: in 0.6s var(--ease) forwards;
  animation-delay: calc(0.45s + var(--r, 0) * 0.07s);
}

.close {
  position: absolute;
  top: 18px;
  right: var(--pad);
  z-index: 5;
  padding: 6px 4px;
  border: 0;
  background: none;
  color: var(--on);
  font-family: var(--mono);
  font-size: 13px;
  opacity: 0.8;
  cursor: pointer;
}
.folder:not(.active) .close { display: none; }
.close:hover { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

.meta-line {
  margin: 0 0 16px;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 13px;
}
.ptitle {
  margin: 0 0 20px;
  font-size: clamp(38px, 4.8vw, 66px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}
.desc {
  max-width: 56ch;
  margin: 0 0 14px;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.55;
}
.label {
  margin: 30px 0 12px;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 10px;
  border-radius: 12px;
  background: var(--chip);
  font-size: 15px;
}
.chip i {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--on);
  color: var(--c);
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
}
.chip small {
  color: var(--soft);
  font-family: var(--mono);
  font-size: 11px;
}

.did {
  max-width: 60ch;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 17px;
}
.did li { display: flex; gap: 12px; margin-bottom: 10px; }
.did li::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--soft);
}

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}
.btn {
  padding: 12px 20px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  transition: transform 0.25s var(--ease), background-color 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn.solid { background: var(--on); border-color: var(--on); color: var(--c); }

.big-link {
  display: inline-block;
  margin-top: 10px;
  font-size: clamp(26px, 4vw, 52px);
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
  word-break: break-word;
}

.rule {
  height: 520px;
  margin-top: 20px;
  background: color-mix(in srgb, var(--on) 25%, transparent);
}

/* polaroid */
.side { position: relative; padding-left: 20px; }
.polaroid {
  position: relative;
  width: min(360px, 100%);
  margin: 46px 0 0 30px;
  padding: 14px 14px 50px;
  background: #fbfaf6;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  transform: rotate(3deg);
  transform-origin: 18% 0;
}
.folder.active .polaroid { animation: swing 1.4s var(--ease) 0.5s both; }
.polaroid img,
.shot-empty {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
.shot-empty {
  display: grid;
  place-items: center;
  background-color: #12142a;
  background-image:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 18px 18px;
  color: #aab0e6;
  font-family: var(--mono);
  font-size: 12px;
}
.polaroid .cap {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.clip {
  position: absolute;
  top: -34px;
  left: 40px;
  z-index: 2;
  width: 34px;
  height: 84px;
  fill: none;
  stroke: #9ca0ad;
  stroke-width: 3.2;
  stroke-linecap: round;
}

.arrow {
  display: block;
  width: 110px;
  height: 90px;
  margin: 34px 0 0 -6px;
  fill: none;
  stroke: var(--on);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.85;
}
.arrow path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.folder.active .arrow path { animation: draw 0.9s ease forwards 1.3s; }
.note {
  max-width: 220px;
  margin: 8px 0 0;
  color: var(--soft);
  font-family: var(--mono);
  font-size: 12px;
}

.noscript {
  padding: 20px var(--pad);
  font-family: var(--mono);
}

/* =========================================================
   Motion
   ========================================================= */
@keyframes rise {
  from { transform: translateY(220px); }
  to   { transform: none; }
}
@keyframes underline {
  to { background-size: 100% 3px; }
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}
@keyframes in {
  to { opacity: 1; transform: none; }
}
@keyframes swing {
  0%   { opacity: 0; transform: translateY(-50px) rotate(-8deg); }
  45%  { opacity: 1; transform: translateY(0) rotate(6deg); }
  65%  { transform: rotate(1.5deg); }
  82%  { transform: rotate(3.8deg); }
  100% { transform: rotate(3deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   Small screens
   ========================================================= */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .doodles { display: none; }
  .content-grid { grid-template-columns: 1fr; gap: 0; }
  .rule { display: none; }
  .side { order: -1; padding-left: 0; }
  .polaroid { width: min(300px, 80%); margin: 14px auto 28px; }
  .arrow, .note { display: none; }
}

@media (max-width: 700px) {
  .top { padding: 20px var(--pad); }
  .nav { gap: 16px; }
  .nav a { font-size: 12px; }
  .hello { margin-bottom: 16px; font-size: 12px; }
  .headline { line-height: 1.18; }
  .tab { padding: 0 22px; font-size: 10px; letter-spacing: 0.12em; }
  .mark { left: auto; right: -24px; top: 12px; width: 110px; height: 110px; border-width: 8px; font-size: 56px; }
  .close { top: 12px; font-size: 12px; }
  .polaroid { width: min(240px, 75%); padding: 10px 10px 38px; }
  .polaroid .cap { left: 12px; bottom: 12px; font-size: 10px; }
  .clip { top: -26px; left: 28px; width: 26px; height: 64px; }
  .chip { padding: 7px 12px 7px 8px; font-size: 13px; }
  .chip i { width: 22px; height: 22px; font-size: 10px; }
  .did { font-size: 15px; }
}
