@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #faf6ef;
  --paper: #ffffff;
  --ink: #1f1d2b;
  --muted: #625e70;
  --line: #e6dfd2;
  --red: #e2543a;
  --red-soft: #fbe6e0;
  --green: #3f8f5c;
  --green-soft: #e3f1e7;
  --blue: #3a6fd8;
  --blue-soft: #e3ebfa;
  --yellow: #f2b632;
  --yellow-soft: #fdf1d6;
  --purple: #8a5cc9;
  --radius: 14px;
  --max: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: .6em; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 640px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: rgba(250,246,239,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-family: 'Fraunces', serif; font-weight: 700; font-size: 1.15rem; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand-tiles { display: grid; grid-template-columns: repeat(2, 9px); gap: 2px; }
.brand-tiles i { width: 9px; height: 9px; border-radius: 3px; }
.nav ul { list-style: none; display: flex; gap: 28px; margin: 0; padding: 0; font-size: .95rem; font-weight: 500; }
.nav ul a { text-decoration: none; color: var(--muted); }
.nav ul a:hover { color: var(--ink); }

/* hero */
.hero { padding: 88px 0 72px; }
.hero .wrap { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; }
.hero h1 span { color: var(--red); }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: .95rem; text-decoration: none; border: 2px solid var(--ink); }
.btn.primary { background: var(--ink); color: #fff; }
.btn:hover { transform: translateY(-1px); }

.board { position: relative; background: #2b2840; border-radius: 22px; box-shadow: 0 20px 40px -18px rgba(31,29,43,.5); aspect-ratio: 1; user-select: none; -webkit-user-select: none; }
.board-inner { position: absolute; inset: 16px; overflow: hidden; touch-action: none; --cell: calc((100% - 35px) / 6); }
.board .tile { position: absolute; width: var(--cell); height: var(--cell); left: calc(var(--x) * (var(--cell) + 7px)); top: calc(var(--y) * (var(--cell) + 7px)); border-radius: 9px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.25); cursor: grab; transition: left .19s ease, top .3s cubic-bezier(.45,0,.6,1.25), transform .15s ease, filter .15s ease; animation: pop .5s ease backwards; }
.board .tile:hover { filter: brightness(1.08); }
.board .tile.sel { transform: scale(.86); box-shadow: inset 0 0 0 3px #fff, inset 0 -4px 0 rgba(0,0,0,.18); }
.board .tile.nope { transition: left .19s ease-in-out, top .19s ease-in-out; }
.board .tile.hint { animation: nudge 1.1s ease-in-out infinite; }
.board .tile.clear { animation: vanish .23s ease-in forwards; }
.board .combo { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-weight: 800; font-size: 1.7rem; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.3); pointer-events: none; opacity: 0; white-space: nowrap; }
.board .combo.show { animation: combo .9s ease forwards; }
.board-note { margin: 12px 0 0; text-align: center; font-size: .85rem; color: var(--muted); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes vanish { 30% { transform: scale(1.15); } to { transform: scale(0); opacity: 0; } }
@keyframes nudge { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(1.1) rotate(-4deg); } }
@keyframes combo { 0% { opacity: 0; transform: translate(-50%,-30%) scale(.6); } 25% { opacity: 1; transform: translate(-50%,-50%) scale(1.1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-80%) scale(1); } }
.c1 { background: var(--red); } .c2 { background: var(--green); } .c3 { background: var(--blue); } .c4 { background: var(--yellow); } .c5 { background: var(--purple); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: -8px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stat b { display: block; font-family: 'Fraunces', serif; font-size: 2.2rem; line-height: 1; margin-bottom: 6px; }
.stat span { color: var(--muted); font-size: .92rem; }
.stat:nth-child(1) b { color: var(--red); } .stat:nth-child(2) b { color: var(--green); } .stat:nth-child(3) b { color: var(--blue); } .stat:nth-child(4) b { color: var(--purple); }

section { padding: 88px 0; }
section.alt { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { margin-bottom: 40px; }

/* work cards */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 36px -20px rgba(31,29,43,.35); }
.card .thumb { aspect-ratio: 16/9; display: flex; align-items: flex-end; padding: 20px; position: relative; overflow: hidden; }
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .thumb .big { font-family: 'Fraunces', serif; font-size: 3.4rem; font-weight: 700; line-height: 1; position: relative; }
.card .thumb .ph { position: absolute; top: 14px; right: 14px; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; background: rgba(255,255,255,.75); padding: 3px 8px; border-radius: 999px; color: var(--muted); }
.card .body { padding: 22px 24px 26px; }
.card .meta { font-size: .82rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; margin-bottom: 6px; }
.card p { color: var(--muted); margin: 0; font-size: .97rem; }
.t-red { background: var(--red-soft); color: var(--red); } .t-green { background: var(--green-soft); color: var(--green); }
.t-blue { background: var(--blue-soft); color: var(--blue); } .t-yellow { background: var(--yellow-soft); color: #b07d0c; }
.t-dark { background: #2b2840; color: #fff; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tags span { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }

/* principles */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; align-items: start; }
.principle { border-top: 4px solid; padding-top: 16px; }
.principle:nth-child(1) { border-color: var(--red); } .principle:nth-child(2) { border-color: var(--green); }
.principle:nth-child(3) { border-color: var(--blue); } .principle:nth-child(4) { border-color: var(--yellow); }
.principle p { color: var(--muted); font-size: .95rem; }

.figure { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.figure figcaption { font-size: .85rem; color: var(--muted); margin-top: 10px; font-style: italic; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 26px 26px; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 6px; width: 14px; height: 14px; border-radius: 4px; background: var(--red); }
.timeline li:nth-child(2)::before { background: var(--green); } .timeline li:nth-child(3)::before { background: var(--blue); }
.timeline li:nth-child(4)::before { background: var(--yellow); } .timeline li:nth-child(5)::before { background: var(--purple); }
.timeline b { display: block; }
.timeline span { color: var(--muted); font-size: .92rem; }

/* contact */
.contact { background: #2b2840; color: #fff; text-align: center; }
.contact .lede { color: #c9c5d8; margin: 0 auto 28px; }
.contact .btn { border-color: #fff; color: #fff; }
.contact .btn.primary { background: #fff; color: var(--ink); }
.contact .cta { justify-content: center; }
footer { padding: 28px 0; font-size: .85rem; color: var(--muted); text-align: center; }

/* case study pages */
.case-hero { padding: 72px 0 40px; }
.back { display: inline-block; margin-bottom: 28px; font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 32px 0 0; }
.facts div { background: var(--paper); padding: 16px 18px; }
.facts small { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.facts b { font-weight: 600; }
.case section { padding: 56px 0; }
.case .prose { max-width: 720px; }
.case .prose ul { padding-left: 1.2em; } .case .prose li { margin-bottom: .4em; }
.note { border-left: 4px solid var(--yellow); background: var(--yellow-soft); padding: 14px 18px; border-radius: 0 10px 10px 0; font-size: .95rem; margin: 24px 0; }
.todo { display: none; }
.draft .todo { display: block; border: 2px dashed var(--red); background: var(--red-soft); color: #8d2e1c; padding: 16px 20px; border-radius: 12px; font-size: .92rem; margin: 24px 0; }
.todo b { display: block; margin-bottom: 4px; }
.video { aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe { width: 100%; height: 100%; border: 0; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--paper); border-radius: var(--radius); overflow: hidden; }
th { text-align: left; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 2px solid var(--ink); }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ladder { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ladder div { padding: 14px; border-radius: 12px; font-size: .9rem; background: var(--blue-soft); }
.ladder div:nth-child(2) { background: #d4e0f7; } .ladder div:nth-child(3) { background: #c3d4f3; }
.ladder div:nth-child(4) { background: #a9c1ee; } .ladder div:nth-child(5) { background: var(--blue); color: #fff; }
.ladder b { display: block; margin-bottom: 4px; }
.next { display: flex; justify-content: space-between; gap: 16px; padding: 40px 0 72px; border-top: 1px solid var(--line); }
.next a { text-decoration: none; font-weight: 600; }

@media (max-width: 860px) {
  .hero .wrap, .grid2 { grid-template-columns: 1fr; }
  .hero .board-wrap { max-width: 320px; }
  .stats, .grid4, .facts { grid-template-columns: repeat(2, 1fr); }
  .cards, .grid3 { grid-template-columns: 1fr; }
  .ladder { grid-template-columns: 1fr; }
  .nav ul { gap: 16px; font-size: .88rem; }
  section { padding: 64px 0; }
}
@media (max-width: 520px) { .nav ul li:nth-child(n+3) { display: none; } }
@media (prefers-reduced-motion: reduce) { .board .tile, .board .tile.hint, .board .combo.show { animation: none; } .board .tile { transition: none; } .board .tile.clear { opacity: 0; } html { scroll-behavior: auto; } }
