/* =============================================================
   Portfolio — Cohere-inspired design system
   Tokens sourced from DESIGN-cohere.md
   Display: Space Grotesk (CohereText fallback)
   Body/UI: Inter (Unica77 Cohere Web fallback)
   Mono:    Space Mono (CohereMono fallback)
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500&family=Inter:wght@400;500;600&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* color */
  --primary: #17171c;
  --black: #000000;
  --ink: #212121;
  --deep-green: #003c33;
  --dark-navy: #071829;
  --canvas: #ffffff;
  --soft-stone: #eeece7;
  --pale-green: #edfce9;
  --pale-blue: #f1f5ff;
  --hairline: #d9d9dd;
  --border-light: #e5e7eb;
  --card-border: #f2f2f2;
  --muted: #93939f;
  --slate: #75758a;
  --body-muted: #616161;
  --action-blue: #1863dc;
  --focus-blue: #4c6ee6;
  --coral: #ff7759;
  --coral-soft: #ffad9b;
  --on-dark: #ffffff;

  /* type */
  --font-display: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', Arial, ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* radius */
  --r-xs: 4px;  --r-sm: 8px;  --r-md: 16px;
  --r-lg: 22px; --r-xl: 30px; --r-pill: 32px; --r-full: 9999px;

  /* spacing */
  --s-xs: 6px; --s-sm: 8px; --s-md: 12px; --s-lg: 16px;
  --s-xl: 24px; --s-xxl: 32px; --s-section: 80px;

  --container: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--coral-soft); color: var(--primary); }

:focus-visible {
  outline: 2px solid var(--focus-blue);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.section { padding: var(--s-section) 0; }
.section--tight { padding: 48px 0; }

/* ---------- type ---------- */
.mono-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}
.display {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}
h1.display { font-size: clamp(44px, 8vw, 96px); }
h2.display { font-size: clamp(34px, 5vw, 60px); letter-spacing: -0.02em; }
.section-heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
.card-heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}
.lead { font-size: clamp(17px, 2vw, 20px); line-height: 1.45; color: var(--body-muted); }
.muted { color: var(--muted); }
p { margin: 0 0 1em; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-weight: 500; font-size: 15px;
  cursor: pointer; border: 0; transition: transform .15s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--primary); color: var(--on-dark);
  border-radius: var(--r-pill); padding: 13px 26px;
}
.btn--primary:hover { background: #2a2a33; }
.btn--on-dark { background: var(--canvas); color: var(--primary); }
.btn--on-dark:hover { background: #ececec; }
.btn--ghost {
  background: transparent; color: var(--ink);
  border-bottom: 1px solid var(--ink); border-radius: 0; padding: 6px 0;
}
.btn--ghost:hover { color: var(--action-blue); border-color: var(--action-blue); }
.btn--outline {
  background: transparent; color: var(--primary);
  border: 1px solid var(--primary); border-radius: var(--r-xl); padding: 9px 18px;
  font-family: var(--font-body); font-weight: 500;
}
.btn--outline:hover { background: var(--primary); color: var(--on-dark); }

/* ---------- announcement bar ---------- */
.announce {
  background: var(--black); color: var(--on-dark);
  font-size: 13px; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 36px; padding: 6px 16px;
}
.announce a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--card-border);
}
.nav__inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  min-height: 64px;
}
.nav__logo {
  font-family: var(--font-display); font-size: 20px; letter-spacing: -0.02em;
  display: inline-flex; align-items: center; gap: 9px;
}
.nav__logo .dot { width: 12px; height: 12px; border-radius: var(--r-full); background: var(--coral); display: inline-block; }
.nav__menu { display: flex; gap: 28px; justify-content: center; list-style: none; margin: 0; padding: 0; }
.nav__menu a { font-size: 15px; color: var(--ink); }
.nav__menu a:hover { color: var(--action-blue); }
.nav__right { display: flex; gap: 16px; align-items: center; justify-content: flex-end; }
.nav__toggle { display: none; background: none; border: 0; cursor: pointer; font-size: 24px; line-height: 1; padding: 6px; }

/* ---------- hero ---------- */
.hero { padding: clamp(56px, 9vw, 110px) 0 clamp(40px, 6vw, 72px); }
.hero__label { margin-bottom: 22px; }
.hero h1 { max-width: 16ch; }
.hero__accent { color: var(--coral); }
.hero__sub { max-width: 56ch; margin: 26px 0 32px; }
.hero__actions { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }

/* ---------- work grid ---------- */
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.work-card {
  display: block; border-radius: var(--r-lg); overflow: hidden;
  background: var(--canvas); border: 1px solid var(--card-border);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.work-card:hover { transform: translateY(-4px); border-color: var(--hairline); }
.work-card__media {
  aspect-ratio: 4 / 3; overflow: hidden; background: var(--soft-stone);
}
.work-card__media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .5s ease; }
.work-card:hover .work-card__media img { transform: scale(1.03); }
.work-card__body { padding: 22px 24px 26px; }
.work-card__tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--slate); border: 1px solid var(--hairline); border-radius: var(--r-full); padding: 3px 10px;
}
.work-card__title { margin-bottom: 6px; }
.work-card__desc { color: var(--body-muted); font-size: 15px; margin: 0; }
.work-card__arrow { margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 15px; }
.work-card:hover .work-card__arrow { color: var(--action-blue); }

/* ---------- section header ---------- */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 44px; flex-wrap: wrap; }
.sec-head__text { max-width: 60ch; }
.sec-head .lead { margin: 14px 0 0; }

/* ---------- dark band ---------- */
.band { background: var(--deep-green); color: var(--on-dark); border-radius: var(--r-lg); padding: clamp(40px, 6vw, 80px); }
.band--navy { background: var(--dark-navy); }
.band--primary { background: var(--primary); }
.band .muted, .band .lead { color: rgba(255,255,255,.72); }
.band .mono-label { color: var(--coral-soft); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 40px; }
.stat__num { font-family: var(--font-display); font-size: clamp(30px, 4vw, 48px); line-height: 1; }
.stat__lab { color: var(--body-muted); font-size: 14px; margin-top: 8px; }
.band .stat__lab { color: rgba(255,255,255,.7); }

/* ---------- about / skills ---------- */
.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; align-items: start; }
.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-list li { padding: 16px 0; border-bottom: 1px solid var(--hairline); display: flex; justify-content: space-between; gap: 16px; }
.skill-list li:first-child { border-top: 1px solid var(--hairline); }
.skill-list .role { color: var(--body-muted); font-size: 14px; text-align: right; }
.logo-strip { display: flex; flex-wrap: wrap; gap: 36px 48px; align-items: center; }
.logo-strip span { font-family: var(--font-display); font-size: 22px; color: var(--slate); letter-spacing: -0.01em; }

/* ---------- experience ---------- */
.exp-list { list-style: none; margin: 0; padding: 0; }
.exp { list-style: none; }
.exp::marker { content: ""; }
.exp {
  display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 32px; align-items: start;
  padding: 28px 0; border-top: 1px solid var(--hairline);
}
.exp:last-child { border-bottom: 1px solid var(--hairline); }
.exp__role h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -0.01em; }
.exp__type { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--coral); margin-left: 6px; vertical-align: middle; }
.exp__co { color: var(--slate); font-size: 14px; margin: 0; }
.exp__desc { color: var(--body-muted); font-size: 15px; margin: 0; }
.exp__date { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; margin: 0; text-align: right; }
@media (max-width: 780px) {
  .exp { grid-template-columns: 1fr; gap: 10px; }
  .exp__date { text-align: left; }
}

/* ---------- contact ---------- */
.contact-cta { text-align: center; }
.contact-cta h2 { margin-bottom: 18px; }
.contact-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }

/* ---------- footer ---------- */
.footer { background: var(--primary); color: var(--on-dark); padding: 64px 0 40px; }
.footer__top { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; padding-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,.12); }
.footer__brand { font-family: var(--font-display); font-size: 26px; max-width: 18ch; line-height: 1.1; }
.footer__links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer__links a { color: rgba(255,255,255,.75); font-size: 15px; }
.footer__links a:hover { color: #fff; }
.footer__bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 28px; color: rgba(255,255,255,.5); font-size: 13px; }

/* ---------- case page ---------- */
.case-hero { padding: clamp(48px, 7vw, 90px) 0 40px; }
.case-hero .mono-label { margin-bottom: 18px; }
.case-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--hairline); }
.case-meta dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate); margin-bottom: 6px; }
.case-meta dd { margin: 0; font-size: 15px; }
.case-overview { display: grid; grid-template-columns: 1fr 1.3fr; gap: 56px; }
.case-shots { display: grid; gap: 28px; }
.shot { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--card-border); background: var(--soft-stone); }
.shot img { width: 100%; height: auto; }
.shot--scroll { max-height: 720px; overflow: hidden; position: relative; }
.shot--scroll::after { content: ""; position: absolute; inset: auto 0 0 0; height: 90px; background: linear-gradient(to bottom, transparent, rgba(255,255,255,.9)); }
.shot__cap { font-size: 13px; color: var(--muted); padding: 10px 4px 0; }
.gallery-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; align-items: start; }
.booklet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; align-items: start; }
.shot-small { max-width: 460px; }
.shot-small .shot { background: var(--soft-stone); }
.booklet-grid .shot { background: var(--soft-stone); }
/* section divider inside a case page */
.case-subhead { margin: 0 0 28px; padding-top: 8px; }
.case-subhead .mono-label { display: block; }
.case-subhead h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(24px, 3vw, 36px); line-height: 1.15; letter-spacing: -0.01em; margin: 10px 0 0; }
.case-subhead p { color: var(--body-muted); margin: 12px 0 0; max-width: 60ch; }
.case-divider { border: 0; border-top: 1px solid var(--hairline); margin: 64px 0 44px; }
.banner-grid .shot { background: var(--soft-stone); }
/* phone gallery — narrow mobile screenshots shown at device-like scale */
.phone-panel { background: var(--soft-stone); border-radius: var(--r-lg); padding: clamp(28px, 4vw, 48px); margin-top: 8px; }
.phone-row { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; align-items: flex-start; }
.phone {
  width: 240px; max-width: 60vw; border-radius: 26px; overflow: hidden;
  background: #fff; border: 6px solid #111; box-shadow: 0 18px 40px rgba(0,0,0,.14);
}
.phone img { width: 100%; height: auto; display: block; }
.phone--scroll { height: 460px; overflow: hidden; position: relative; }
.phone--scroll::after { content: ""; position: absolute; inset: auto 0 0 0; height: 70px; background: linear-gradient(transparent, #fff); }
/* auto-scrolling phone — slowly pans the full-length screenshot on a loop */
.phone--auto { height: 460px; overflow: hidden; position: relative; }
.phone--auto img { animation: phone-scroll 26s cubic-bezier(.45,0,.55,1) infinite alternate; will-change: transform; }
.phone--auto:hover img { animation-play-state: paused; }
@keyframes phone-scroll {
  0%, 6%   { transform: translateY(0); }
  94%, 100%{ transform: translateY(calc(-100% + 448px)); }
}
@media (prefers-reduced-motion: reduce) {
  .phone--auto img { animation: none; }
  .phone--auto::after { content: ""; position: absolute; inset: auto 0 0 0; height: 70px; background: linear-gradient(transparent, #fff); }
}

/* tablet frame (iPad App Store slides) */
.tablet {
  width: 480px; max-width: 92vw; border-radius: 18px; overflow: hidden;
  background: #fff; border: 8px solid #111; box-shadow: 0 18px 40px rgba(0,0,0,.14);
}
.tablet img { width: 100%; height: auto; display: block; }
.device-row { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; align-items: flex-start; }
.device-row + .device-row { margin-top: 28px; }

/* store badge buttons */
.store-buttons { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 30px; }
.store-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--primary); border-radius: var(--r-pill);
  padding: 10px 20px; font-weight: 500; font-size: 14px; color: var(--primary);
  transition: background .2s ease, color .2s ease;
}
.store-btn:hover { background: var(--primary); color: var(--on-dark); }
.store-btn .mono-label { font-size: 11px; color: inherit; }

/* live HTML email preview — desktop + mobile side by side */
.email-showcase { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; justify-content: center; }
.email-col { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.email-frame {
  width: 660px; max-width: 92vw; background: #fff;
  border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,.08);
}
.email-frame iframe { width: 100%; border: 0; display: block; height: 900px; }
/* mobile: fixed phone size, email scrolls INSIDE (not full-length) */
.email-phone {
  width: 320px; max-width: 82vw; height: 650px; background: #fff;
  border: 10px solid #111; border-radius: 34px; overflow: hidden;
  box-shadow: 0 18px 40px rgba(0,0,0,.14);
}
.email-phone iframe { width: 100%; height: 100%; border: 0; display: block; }

/* live HTML5 banner stages */
.live-row { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.banner-stage { display: flex; flex-direction: column; gap: 10px; }
.banner-stage__frame {
  background: #fff; border: 1px solid var(--hairline); border-radius: var(--r-sm);
  overflow: hidden; line-height: 0; max-width: 100%;
}
.banner-stage iframe { border: 0; display: block; }
.banner-stage--wide { width: 100%; overflow-x: auto; }
.banner-stage__cap { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--slate); }
.live-note { color: var(--body-muted); font-size: 14px; margin: 0 0 26px; }

.case-nav { display: flex; justify-content: space-between; gap: 16px; padding: 40px 0; border-top: 1px solid var(--hairline); }
.back-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.back-link:hover { color: var(--action-blue); }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .nav__menu, .nav__right { display: none; }
  .nav__inner { grid-template-columns: 1fr auto; }
  .nav__toggle { display: block; }
  .nav.open .nav__menu {
    display: flex; flex-direction: column; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--canvas); border-bottom: 1px solid var(--card-border); padding: 18px 24px; gap: 18px;
  }
  .nav.open .nav__right { display: flex; position: absolute; top: 100%; right: 24px; margin-top: 132px; }
  .split, .case-overview { grid-template-columns: 1fr; gap: 32px; }
  .stats, .case-meta { grid-template-columns: repeat(2, 1fr); }
  .gallery-2 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .work-grid { grid-template-columns: 1fr; }
  .footer__top { flex-direction: column; }
}
