/* =========================================================
   CLUE — "clue.ledger"
   A bound account book: ruled green columns, red double rules,
   rubber stamps, coins moving between books.
   ========================================================= */

.work--clue {
  --g: #2f4a3c;
  --g-2: #4f6b58;
  --g-soft: rgba(47, 74, 60, .16);
  --red: #b5483a;
  --ledger: #f3efdf;
  --ledger-2: #ebe5cf;
  --gold: #c9a24a;
  background: #e6e0cb;
  color: #23302a;
}
.cl-wrap { width: 100%; max-width: 1320px; margin-inline: auto; padding-inline: var(--edge); }
.cl-label { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.cl-label::before { content: '§ '; }
.cl-h2 { font-family: var(--font-serif); font-weight: 450; font-size: clamp(2.4rem, 5vw, 4.8rem); line-height: .98; letter-spacing: -.02em; margin-top: .8rem; max-width: 17ch; color: #1d2a23; }
.cl-h2 em { font-style: italic; color: var(--g-2); }
.cl-h2--sm { font-size: clamp(2rem, 3.6vw, 3.3rem); }
.cl-fine { font-size: 11px; color: rgba(35, 48, 42, .65); margin-top: .8rem; }

/* ruled ledger paper */
.cl-sheet {
  position: relative;
  background-color: var(--ledger);
  background-image:
    linear-gradient(90deg, transparent calc(100% - 26%), rgba(181, 72, 58, .5) calc(100% - 26%), rgba(181, 72, 58, .5) calc(100% - 26% + 1px), transparent calc(100% - 26% + 1px), transparent calc(100% - 26% + 4px), rgba(181, 72, 58, .5) calc(100% - 26% + 4px), rgba(181, 72, 58, .5) calc(100% - 26% + 5px), transparent calc(100% - 26% + 5px)),
    repeating-linear-gradient(transparent 0 31px, var(--g-soft) 31px 32px);
  box-shadow: 0 40px 80px -40px rgba(30, 45, 35, .5);
}

/* stamps */
.cl-stamp {
  position: absolute; display: grid; place-items: center; text-align: center;
  padding: .7rem 1.2rem .6rem; border: 3px solid var(--red); border-radius: 10px;
  color: var(--red); transform: rotate(-12deg);
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .14em;
  mix-blend-mode: multiply; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 60%, rgba(0, 0, 0, .75) 61%, #000 70%);
}
.cl-stamp::before { content: ''; position: absolute; inset: 4px; border: 1px solid currentColor; border-radius: 6px; }
.cl-stamp span { font-size: 1.5rem; font-weight: 500; line-height: 1; }
.cl-stamp small { font-size: 9px; letter-spacing: .14em; margin-top: .25rem; }

/* tables */
.cl-table { display: grid; font-size: 12.5px; }
.cl-tr { display: grid; grid-template-columns: 4.5rem 1fr 5rem 5rem; align-items: end; min-height: 32px; padding-bottom: 6px; gap: 0 .6rem; }
.cl-tr span:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.cl-th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); border-bottom: 3px double var(--red); }
.cl-tr span:nth-child(4) { color: var(--g); font-weight: 500; }
.cl-tr span:nth-child(3) { color: var(--red); }

/* ---------- HERO ---------- */
.cl-hero { min-height: 100vh; padding: calc(var(--header-h) + 56px) var(--edge) 4rem; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 0%, #f1ecd9, #d9d2b8 70%); }
.cl-book { position: relative; width: min(1100px, 100%); display: grid; grid-template-columns: 34px 1fr; filter: drop-shadow(0 40px 50px rgba(30, 45, 35, .35)); }
.cl-book__spine { background: linear-gradient(90deg, #1f3329, var(--g) 40%, #1f3329); border-radius: 10px 0 0 10px; box-shadow: inset -4px 0 6px rgba(0,0,0,.25); }
.cl-book__spine::after { content: ''; display: block; margin: 40px 8px; height: calc(100% - 80px); border-block: 2px solid var(--gold); opacity: .7; }
.cl-hero__sheet { padding: clamp(1.6rem, 4vw, 3.4rem) clamp(1.4rem, 4vw, 3.6rem) clamp(2rem, 4vw, 3rem); border-radius: 0 10px 10px 0; overflow: hidden; }
.cl-hero__top { max-width: calc(74% - 1.5rem); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); padding-bottom: .6rem; border-bottom: 3px double var(--red); }
.cl-title { font-family: var(--font-serif); font-weight: 450; font-size: clamp(5.5rem, 15vw, 13rem); line-height: .85; letter-spacing: -.04em; color: var(--g); margin-top: 1.6rem; }
.cl-title em { font-style: italic; color: #1d2a23; }
.cl-title__w { display: inline-block; }
.cl-tag { font-family: var(--font-serif); font-size: clamp(1.2rem, 1.8vw, 1.55rem); line-height: 1.4; max-width: 34ch; margin-top: 1rem; color: #33443b; }
.cl-table--hero { margin-top: 2.2rem; max-width: 720px; }
.cl-stamp--hero { right: clamp(1rem, 5vw, 4.4rem); top: clamp(9rem, 20vw, 15rem); padding: 1rem 1.8rem .8rem; transform: rotate(-14deg); }
.cl-stamp--hero span { font-size: clamp(1.8rem, 3.4vw, 2.8rem); }

/* ---------- PROBLEM ---------- */
.cl-problem { padding: clamp(5rem, 10vw, 8rem) 0; background: var(--g); color: var(--ledger); }
.cl-problem .cl-h2 { color: var(--ledger); }
.cl-problem .cl-h2 em { color: var(--gold); }
.cl-problem .cl-label { color: var(--gold); }
.cl-problem__grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem 5rem; align-items: end; }
.cl-problem__text p { font-family: var(--font-serif); font-size: clamp(1.1rem, 1.4vw, 1.3rem); line-height: 1.55; color: rgba(243, 239, 223, .85); }
.cl-problem__text p + p { margin-top: 1.1rem; }

/* ---------- FLOW ---------- */
.cl-flow { background: #e6e0cb; }
.cl-flow__pin { min-height: 100vh; padding: calc(var(--header-h) + 40px) 0 4.5rem; display: flex; flex-direction: column; justify-content: center; gap: 1.6rem; }
.cl-flow__head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1rem 2rem; }
.cl-steps { display: flex; gap: .4rem; flex-wrap: wrap; }
.cl-steps li { font-size: 11.5px; padding: .5rem .8rem; border: 1.5px solid rgba(47, 74, 60, .35); border-radius: 999px; color: rgba(35, 48, 42, .6); transition: background .3s, color .3s, border-color .3s; }
.cl-steps li b { font-weight: 500; margin-right: .3rem; }
.cl-steps li.is-on { background: var(--g); border-color: var(--g); color: var(--ledger); }
.cl-stage { position: relative; width: 100%; aspect-ratio: 1200 / 520; }
.cl-stage__paths { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cl-stage__paths path { fill: none; stroke: rgba(47, 74, 60, .35); stroke-width: 2; stroke-dasharray: 2 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cl-gate {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  display: flex; align-items: center; gap: .6rem; white-space: nowrap;
  background: #1d2a23; color: var(--ledger); border-radius: 999px; padding: .45rem .5rem .45rem 1rem; font-size: 12px;
}
.cl-gate__k { color: var(--gold); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.cl-gate__p { font-weight: 500; }
.cl-gate__sig { background: rgba(243, 239, 223, .12); padding: .35rem .7rem; border-radius: 999px; font-size: 11px; transition: background .3s, color .3s; }
.cl-gate__sig.is-ok { background: #cfe2bf; color: #1d2a23; }
.cl-acct {
  position: absolute; width: 23%; min-height: 40%;
  background-color: var(--ledger);
  background-image: repeating-linear-gradient(transparent 0 27px, var(--g-soft) 27px 28px);
  background-position: 0 50px;
  border-radius: 6px 12px 12px 6px; border-left: 10px solid var(--g);
  box-shadow: 0 24px 40px -24px rgba(30, 45, 35, .55);
  padding: .8rem .9rem 1rem;
}
.cl-acct header { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0 .4rem; border-bottom: 3px double var(--red); padding-bottom: .4rem; }
.cl-acct header span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); grid-column: 1 / -1; }
.cl-acct header b { font-family: var(--font-serif); font-weight: 450; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1; color: #1d2a23; font-variant-numeric: tabular-nums; }
.cl-acct header small { font-size: 10.5px; color: rgba(35, 48, 42, .6); justify-self: end; }
.cl-acct__rows { margin-top: .4rem; display: grid; }
.cl-acct__rows li { display: flex; justify-content: space-between; gap: .6rem; font-size: 11.5px; min-height: 28px; align-items: end; padding-bottom: 4px; animation: cl-write .6s var(--ease-out-expo) both; }
.cl-acct__rows li b { font-weight: 500; font-variant-numeric: tabular-nums; }
.cl-acct__rows li .dr { color: var(--red); }
.cl-acct__rows li .cr { color: var(--g); }
@keyframes cl-write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.cl-acct--student { left: 0; top: 34%; }
.cl-acct--platform { right: 0; top: 18%; min-height: 32%; }
.cl-acct--teacher { right: 0; top: 64%; min-height: 32%; }
.cl-acct.is-pulse { animation: cl-pulse .6s var(--ease-out-expo); }
@keyframes cl-pulse { 40% { transform: scale(1.03); } }
.cl-engine {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%);
  width: 15%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-content: center; text-align: center; gap: .2rem;
  background: var(--g); color: var(--ledger);
  box-shadow: 0 0 0 8px rgba(47, 74, 60, .15), 0 24px 40px -18px rgba(30, 45, 35, .6);
  transition: box-shadow .4s;
}
.cl-engine__k { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.cl-engine b { font-family: var(--font-serif); font-weight: 450; font-size: clamp(1rem, 1.7vw, 1.5rem); }
.cl-engine__tx { font-size: 10px; opacity: .8; }
.cl-engine.is-open { box-shadow: 0 0 0 14px rgba(201, 162, 74, .35), 0 24px 40px -18px rgba(30, 45, 35, .6); }
.cl-coins { position: absolute; inset: 0; pointer-events: none; }
.cl-coin {
  position: absolute; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2d684, var(--gold) 60%, #9c7a2c);
  box-shadow: 0 0 0 2px #8a6a22 inset, 0 4px 8px rgba(0,0,0,.25);
  display: grid; place-items: center; font-size: 8.5px; font-weight: 500; color: #4a3810;
}
.cl-stamp--verified { left: 18%; top: 8%; opacity: 0; }
.cl-stamp--atomic { left: 61%; top: 1%; opacity: 0; transform: rotate(10deg); }
.cl-flow__fine { margin-top: 1rem; min-height: 1.4em; }

/* ---------- MORE ---------- */
.cl-more { padding: clamp(5rem, 10vw, 8rem) 0; background: var(--ledger); }
.cl-more__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4rem; margin-top: 3rem; }
.cl-card { position: relative; padding: 1.6rem 1.5rem 1.6rem; border-radius: 14px; background: #fbf8ee; border: 1px solid rgba(47, 74, 60, .2); box-shadow: 0 20px 40px -30px rgba(30, 45, 35, .5); overflow: hidden; }
.cl-card h3 { font-family: var(--font-serif); font-weight: 450; font-size: 1.6rem; line-height: 1.05; color: #1d2a23; }
.cl-card > p { font-size: 12.5px; line-height: 1.6; margin-top: .7rem; color: #33443b; }
.cl-hooks { margin-top: 1.4rem; display: grid; gap: .6rem; }
.cl-hooks li { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; padding: .7rem .9rem; border-radius: 10px; background: var(--ledger); border: 1px dashed rgba(47, 74, 60, .35); }
.cl-tick { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--g); color: var(--ledger); font-size: 12px; transform: scale(0); transition: transform .5s cubic-bezier(.3, 1.6, .5, 1) var(--d, 0s); }
.cl-hooks.is-on .cl-tick, .reduce-motion .cl-tick, .no-js .cl-tick { transform: scale(1); }
.cl-og { margin-top: 1.2rem; display: grid; gap: .5rem; }
.cl-og__bubble { justify-self: end; background: #dcf2c4; border-radius: 14px 14px 4px 14px; padding: .55rem .8rem; font-size: 12px; }
.cl-og__card { justify-self: end; width: 88%; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid rgba(0,0,0,.08); }
.cl-og__card img { width: 100%; height: 110px; object-fit: cover; }
.cl-og__card div { padding: .6rem .75rem; display: grid; gap: .15rem; }
.cl-og__card b { font-size: 11.5px; font-weight: 500; }
.cl-og__card span { font-size: 10.5px; color: rgba(35, 48, 42, .6); }
.cl-loop { width: 160px; margin: 1rem auto 0; overflow: visible; }
.cl-loop path { fill: none; stroke: var(--g); stroke-width: 1.5; stroke-dasharray: 4 5; animation: cl-dash 3s linear infinite; }
.cl-loop text { font-family: var(--font-mono); font-size: 11px; fill: var(--red); }
@keyframes cl-dash { to { stroke-dashoffset: -54; } }
.cl-code { margin-top: 1.2rem; padding: 1rem; border-radius: 10px; background: #1d2a23; color: #dfe8d6; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.cl-code .c { color: var(--gold); }
.cl-stamp--sm { right: 1.2rem; bottom: 1.2rem; transform: rotate(10deg); padding: .4rem .8rem .35rem; }
.cl-stamp--sm span { font-size: 1.1rem; }

/* ---------- ARCH ---------- */
.cl-arch { padding: clamp(5rem, 10vw, 8rem) 0; }
.cl-arch__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem 5rem; align-items: start; }
.cl-chart { margin-top: 2rem; display: grid; }
.cl-chart div { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid rgba(47, 74, 60, .25); }
.cl-chart dt { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--red); padding-top: .2rem; }
.cl-chart dd { margin: 0; font-family: var(--font-serif); font-size: 1.15rem; color: #1d2a23; }
.cl-totals { background: var(--ledger); border-radius: 6px; padding: 1.4rem 1.6rem; box-shadow: 0 30px 60px -36px rgba(30, 45, 35, .55); border-left: 10px solid var(--g); }
.cl-total { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .9rem 0; border-bottom: 1px dashed rgba(47, 74, 60, .35); }
.cl-total span { font-size: 12px; color: #33443b; }
.cl-total b { font-family: var(--font-serif); font-weight: 450; font-size: clamp(1.8rem, 3vw, 2.6rem); color: #1d2a23; white-space: nowrap; }
.cl-total--sum { border-bottom: 3px double var(--red); }

/* ---------- GALLERY ---------- */
.cl-gal { padding: clamp(4rem, 8vw, 7rem) 0; background: #d9d2b8; }
.cl-gal__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.6rem; margin-top: 2.4rem; align-items: start; }
.cl-reel { grid-column: 1 / -1; margin: 0; border-radius: 10px; overflow: hidden; background: #1d2a23; box-shadow: 0 30px 60px -36px rgba(30, 45, 35, .7); }
.cl-reel video { width: 100%; height: auto; aspect-ratio: 21 / 9; object-fit: cover; }
.cl-reel figcaption { padding: .7rem 1rem; color: var(--ledger); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
.cl-receipt {
  margin: 0; background: #fbf8ee; padding: 10px 10px 0;
  transform: rotate(var(--r, 0deg));
  box-shadow: 0 20px 30px -20px rgba(30, 45, 35, .5);
  -webkit-mask: radial-gradient(circle 6px at 50% 100%, transparent 98%, #000) 0 0 / 16px 100% repeat-x;
          mask: radial-gradient(circle 6px at 50% 100%, transparent 98%, #000) 0 0 / 16px 100% repeat-x;
  padding-bottom: 14px;
}
.cl-receipt img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; filter: sepia(.18) saturate(.85); }
.cl-receipt figcaption { display: flex; justify-content: space-between; font-size: 11px; padding: .6rem .2rem 0; border-top: 1px dashed rgba(47, 74, 60, .4); margin-top: .6rem; }
.cl-gal__grid [data-reveal].is-in.cl-receipt { transform: rotate(var(--r, 0deg)); }

/* ---------- STACK ---------- */
.cl-stack { padding: clamp(4rem, 8vw, 7rem) 0; }
.cl-stack__sheet { padding: clamp(2rem, 4vw, 3.4rem); border-radius: 8px; overflow: hidden; }
.cl-table--stack { margin-top: 1.8rem; }
.cl-table--stack .cl-tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.cl-table--stack .cl-tr span:nth-child(2) { text-align: left; color: #33443b; font-weight: 400; }
.cl-table--stack .cl-tr span:first-child { font-weight: 500; color: #1d2a23; }
.cl-links { margin-top: 2rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem; }
.cl-links p { font-family: var(--font-serif); font-size: 1.2rem; max-width: 40ch; }
.cl-links__row { display: flex; flex-wrap: wrap; gap: .7rem; }
.cl-btn { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 500; padding: .9rem 1.3rem; border-radius: 8px; border: 1.5px solid var(--g); color: var(--g); transition: background .25s, color .25s, transform .3s; }
.cl-btn:hover { background: var(--g); color: var(--ledger); transform: translateY(-2px); }
.cl-btn--g { background: var(--g); color: var(--ledger); }
.cl-btn--g:hover { background: #1d2a23; }
.cl-stamp--end { right: clamp(1rem, 4vw, 3rem); top: clamp(1rem, 3vw, 2.4rem); transform: rotate(8deg); }

.work--clue .next-app { background: #e6e0cb; }
.work--clue .next-app__name { color: var(--g); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .cl-problem__grid, .cl-arch__grid { grid-template-columns: 1fr; }
  .cl-more__grid { grid-template-columns: 1fr; }
  .cl-stage { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
  .cl-stage__paths, .cl-coins { display: none; }
  .cl-gate, .cl-acct, .cl-engine { position: relative; left: auto; right: auto; top: auto; transform: none; width: auto; min-height: 0; }
  .cl-gate { grid-column: 1 / -1; justify-self: center; flex-wrap: wrap; justify-content: center; white-space: normal; }
  .cl-acct--student { grid-column: 1 / -1; }
  .cl-engine { grid-column: 1 / -1; justify-self: center; width: 150px; order: 0; }
  .cl-acct--student { order: -1; }
  .cl-gate { order: -2; }
  .cl-acct__rows li { font-size: 11px; }
  .cl-stamp--verified { left: auto; right: 4%; top: 2%; }
  .cl-stamp--atomic { left: 50%; top: 40%; }
}
@media (max-width: 600px) {
  .cl-hero__top { max-width: none; }
  .cl-book { grid-template-columns: 16px 1fr; }
  .cl-tr { grid-template-columns: 2.6rem 1fr 3.4rem 3.4rem; font-size: 11px; gap: 0 .35rem; }
  .cl-stamp--hero { top: auto; bottom: 1.2rem; right: 1rem; padding: .6rem 1rem .5rem; }
  .cl-stamp--hero span { font-size: 1.4rem; }
  .cl-hero__sheet { padding-bottom: 6rem; }
  .cl-steps li { padding: .4rem .6rem; font-size: 10.5px; }
  .cl-gal__grid { grid-template-columns: 1fr; }
  .cl-reel video { aspect-ratio: 16 / 9; }
  .cl-table--stack .cl-tr { grid-template-columns: 1fr; min-height: 0; padding: .5rem 0; }
  .cl-table--stack .cl-th span:last-child { display: none; }
  .cl-stamp--end { display: none; }
  .cl-chart div { grid-template-columns: 5rem 1fr; }
}
