:root {
  --bg: #f4f3ef;
  --ink: #161616;
  --muted: #6e6d68;
  --line: #d9d7d0;
  --accent: #1f3fd1;
}
:root[data-theme="dark"] {
  --bg: #151514;
  --ink: #ecebe6;
  --muted: #8f8e88;
  --line: #2e2e2b;
  --accent: #4169e1;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
main { max-width: 1040px; margin: 0 auto; padding: 0 1.5rem; }
section { padding: 7rem 0; }
h2 { font-size: .85rem; font-weight: 500; color: var(--muted); margin-bottom: 2.5rem; }

/* top */
.top {
  max-width: 1040px; margin: 0 auto; padding: 1.5rem;
  display: flex; justify-content: space-between; font-size: .9rem;
}
.logo { font-weight: 600; text-decoration: none; }
.theme-toggle { font: inherit; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; }
.theme-toggle:hover { color: var(--ink); }

/* hero */
.hero { min-height: calc(100vh - 5rem); display: grid; grid-template-columns: 1.4fr 1fr; gap: 4rem; align-items: center; padding-top: 2rem; }
.hero-text { font-size: clamp(1.7rem, 3.4vw, 2.6rem); font-weight: 400; line-height: 1.4; letter-spacing: -.01em; }
.hero-text strong { font-weight: 600; }
.hero-text em { font-family: "Newsreader", Georgia, serif; font-style: italic; font-size: 1.1em; line-height: 0; letter-spacing: 0; }
.face { aspect-ratio: 1; width: 100%; }
.face spline-viewer { width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .4s; }
.face spline-viewer.ready { opacity: 1; }
/* On touch screens the viewer swallows swipes, so let them scroll the page.
   The overlay catches touches even if the viewer ignores pointer-events. */
@media (hover: none) {
  .face { position: relative; }
  .face spline-viewer { pointer-events: none; }
  .face::after { content: ""; position: absolute; inset: 0; z-index: 1; }
}

/* about */
.about-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 4rem; }
.about-copy p { font-size: 1.15rem; margin-bottom: 1.1rem; max-width: 34em; }
.portrait { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; margin-bottom: 2rem; display: block; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .7rem 1.5rem; font-size: .95rem; align-content: start; }
.facts dt { color: var(--muted); }

/* work */
.work-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3rem 1.5rem; }
.w-card { display: flex; flex-direction: column; gap: .5rem; text-decoration: none; }
.w-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--line); margin-bottom: .5rem; transition: transform .4s ease; }
a.w-card:hover img { transform: scale(.98); }
.w-name { display: flex; align-items: center; gap: .6rem; font-size: 1.3rem; font-weight: 500; }
.w-name em { font-style: normal; font-size: .8rem; font-weight: 400; color: var(--muted); }
a.w-card:hover .w-name { color: var(--accent); }
.w-desc { color: var(--muted); font-size: 1.05rem; line-height: 1.4; }
.w-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.w-tags span { font-size: .8rem; padding: .2rem .7rem; border: 1px solid var(--ink); border-radius: 99px; }

/* contact */
.contact { padding-bottom: 9rem; }
.contact p { font-size: 1.15rem; }
.links { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 1.5rem; }
.links a { position: relative; font-size: clamp(1.4rem, 3vw, 2rem); text-decoration: none; }
.links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.12em; height: 1px; background: var(--accent);
  -webkit-mask: var(--wave) repeat-x 0 50% / 16px 8px; mask: var(--wave) repeat-x 0 50% / 16px 8px;
  -webkit-mask-image: none; mask-image: none;
}
.links a:hover { color: var(--accent); }
.links a:hover::after {
  height: 8px; bottom: -.3em;
  -webkit-mask-image: var(--wave); mask-image: var(--wave);
  animation: wave .6s linear infinite;
}
:root { --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 8' preserveAspectRatio='none'%3E%3Cpath d='M-8 4 Q-4 8 0 4 T8 4 T16 4 T24 4' fill='none' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E"); }
@keyframes wave { to { -webkit-mask-position: 16px 50%; mask-position: 16px 50%; } }
@media (prefers-reduced-motion: reduce) { .links a:hover::after { animation: none; } }

/* case study pages */
.case { padding-top: 4rem; }
.icon { width: 1em; height: 1em; vertical-align: -.125em; }
.back { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--muted); text-decoration: none; }
.back .icon { transition: transform .2s; }
.back:hover .icon { transform: translateX(-3px); }
.case-next .icon { width: .8em; height: .8em; vertical-align: -.02em; transition: transform .2s; }
.case-next:hover .icon { transform: translateX(4px); }
.back:hover { color: var(--accent); }
.case-title { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 500; letter-spacing: -.02em; line-height: 1.1; margin: 2.5rem 0 1rem; }
.case-lead { font-size: clamp(1.2rem, 2vw, 1.5rem); max-width: 30em; }
.case-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.5rem; margin: 3rem 0; font-size: .95rem; }
.case-meta dt { color: var(--muted); margin-bottom: .2rem; }
.case figure { margin: 3rem 0; }
.case figure img { width: 100%; height: auto; display: block; border-radius: 4px; background: var(--line); }
.case figure.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.case figcaption { font-size: .85rem; color: var(--muted); margin-top: .7rem; }
.case-block { display: grid; grid-template-columns: 1fr 2fr; gap: 4rem; margin: 5rem 0; }
.case-block h2 { margin: .3rem 0 0; }
.case-block p, .case-block li { font-size: 1.1rem; max-width: 36em; }
.case-block p + p, .case-block p + ul, .case-block ul + p { margin-top: 1rem; }
.case-block ul { padding-left: 1.1rem; }
.case-block li + li { margin-top: .5rem; }
.case-block a, .case-meta a { text-decoration-color: var(--accent); text-underline-offset: .2em; }
.case-block a:hover, .case-meta a:hover { color: var(--accent); }
.case-next { display: block; margin-top: 6rem; text-decoration: none; }
.case-next span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.case-next strong { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 500; letter-spacing: -.02em; }
.case-next:hover strong { color: var(--accent); }


/* dock */
.dock {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 10;
  display: flex; gap: .25rem; padding: .35rem; border-radius: 99px;
  background: var(--bg); border: 1px solid var(--line);
}
.dock a { font-size: .9rem; text-decoration: none; padding: .55rem 1.1rem; border-radius: 99px; white-space: nowrap; }
.dock a:hover { background: var(--line); }
.dock a.on { background: var(--ink); color: var(--bg); }

@media (max-width: 1000px) {
  .work-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  section { padding: 4.5rem 0; }
  .hero, .about-cols { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero { min-height: auto; }
  .face { max-width: 360px; margin: 0 auto; }
  .work-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .case-block { grid-template-columns: 1fr; gap: 1rem; margin: 3.5rem 0; }
}
