/* Tj Catabay portfolio — shared design system */

:root {
  /* color */
  --paper: #F7F7F7;
  --surface: #FFFFFF;
  --ink: #2A2A2A;
  --ink-soft: #5C5C5C;
  --line: #DEDEDE;
  --accent: #79A9BC;
  --accent-ink: #79A9BC;
  --on-accent: #FFFFFF;

  /* project themes override these */
  --page-bg: var(--paper);
  --page-ink: var(--ink);
  --page-soft: var(--ink-soft);
  --page-line: var(--line);
  --page-accent: var(--accent-ink);

  /* type scale */
  --fs-h1: clamp(2.125rem, 1.4rem + 3vw, 3.5rem);     /* 34 → 56 */
  --fs-h2: clamp(1.75rem, 1.35rem + 1.7vw, 2.5rem);   /* 28 → 40 */
  --fs-h3: clamp(1.375rem, 1.2rem + 0.75vw, 1.75rem); /* 22 → 28 */
  --fs-h4: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);   /* 16 → 18 */
  --fs-lead: clamp(1.125rem, 1rem + 0.6vw, 1.5rem);   /* 18 → 24 */
  --fs-body: clamp(1rem, 0.95rem + 0.25vw, 1.125rem); /* 16 → 18 */
  --fs-small: 0.875rem;

  /* layout */
  --max: 1400px;
  --gutter: clamp(20px, 2.8vw, 40px);
  --section: clamp(56px, 7vw, 104px);
  /* corner radius: tight, tech-style scale (between Microsoft Fluent 2 and Vercel Geist) */
  --radius-xs: 4px;   /* tags, badges, focus rings */
  --radius-sm: 6px;   /* buttons, inputs, images inside content */
  --radius-md: 10px;  /* cards, panels */  --header-h: 84px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--page-ink);
  font-family: "Figtree", "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-h1); line-height: 1.1; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.25; }
h4 { font-size: var(--fs-h4); line-height: 1.4; }
p { margin: 0; }
p + p { margin-top: 1em; }
strong { font-weight: 700; }

.wrap { width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.work h2.sr-only { margin: -1px; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); color: var(--ink); padding: 8px 16px; border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }

:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; border-radius: var(--radius-xs); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  --hdr-bg: rgba(255, 255, 255, 0.92); --hdr-ink: var(--ink); --hdr-line: var(--line); --hdr-hover: #EEF3F5; --hdr-current: var(--accent-ink);
  background: var(--hdr-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--hdr-line);
  color: var(--hdr-ink);
}
.theme-kanpai .site-header { --hdr-bg: rgba(20, 20, 20, 0.9); --hdr-ink: #fff; --hdr-line: #2E2E2E; --hdr-hover: #262626; --hdr-current: #FF0000; }
.site-header .wrap { height: var(--header-h); display: flex; align-items: center; gap: 36px; }
.nav { display: flex; gap: 32px; }
.nav a { padding: 10px 0; }
.nav a, .mobile-nav a { text-decoration: none; font-size: 1.0625rem; font-weight: 500; color: var(--hdr-ink); }
.nav a:hover, .nav a[aria-current="page"], .mobile-nav a[aria-current="page"] { color: var(--hdr-current); }
.brand { display: block; flex: none; line-height: 0; }
.brand img { width: 40px; height: 40px; }  /* logo */
.brand img { transition: scale 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); }
@media (hover: hover) { .brand:hover img { scale: 1.08; } }  /* same grow as the social icons, scaled to the logo's size */
.social { margin-left: auto; margin-right: -10px; display: flex; gap: 4px; }  /* visible icons line up with the page's right edge */
.social a { display: grid; place-items: center; width: 44px; height: 44px; }  /* invisible 44px tap area around the icon */
.social svg { transition: scale 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.3s ease; }
@media (hover: hover) { .social a:hover svg { scale: 1.12; } .social a:hover { opacity: 0.85; } }
.social a { color: var(--hdr-ink); }
.social svg { width: 26px; height: 26px; fill: currentColor; }
.social svg[fill="none"] { fill: none; }
.menu-btn { display: none; justify-self: start; width: 44px; height: 44px; margin-left: -10px; border: 0; background: none; cursor: pointer; color: var(--hdr-ink); }
.menu-btn svg { width: 26px; height: 26px; }
.mobile-nav { display: none; }

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .nav { display: none; }
  .menu-btn { display: grid; place-items: center; }
  .site-header .wrap { gap: 8px; position: relative; }
  .brand { position: absolute; left: 50%; translate: -50% 0; }  /* centered on the page while the menu is a hamburger */
  .brand img { width: 34px; height: 34px; }
  .social { gap: 0; margin-right: -10px; }
  /* the menu unfolds under the header: the panel grows from 0 to its height, then the links drop in one after another */
  .mobile-nav { display: grid; grid-template-rows: 0fr; visibility: hidden; border-top: 0 solid var(--hdr-line); transition: grid-template-rows 0.4s cubic-bezier(0.3, 0.7, 0.2, 1), visibility 0s linear 0.4s; }
  .mobile-nav.open { grid-template-rows: 1fr; visibility: visible; border-top-width: 1px; transition-delay: 0s; }
  .mobile-nav ul { list-style: none; margin: 0; padding: 0 var(--gutter); min-height: 0; overflow: hidden; }
  .mobile-nav li:first-child { padding-top: 8px; }
  .mobile-nav li:last-child { padding-bottom: 16px; }
  .mobile-nav li { opacity: 0; translate: 0 -8px; transition: opacity 0.2s ease, translate 0.2s ease; }
  .mobile-nav.open li { opacity: 1; translate: 0 0; transition: opacity 0.32s ease calc(0.08s + var(--i, 0) * 0.055s), translate 0.38s cubic-bezier(0.3, 0.7, 0.2, 1) calc(0.08s + var(--i, 0) * 0.055s); }
  .mobile-nav li:nth-child(2) { --i: 1; } .mobile-nav li:nth-child(3) { --i: 2; } .mobile-nav li:nth-child(4) { --i: 3; }
  .mobile-nav a { display: block; padding: 14px 0; font-size: 1.125rem; border-bottom: 1px solid var(--hdr-line); }
  .mobile-nav li:last-child a { border-bottom: 0; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.site-footer .wrap { padding-top: 28px; padding-bottom: 28px; text-align: center; font-size: var(--fs-small); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px;
  border-radius: var(--radius-sm); border: 0;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #6898AB; }
.btn--project { background: var(--page-accent); color: var(--page-on-accent, #fff); }
.btn--project:hover { filter: brightness(0.85); background: var(--page-accent); }

/* ---------- home ---------- */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(40px, 6vw, 80px); }
.hero .wrap { padding-inline: calc(var(--gutter) + clamp(16px, 4vw, 64px)); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: clamp(32px, 6vw, 80px); }  /* sits a little inside the page margins */
.hero h1 { max-width: 14ch; color: var(--accent-ink); }
.hero .role { margin-top: 16px; font-size: var(--fs-h3); font-weight: 600; color: var(--ink); }
.hero-photo { width: clamp(180px, 25vw, 360px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.hero-photo-link { display: block; border-radius: 50%; }  /* the photo opens the About page */
@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; justify-items: center; text-align: center; padding-inline: var(--gutter); }
  .hero-photo-link { order: -1; }
  .hero h1 { max-width: none; }
}

.work { padding-bottom: var(--section); }
.work h2 { margin-bottom: 28px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 32px); }
@media (max-width: 1279px) { .cards { grid-template-columns: 1fr; } }

/* project card */
.card {
  --c-bg: #fff; --c-ink: var(--ink); --c-soft: var(--ink-soft); --c-accent: var(--accent-ink); --c-art: #EEF3F5;
  position: relative; display: flex; flex-direction: column;
  background: var(--c-bg); color: var(--c-ink);
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  text-decoration: none;
}
.card-art { position: relative; isolation: isolate; background: var(--c-art); overflow: hidden; }
.card-art img { position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); max-width: none; object-fit: cover; object-position: 50% 50%; }  /* 2px overscan, clipped by the panel, so no sliver of the panel color shows at the edges */  /* fills the panel, cropped evenly around the center */
.card-body { display: flex; flex-direction: column; gap: 12px; padding: 24px 24px 28px; flex: 1; }
.card-title { font-size: clamp(1.375rem, 1.2rem + 0.5vw, 1.625rem); }
.card-desc { font-size: 1rem; }

/* Horizontal cards: text left, artwork right.
   The artwork's shape sets the card's height, so long text can still grow the card instead of being cut off.
   Two 3:2 cards per row on wide screens; one wide row per card on tablets; stacked on phones. */
@media (min-width: 700px) {
  .card { flex-direction: row-reverse; }
  .card-body { padding: clamp(24px, 3vw, 48px); justify-content: center; }
  .card-desc { font-size: 0.9375rem; }
  .card-art { flex: 0 0 58%; aspect-ratio: 3 / 2; }                 /* wide row: card ≈ 21:8 */
  .card-title { font-size: clamp(1.5rem, 1.1rem + 1vw, 2rem); }
}
@media (min-width: 1280px) {
  /* card = 3:2: artwork takes 44% of the width, so its own shape is 0.44 × 3/2 ≈ 2:3 */
  .card-art { flex-basis: 44%; aspect-ratio: 2 / 3; }
  .card-body { padding: 28px 28px 28px 32px; gap: 10px; }
  .card-title { font-size: clamp(1.375rem, 1rem + 0.6vw, 1.625rem); }
}
@media (max-width: 699px) { .card-art { aspect-ratio: 3 / 2; } }
.card-title .name { display: block; color: var(--c-accent); }
.card-desc { color: var(--c-soft); }
.card-meta { margin-top: auto; padding-top: 8px; display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-small); color: var(--c-soft); }  /* name and role, then the date underneath */
.card-meta .role { color: var(--c-accent); font-weight: 600; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tools li { list-style: none; font-size: 0.8125rem; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-xs); border: 1px solid currentColor; color: var(--c-soft); }
.tools { margin: 0; padding: 0; }
.badge { position: absolute; top: 16px; right: 16px; z-index: 1; padding: 5px 10px; border-radius: var(--radius-xs); background: rgba(20, 20, 20, 0.8); color: #fff; font-size: var(--fs-small); font-weight: 600; }.card--kanpai { --c-bg: #141414; --c-ink: #fff; --c-soft: #C9C9C9; --c-accent: #FF0000; --c-art: #1d1d1d; }
.card--dochub { --c-accent: #32A4FA; --c-art: #2F93E0; }
.card--sony { --c-accent: #925158; --c-art: #B49AA0; }
.card--innout { --c-accent: #C6001D; --c-art: #F4E9E6; }

/* ---------- case study ---------- */
.cs { --page-on-accent: #fff; }
.cs-hero { padding: clamp(40px, 6vw, 88px) 0 clamp(32px, 5vw, 64px); }
.cs-hero .top { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px clamp(32px, 5vw, 72px); align-items: start; }  /* title sits top left */
.cs-hero h1 .name { display: block; color: var(--page-accent); }
.cs-hero .lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--page-soft); max-width: 40ch; }
.meta { margin: clamp(32px, 4vw, 48px) 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding-top: 24px; border-top: 1px solid var(--page-line); }
.meta dt { font-weight: 700; font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem); }   /* 18 → 24 */
.meta dd { margin: 6px 0 0; color: var(--page-soft); font-size: clamp(1rem, 0.95rem + 0.35vw, 1.25rem); line-height: 1.5; }   /* 16 → 20 */
.cs-hero-art { margin-top: clamp(32px, 5vw, 56px); display: flex; justify-content: center; align-items: flex-end; gap: clamp(16px, 4vw, 48px); }
@media (max-width: 760px) {
  .cs-hero .top { grid-template-columns: 1fr; }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.phase { padding: var(--section) 0 0; }
.phase.final { padding-bottom: 0; }
.phase > .wrap > h2 { padding-bottom: 20px; border-bottom: 1px solid var(--page-line); margin-bottom: clamp(32px, 4vw, 48px); }

.row { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 16px clamp(32px, 5vw, 72px); }
.row + .row, .row + .figs, .figs + .row, .figs + .figs, .row + .prose, .prose + .row, .figs + .prose, .prose + .figs, .split + .row, .row + .split { margin-top: clamp(40px, 5vw, 64px); }
.row h3 { font-size: var(--fs-h3); }
.row .body { max-width: 68ch; }
.prose { max-width: 68ch; margin-left: auto; margin-right: 0; }
@media (min-width: 761px) { .prose { width: calc(100% * 8 / 12 + 16px); } }
.body ul, .body ol, .prose ul { margin: 1em 0 0; padding-left: 1.25em; }
.body li + li { margin-top: 0.5em; }
.body p + ul, .body ul + p { margin-top: 1em; }
.body h4 { margin-top: 1.5em; }
.body strong, .prose strong { color: var(--page-ink); }
.body, .prose { color: var(--page-soft); }
@media (max-width: 760px) { .row { grid-template-columns: 1fr; } }

/* figures */
.figs { display: grid; gap: clamp(16px, 3vw, 32px); }
.figs--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figs--narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.figs figure { margin: 0; }
.figs img, .figs video { width: 100%; border-radius: var(--radius-sm); }
.figs figcaption { font-weight: 700; color: var(--page-ink); margin-bottom: 12px; font-size: var(--fs-h4); }
.figs .tall img, .figs .tall video { max-height: 640px; width: auto; margin: 0 auto; }
@media (max-width: 600px) { .figs--2 { grid-template-columns: 1fr; } .figs--keep { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* insight columns */
.sub { margin-top: clamp(40px, 5vw, 64px); margin-bottom: 20px; }
.insights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 8px; }
.insights section { background: var(--card-bg, rgba(255,255,255,0.04)); border: 1px solid var(--page-line); border-radius: var(--radius-md); padding: 24px; }
.insights h4 { font-size: var(--fs-h4); color: var(--page-ink); }
.insights ul { margin: 12px 0 0; padding-left: 1.1em; color: var(--page-soft); font-size: 1rem; }
.insights li + li { margin-top: 0.6em; }
@media (max-width: 860px) { .insights { grid-template-columns: 1fr; } }

/* reflection with portrait */
.split { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.split .portrait img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-md); }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } .split .portrait { max-width: 320px; } }

.final .cs-hero-art { margin-bottom: 32px; }
.cs-hero-art .proto { display: block; flex: none; line-height: 0; border-radius: var(--radius-sm); }   /* device mockups open the Figma prototypes */
.cs-hero-art .proto img { width: 100%; }
.center { text-align: center; }
.final .actions { display: flex; justify-content: center; }
.thanks { padding: var(--section) 0; text-align: center; }
.thanks p { margin-top: 12px; color: var(--page-soft); }
.thanks a { color: var(--page-accent); font-weight: 600; }

.more { padding: var(--section) 0; background: var(--paper); color: var(--ink); }
.more h2 { margin-bottom: 28px; }

/* Kanpai theme */
.theme-kanpai { --page-bg: #141414; --page-ink: #FFFFFF; --page-soft: #CFCFCF; --page-line: #3A3A3A; --page-accent: #FF0000; }
.theme-kanpai .btn--project { color: #fff; }

/* ---------- about ---------- */
.about { padding: clamp(40px, 6vw, 88px) 0 clamp(40px, 5vw, 64px); }  /* space under the button = space above it */
.about-top { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 32px clamp(32px, 5vw, 80px); align-items: center; }
.about h1 { margin-bottom: 24px; }
.about h1 .accent { color: var(--accent-ink); }
.about-text p { max-width: 64ch; color: var(--ink-soft); }
.hl { color: var(--accent-ink); font-weight: 600; }
a.hl { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a.hl:hover { text-decoration-thickness: 2px; }
.about-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-md); }
.gallery { margin-top: clamp(40px, 6vw, 80px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.5vw, 32px); }
.gallery > img, .clip video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-md); background: #E9ECEE; }
.clip { position: relative; }
.clip-ctrls { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; }
.clip-ctrls button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: rgba(20, 20, 20, 0.6); color: #fff; cursor: pointer; transition: background 0.2s ease; }
.clip-ctrls button:hover { background: rgba(20, 20, 20, 0.8); }
.clip-ctrls svg { width: 18px; height: 18px; fill: currentColor; }
.clip-play .i-pause, .clip.playing .clip-play .i-play, .clip-sound .i-sound, .clip.sound .clip-sound .i-muted { display: none; }
.clip.playing .clip-play .i-pause, .clip.sound .clip-sound .i-sound { display: block; }
.about .actions { margin-top: clamp(40px, 5vw, 64px); display: flex; justify-content: center; }
@media (max-width: 900px) { .gallery { grid-template-columns: 1fr; max-width: 640px; margin-left: auto; margin-right: auto; } }
@media (max-width: 760px) {
  .about-top { grid-template-columns: 1fr; }
  .about-photo { order: -1; max-width: 420px; justify-self: center; }
}

/* ---------- contact ---------- */
.contact { padding: clamp(40px, 6vw, 88px) 0 var(--section); }
.contact .wrap { max-width: calc(720px + var(--gutter) * 2); }
.contact-intro { text-align: center; }
.contact h1 { color: var(--accent-ink); }
.contact-intro p { margin-top: 16px; font-size: var(--fs-lead); line-height: 1.5; color: var(--ink-soft); }
.contact-intro .contact-direct { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: var(--fs-body); font-weight: 600; color: var(--ink); }
.contact-direct a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.contact-direct a:hover { color: var(--accent-ink); }
.contact-direct span { color: var(--line); }
.contact-form { margin-top: clamp(32px, 4vw, 48px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding: clamp(20px, 3vw, 36px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.contact-form .wide { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; font-size: var(--fs-small); font-weight: 600; }
.field .req { color: var(--accent-ink); margin-left: 2px; }
.field input, .field textarea { width: 100%; padding: 12px 14px; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid #CFCFCF; border-radius: var(--radius-sm); transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.field textarea { resize: vertical; min-height: 140px; }
.field input::placeholder, .field textarea::placeholder { color: #9A9A9A; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 3px rgba(121, 169, 188, 0.25); }
.field.invalid input, .field.invalid textarea { border-color: #C0392B; }
.field .err { margin-top: 6px; font-size: var(--fs-small); color: #B03A2E; }
.contact-form .submit { width: 100%; }
.contact-form .submit[disabled] { opacity: 0.6; cursor: progress; }
.form-status { margin-top: 12px; text-align: center; font-size: 1rem; }
.form-status:empty { display: none; }
.form-status.ok { color: var(--accent-ink); font-weight: 600; }
.form-status.bad { color: #B03A2E; }
.form-status a { color: inherit; }
@media (max-width: 560px) { .contact-form { grid-template-columns: 1fr; } }

/* ---------- motion ---------- */
/* Hover uses `scale`, appear uses `translate` + opacity, so the two never fight. */
a.card, .hero-photo, .cs-hero-art img, .btn, .about-photo, .gallery > img, .clip video {
  transition: scale 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.3s ease;
}
@media (hover: hover) {
  a.card:hover, .hero-photo:hover, .cs-hero-art img:hover, .btn:hover, .about-photo:hover, .gallery > img:hover, .clip:hover video { scale: 1.015; }
  a.card:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); }
}

/* page title: left-to-right wipe, as on the original site */
@keyframes wipe-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
main h1 { animation: wipe-in 0.9s cubic-bezier(0.65, 0, 0.35, 1) both; }
/* homepage title: letters ripple up one after another when the mouse passes over it (letters are split by site.js) */
.hero h1 { animation-fill-mode: backwards; }   /* drop the wipe's clip once it ends, so lifted letters aren't cut off */
.hero h1 .w { display: inline-block; white-space: nowrap; }
.hero h1 .ch { display: inline-block; }
.hero h1.wave .ch { animation: letter-wave 0.6s cubic-bezier(0.3, 0, 0.3, 1) var(--d) both; }
@keyframes letter-wave { 0%, 100% { translate: 0 0; } 35% { translate: 0 -0.16em; } 70% { translate: 0 0.02em; } }

/* appear on scroll: hidden from first paint (the head script adds .motion), shown when the script adds .in */
.motion :is(.hero .role, .hero-photo, .work .card, .cs-hero .lead, .meta > div, .cs-hero-art img, .phase > .wrap > h2:not(.sr-only), .row, .figs figure, .insights section, .sub, .prose, .split > *, .final .actions, .thanks .wrap > *, .more h2, .more .card, .about-text p, .about-photo, .gallery > *, .about .actions, .contact-intro p, .contact-form, .contact-form > *) {
  opacity: 0; translate: 0 12px;
  transition: opacity 0.7s ease, translate 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
              scale 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.3s ease;
}
.motion :is(.hero .role, .hero-photo, .work .card, .cs-hero .lead, .meta > div, .cs-hero-art img, .phase > .wrap > h2:not(.sr-only), .row, .figs figure, .insights section, .sub, .prose, .split > *, .final .actions, .thanks .wrap > *, .more h2, .more .card, .about-text p, .about-photo, .gallery > *, .about .actions, .contact-intro p, .contact-form, .contact-form > *).in { opacity: 1; translate: 0 0; }

/* homepage intro: a beat of blank page, then name, title, photo and cards in order (first visit only) */
html:not(.intro-seen) :is(.home-intro, .about-intro, .contact-page-intro, .cs) main h1 { animation-delay: 0.6s; }  /* About and Contact get the same first-visit intro */
@media (max-width: 760px) { html:not(.intro-seen) :is(.home-intro, .about-intro) main h1 { animation-delay: 1s; } }  /* phones: the photo sits on top, so it comes in first */

/* hero typing line: blinking caret in the accent color; solid while typing */
.typer { position: relative; display: inline-block; white-space: nowrap; }  /* centered on phones, left-aligned on desktop, like the rest of the hero */
.caret { display: none; }
.motion .caret { display: block; position: absolute; left: calc(100% + 1px); top: 50%; translate: 0 -50%; width: 2px; height: 1em; background: currentColor; animation: caret-blink 1s steps(1) infinite; }  /* outside the text's width, so centering is exact */
.motion .caret.busy { animation: none; opacity: 1; }
@keyframes caret-blink { 50% { opacity: 0; } }

/* glowing cursor (drawn by site.js on mouse/trackpad devices; system cursor hidden once it appears) */
body { --cursor-glow: #79A9BC; }
.theme-kanpai { --cursor-glow: #FF0000; }
.cursor-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 2147483647; }
html.cursor-on, html.cursor-on * { cursor: none !important; }

/* smooth scroll (Lenis) */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth iframe { pointer-events: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- About: click a photo to enlarge it with its caption ---------- */
[data-zoom] { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  padding: clamp(16px, 4vw, 56px); background: rgba(10, 10, 12, 0.72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; transition: opacity 0.18s ease; cursor: zoom-out;
}
.lightbox.open { opacity: 1; }
.lightbox-media { max-width: min(1100px, 100%); max-height: 100%; min-height: 0; border-radius: var(--radius-md); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); object-fit: contain; background: #111; cursor: default; }
.lightbox-cap { max-width: 640px; margin: 0; color: #fff; text-align: center; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem); line-height: 1.5; }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.lightbox-close:hover { background: rgba(255, 255, 255, 0.26); }
@media (prefers-reduced-motion: reduce) { .lightbox { transition: none; } }

/* ---------- lamp pull chain: dark mode switch ---------- */
.lamp { position: fixed; top: calc(var(--header-h) - 34px); left: clamp(12px, 2vw, 28px); z-index: 40; --chain: #9AA3A9; --tuck: 34px; clip-path: inset(var(--tuck) -60px -600px -60px); }  /* sits under the sticky header (z 50), so the chain appears to hang out from beneath it */
.lamp-pull {
  display: flex; flex-direction: column; align-items: center; width: 28px; padding: 0 0 4px; margin: 0 -8px;
  border: 0; background: none; cursor: pointer; touch-action: none; -webkit-tap-highlight-color: transparent;
  transform-origin: 50% 0;
}
.lamp-chain { display: block; width: 6px; height: 170px; background: radial-gradient(circle at center, var(--chain) 1.8px, transparent 2.3px) center top / 6px 6px repeat-y; }
.lamp-handle { position: relative; display: block; width: 12px; height: 26px; margin-top: -1px; border-radius: 6px 6px 7px 7px; background: linear-gradient(90deg, var(--accent-ink), var(--accent) 55%, var(--accent-ink)); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); transition: scale 0.2s ease; }
.lamp-handle::before { content: ""; position: absolute; left: 50%; top: -3px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--chain); }
@media (hover: hover) { .lamp-pull:hover .lamp-handle { scale: 1.12; } }
.lamp-pull:focus-visible { outline-offset: 0; }
.theme-kanpai .lamp { display: none; }   /* the Kanpai page has its own dark look */
@media print { .lamp { display: none; } }

/* ---------- dark mode ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121315; --surface: #1B1D20; --ink: #ECEDEE; --ink-soft: #B3B8BD; --line: #2E3236;
  --accent-ink: #79A9BC;
}
html[data-theme="dark"] .lamp { --chain: #C4CACF; }
html[data-theme="dark"] .site-header { --hdr-bg: rgba(18, 19, 21, 0.9); --hdr-hover: #23262A; }
html[data-theme="dark"] .theme-kanpai .site-header { --hdr-bg: rgba(20, 20, 20, 0.9); --hdr-hover: #262626; }
html[data-theme="dark"] .btn { color: #101214; }
html[data-theme="dark"] .btn:hover { background: #A9D0DF; }
html[data-theme="dark"] .btn--project { color: #101214; }
html[data-theme="dark"] .theme-kanpai .btn--project { color: #fff; }
html[data-theme="dark"] .card:not(.card--kanpai) { --c-bg: #1B1D20; --c-ink: var(--ink); --c-soft: var(--ink-soft); }
html[data-theme="dark"] .card { border-color: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .card--dochub { --c-accent: #32A4FA; }
html[data-theme="dark"] .card--sony { --c-accent: #C97C86; }
html[data-theme="dark"] .card--innout { --c-accent: #F0556B; }
html[data-theme="dark"] .gallery > img, html[data-theme="dark"] .clip video { background: #24272B; }
html[data-theme="dark"] .field input, html[data-theme="dark"] .field textarea { border-color: #3C4146; }
html[data-theme="dark"] .field input::placeholder, html[data-theme="dark"] .field textarea::placeholder { color: #7D848A; }
html[data-theme="dark"] .field input:focus, html[data-theme="dark"] .field textarea:focus { box-shadow: 0 0 0 3px rgba(121, 169, 188, 0.28); }
html[data-theme="dark"] .form-status.bad, html[data-theme="dark"] .field .err { color: #FF8A7A; }
html[data-theme="dark"] .field.invalid input, html[data-theme="dark"] .field.invalid textarea { border-color: #FF8A7A; }
html[data-theme="dark"] a.card:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
html.theme-fading, html.theme-fading *, html.theme-fading *::before, html.theme-fading *::after { transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, fill 0.35s ease !important; }

/* ---------- home photo: flips to the dark-mode picture ---------- */
.hero-photo-link .flip { display: block; position: relative; width: clamp(180px, 25vw, 360px); aspect-ratio: 1; transform-style: preserve-3d; transform: perspective(1200px) rotateY(var(--flip, 0deg)); transition: transform 0.85s cubic-bezier(0.45, 0.05, 0.2, 1); }
.hero-photo-link .flip .hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.hero-photo-link .flip .photo-dark { transform: rotateY(180deg); }
html[data-theme="dark"] .hero-photo-link .flip { --flip: 180deg; }
html.theme-fading .hero-photo-link .flip { transition: transform 0.85s cubic-bezier(0.45, 0.05, 0.2, 1) !important; }
@media (prefers-reduced-motion: reduce) { .hero-photo-link .flip, html.theme-fading .hero-photo-link .flip { transition: none !important; } }
@media (max-width: 760px) { .hero-photo-link .flip { width: 224px; } }

/* ---------- DocHub case study ---------- */
.theme-dochub { --page-accent: #32A4FA; }
html[data-theme="dark"] .theme-dochub { --page-accent: #32A4FA; }
.gal { display: grid; gap: clamp(10px, 1.6vw, 20px); }
.gal--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gal--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gal--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gal figure img { border: 1px solid var(--page-line); background: #fff; transition: scale 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); }
.gal--hero { margin-top: clamp(32px, 5vw, 56px); }
@media (hover: hover) { .gal figure img[data-zoom]:hover { scale: 1.02; } }
@media (max-width: 900px) { .gal--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .gal--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .gal--5, .gal--3:not(.gal--hero) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.insights--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .insights--2 { grid-template-columns: 1fr; } }
.insights--2 h4 { font-size: var(--fs-h3); }
.insights h5 { margin: 24px 0 0; font-size: 1rem; font-weight: 700; color: var(--page-ink); }
.insights h5 + ul { margin-top: 8px; }
.insights--2 section { padding: clamp(20px, 2.4vw, 32px); }
.lightbox-media { max-width: min(1400px, 100%); }
.lightbox-cap:empty { display: none; }

/* ---------- lamp: wooden pull-chain knob with a gold cap, glinting metal, and a shorter chain tucked into the page edge on smaller screens ---------- */
.lamp-chain { background: radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.95) 0 0.55px, rgba(255, 255, 255, 0) 0.95px) center top / 6px 6px repeat-y, radial-gradient(circle at center, var(--chain) 1.8px, transparent 2.3px) center top / 6px 6px repeat-y; }
.lamp-handle { width: 12px; height: 24px; border-radius: 6px 6px 9px 9px / 6px 6px 12px 12px; background: repeating-linear-gradient(95deg, rgba(70, 38, 14, 0.28) 0 1px, rgba(70, 38, 14, 0) 1px 3px), radial-gradient(ellipse at 35% 28%, #E2B882 0, #BE8A55 34%, #8F5E33 66%, #5C3719 100%); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 -2px 3px rgba(40, 20, 5, 0.4); }
/* the gold cap joining chain and knob: a little brass cylinder with a bright glare band */
.lamp-handle::before { width: 8px; height: 8px; margin-left: -4px; top: -6px; border-radius: 2px 2px 3px 3px; background: linear-gradient(90deg, #7A5410 0%, #D9AC3C 18%, #FFF6C9 34%, #F2CE5E 50%, #B98A22 76%, #6E4A0C 100%); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 -1px 1px rgba(80, 50, 0, 0.45); }
.lamp-handle::after { content: ""; position: absolute; left: 50%; top: -5px; width: 5px; height: 1.5px; margin-left: -2.5px; border-radius: 1px; background: rgba(255, 255, 255, 0.85); }
@media (max-width: 1100px) {
  .lamp { left: 8px; top: calc(var(--header-h) - 30px); --tuck: 30px; }
  .lamp-chain { height: 84px; }
  .lamp-handle { width: 10px; height: 20px; border-radius: 5px 5px 8px 8px / 5px 5px 10px 10px; }
  .lamp-handle::before { width: 7px; height: 7px; margin-left: -3.5px; top: -5px; }
  .lamp-handle::after { width: 4px; margin-left: -2px; top: -4px; }
}
/* DocHub: the Prototype A vs B summary spans the full content width, margin to margin */
.prose.prose--center { width: 100%; max-width: none; margin-left: 0; margin-right: 0; }
/* case studies: the intro text and each section's text sit flush against the right margin (wider gap after the headings) */
@media (min-width: 761px) {
  .cs-hero .lead { justify-self: end; }
  .row .body { width: 100%; justify-self: end; }
}

/* ---------- dark mode: snoring z's rise from the notebook over his face, drifting up and to the left across the photo ---------- */
.hero-photo-link { position: relative; }
.zzz { display: block; opacity: 0; visibility: hidden; transition: opacity 0.35s ease, visibility 0s linear 0.35s; position: absolute; left: 9%; top: 32%; width: 1px; height: 1px; z-index: 3; pointer-events: none; }
html[data-theme="dark"] .zzz { opacity: 1; visibility: visible; transition: opacity 0.35s ease 0.5s, visibility 0s; }
.zzz i { position: absolute; left: 0; top: 0; font-style: normal; font-weight: 800; line-height: 1; color: var(--accent-ink); opacity: 0; text-shadow: 0 0 10px rgba(121, 169, 188, 0.55), 0 1px 3px rgba(0, 0, 0, 0.5); -webkit-animation: snore 4.4s ease-in-out infinite backwards; animation: snore 4.4s ease-in-out infinite backwards; will-change: transform, opacity; animation-delay: calc(var(--d, 1s) + var(--zd, 0.6s)); }
.zzz i:nth-child(1) { --d: 1s; font-size: 1.9rem; margin-left: 0; }
.zzz i:nth-child(2) { --d: 2.2s; font-size: 2.5rem; margin-left: -32px; margin-top: -40px; }
.zzz i:nth-child(3) { --d: 3.4s; font-size: 3.2rem; margin-left: -66px; margin-top: -86px; }
/* first visit: the photo is still revealing, so the z's wait for it */
html:not(.intro-seen):not(.intro-seen-before) .zzz { --zd: 2.4s; }
@keyframes snore { 0% { opacity: 0; transform: translate3d(0, 4px, 0) scale(0.6) rotate(6deg); } 20% { opacity: 0.95; } 75% { opacity: 0.85; } 100% { opacity: 0; transform: translate3d(-8px, -14px, 0) scale(1.05) rotate(-10deg); } }
@-webkit-keyframes snore { 0% { opacity: 0; -webkit-transform: translate3d(0, 4px, 0) scale(0.6) rotate(6deg); } 20% { opacity: 0.95; } 75% { opacity: 0.85; } 100% { opacity: 0; -webkit-transform: translate3d(-8px, -14px, 0) scale(1.05) rotate(-10deg); } }
@media (max-width: 760px) {   /* phones: a smaller photo and the sticky header above it, so the z's stay a bit tighter */
  .zzz i:nth-child(1) { font-size: 1.6rem; }
  .zzz i:nth-child(2) { font-size: 2.1rem; margin-left: -28px; margin-top: -38px; }
  .zzz i:nth-child(3) { font-size: 2.6rem; margin-left: -54px; margin-top: -76px; }
}
@media (prefers-reduced-motion: reduce) { .zzz i { animation: none; opacity: 0.85; } }

/* ---------- Kanpai page: the chain snaps off when pulled and lies on top of the footer (reload resets it) ---------- */
.theme-kanpai .lamp { display: block; }
.site-footer { position: relative; }
.lamp-fall { pointer-events: none; }
.lamp-rest { position: absolute; z-index: 2; rotate: -92deg; pointer-events: none; --chain: #9AA3A9; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45)); }
html[data-theme="dark"] .lamp-rest { --chain: #C4CACF; }
.lamp-rest .lamp-pull { pointer-events: none; cursor: default; }

/* the fallen chain: the same metal beads, laid in a loose S */
.lamp-rest .lamp-chain { background: none; width: 100%; }
.lamp-rest .lamp-chain svg { display: block; overflow: visible; }

/* Kanpai page: the "more projects" section and the footer always keep Kanpai's dark look, whatever mode the site was in */
.theme-kanpai .more, .theme-kanpai .site-footer { --paper: #141414; --surface: #141414; --ink: #FFFFFF; --ink-soft: #CFCFCF; --line: #3A3A3A; --accent-ink: #79A9BC; color-scheme: dark; }
.theme-kanpai .more .card:not(.card--kanpai) { --c-bg: #1B1B1B; --c-ink: #FFFFFF; --c-soft: #CFCFCF; border-color: rgba(255, 255, 255, 0.08); }
.theme-kanpai .more .card--dochub { --c-accent: #32A4FA; }
.theme-kanpai .more .card--sony { --c-accent: #C97C86; }
.theme-kanpai .more .card--innout { --c-accent: #F0556B; }
.theme-kanpai .more a.card:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }

/* dark mode: the footer uses the same background as the header */
html[data-theme="dark"] .site-footer { background: var(--paper); }
.theme-kanpai .site-footer { border-top-color: #2E2E2E; }   /* matches the Kanpai header's line */
/* ---------- 404 page ---------- */
.notfound { padding: clamp(56px, 10vw, 140px) 0 var(--section); text-align: center; }
.notfound .wrap { max-width: 720px; }
.nf-code { margin: 0; font-size: clamp(5.5rem, 22vw, 11rem); font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--accent-ink); }
.notfound h1 { margin: 8px 0 0; }
.nf-lead { margin: 16px auto 0; max-width: 52ch; color: var(--ink-soft); }
.nf-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--ghost:hover { background: var(--surface); }
html[data-theme="dark"] .btn--ghost { color: var(--ink); }
.nf-links { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 8px; }
.nf-links a { color: var(--accent-ink); text-underline-offset: 3px; }

/* hamburger -> close icon */
.menu-btn svg path { transform-box: fill-box; transform-origin: center; transition: transform 0.3s cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.2s ease; }
.menu-btn[aria-expanded="true"] .l1 { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .l2 { opacity: 0; transform: scaleX(0.2); }
.menu-btn[aria-expanded="true"] .l3 { transform: translateY(-6px) rotate(-45deg); }
@media (prefers-reduced-motion: reduce) { .menu-btn svg path, .mobile-nav, .mobile-nav li { transition: none !important; } }

/* ---------- project cards: hover the artwork and it grows over the whole card ----------
   Only on devices with a real hover. The artwork is lifted out of the layout and anchored to the right edge, so
   widening it never reflows the text underneath; it simply slides over it. site.js sets data-zone="art" while the
   pointer is over the artwork's resting area. */
@media (min-width: 700px) and (hover: hover) {
  .card { aspect-ratio: 21 / 8; }
  .card-art { position: absolute; inset: 0 0 0 auto; width: 58%; flex: none; aspect-ratio: auto; transition: width 0.7s cubic-bezier(0.25, 0.8, 0.25, 1); will-change: width; }
  .card-body { margin-right: 58%; }
  .card[data-zone="art"] .card-art { width: 100%; }
}
@media (min-width: 1280px) and (hover: hover) {
  .card { aspect-ratio: 3 / 2; }
  .card-art { width: 44%; }
  .card-body { margin-right: 44%; }
  .card[data-zone="art"] .card-art { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .card-art { transition: none !important; } }
