:root {
  --bg: #EBE6DB;          /* warm ivory */
  --bg-deep: #E3DDD0;
  --ink: #1A1714;         /* near-black */
  --ink-soft: #6B655B;    /* muted warm grey */
  --line: rgba(26, 23, 20, 0.14);
  --accent: #C24A24;      /* ember / terracotta */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
  cursor: none;
}
a { color: inherit; text-decoration: none; }
em { font-style: italic; }
::selection { background: var(--accent); color: var(--bg); }

/* ---------- WebGL backdrop + grain ---------- */
#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.04; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .nav, .footer { position: relative; z-index: 2; }

/* ---------- Cursor ---------- */
.cursor {
  position: fixed; top: 0; left: 0; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%); transition: width .35s var(--ease), height .35s var(--ease), background .35s, opacity .3s;
}
.cursor.grow { width: 56px; height: 56px; background: rgba(194, 74, 36, 0.16); }
@media (hover: none) { .cursor { display: none; } body { cursor: auto; } }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 10000; background: var(--bg);
  display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(24px, 5vw, 60px);
}
.loader-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.loader-word { font-family: var(--serif); font-size: clamp(28px, 6vw, 56px); font-weight: 400; letter-spacing: -.02em; }
.loader-pct { font-family: var(--serif); font-size: clamp(28px, 6vw, 56px); color: var(--accent); }
.loader-line { height: 1px; background: var(--line); position: relative; }
.loader-line span { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: var(--ink); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px clamp(20px, 5vw, 60px);
  transition: padding .5s var(--ease);
}
.nav.scrolled { padding: 16px clamp(20px, 5vw, 60px); background: rgba(235, 230, 219, 0.72); backdrop-filter: blur(12px); }
.wordmark { font-family: var(--serif); font-size: 22px; font-weight: 400; letter-spacing: -.01em; }
.wordmark em { color: var(--accent); }
.nav-links { display: flex; gap: 34px; align-items: center; }
.nav-links a { font-size: 15px; color: var(--ink-soft); position: relative; transition: color .3s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 1px; background: var(--accent); transition: width .4s var(--ease); }
.nav-links a:hover::after { width: 100%; }
.nav-contact { color: var(--ink) !important; }
.burger { display: none; flex-direction: column; gap: 6px; background: none; border: 0; cursor: pointer; }
.burger span { width: 26px; height: 1.5px; background: var(--ink); transition: .35s var(--ease); }
.burger.open span:nth-child(1) { transform: translateY(3.75px) rotate(45deg); }
.burger.open span:nth-child(2) { transform: translateY(-3.75px) rotate(-45deg); }
.mobile-menu {
  position: fixed; inset: 0; z-index: 99; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  transform: translateY(-100%); transition: transform .6s var(--ease);
}
.mobile-menu.open { transform: translateY(0); }
.mobile-menu a { font-family: var(--serif); font-size: 38px; }

/* ---------- Shared ---------- */
.eyebrow {
  display: inline-block; font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 500; margin-bottom: 24px;
}
.link-arrow { display: inline-flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 500; padding-bottom: 3px; border-bottom: 1px solid var(--line); transition: border-color .4s, gap .4s var(--ease); }
.link-arrow svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.6; transition: transform .4s var(--ease); }
.link-arrow:hover { border-color: var(--ink); gap: 14px; }
.link-arrow:hover svg { transform: translate(2px, -2px); }

/* line-mask reveal */
.ln { display: block; overflow: hidden; }
.ln > span { display: block; }

/* ---------- Hero ---------- */
.hero { min-height: 100vh; padding: 0 clamp(20px, 5vw, 60px); display: flex; flex-direction: column; justify-content: center; position: relative; }
.hero-meta { display: flex; gap: 28px; flex-wrap: wrap; font-size: 13px; letter-spacing: .04em; color: var(--ink-soft); margin-bottom: 34px; }
.hero-meta span { position: relative; padding-left: 18px; }
.hero-meta span::before { content: ""; position: absolute; left: 0; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); }
.hero-title { font-family: var(--serif); font-weight: 300; font-size: clamp(44px, 9.2vw, 138px); line-height: .98; letter-spacing: -.03em; }
.hero-title em { color: var(--accent); font-weight: 400; }
.hero-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; flex-wrap: wrap; margin-top: clamp(40px, 6vw, 70px); }
.hero-foot p { max-width: 440px; font-size: 17px; line-height: 1.6; color: var(--ink-soft); }
.scroll-cue { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); width: 1px; height: 54px; background: var(--line); overflow: hidden; }
.scroll-cue span { position: absolute; top: 0; left: 0; width: 100%; height: 40%; background: var(--ink); animation: drop 2.2s var(--ease) infinite; }
@keyframes drop { 0% { transform: translateY(-100%);} 100% { transform: translateY(250%);} }

/* ---------- Page hero (Work page) ---------- */
.page-hero { padding: clamp(130px, 20vh, 220px) clamp(20px, 5vw, 60px) clamp(40px, 6vw, 80px); }
.page-hero .hero-title { font-family: var(--serif); font-weight: 300; font-size: clamp(54px, 11vw, 150px); line-height: .96; letter-spacing: -.035em; }
.page-hero .hero-title em { color: var(--accent); font-weight: 400; }
.page-hero > p { max-width: 520px; margin-top: 28px; font-size: 17px; line-height: 1.6; color: var(--ink-soft); }
.work--page { padding-top: 0; }
.is-active { color: var(--ink) !important; }
.is-active::after { width: 100% !important; }
.work-more { margin-top: clamp(40px, 6vw, 70px); padding-top: 36px; border-top: 1px solid var(--line); }

/* ---------- Manifesto ---------- */
.manifesto { padding: clamp(90px, 16vw, 220px) clamp(20px, 5vw, 60px); max-width: 1200px; }
.manifesto-text { font-family: var(--serif); font-weight: 300; font-size: clamp(26px, 4.6vw, 58px); line-height: 1.22; letter-spacing: -.02em; }
.manifesto-text .reveal-word { display: block; }

/* ---------- Work ---------- */
.work { padding: 0 clamp(20px, 5vw, 60px) clamp(60px, 10vw, 120px); }
.work-head { border-top: 1px solid var(--line); padding-top: 30px; margin-bottom: clamp(50px, 8vw, 110px); }
.work-head h2, .cap-head h2 { font-family: var(--serif); font-weight: 300; font-size: clamp(40px, 7vw, 96px); letter-spacing: -.03em; line-height: 1; margin-top: 10px; }
.work-head em, .cap-head em { color: var(--accent); }

.project { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(40px, 6vw, 90px); align-items: center; padding: clamp(40px, 7vw, 90px) 0; }
.project--reverse .project-visual { order: 2; }
.project-index { display: block; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 18px; }
.project-title { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 84px); letter-spacing: -.03em; line-height: 1; margin-bottom: 26px; }
.project-lede { font-size: 17px; line-height: 1.65; color: var(--ink-soft); max-width: 460px; margin-bottom: 28px; }
.project-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.project-tags li { font-size: 13px; font-weight: 500; padding: 7px 15px; border: 1px solid var(--line); border-radius: 100px; }

/* phone mock */
.project-visual { position: relative; display: flex; align-items: center; justify-content: center; min-height: 420px; }
.device-phone {
  width: clamp(180px, 22vw, 248px); aspect-ratio: 9/19.5; border-radius: 34px;
  background: #0d0d0d; padding: 9px; box-shadow: 0 40px 80px -30px rgba(26,23,20,.45); position: relative; z-index: 2;
}
.device-phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 26px; display: block; }
.device-phone--back { position: absolute; z-index: 1; transform: translate(34%, 10%) rotate(7deg) scale(.92); opacity: .92; box-shadow: 0 30px 60px -30px rgba(26,23,20,.4); }

/* browser mock */
.device-browser { width: min(100%, 540px); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 40px 90px -40px rgba(26,23,20,.5); border: 1px solid var(--line); }
.browser-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: #f3f1ec; border-bottom: 1px solid var(--line); }
.browser-bar span { width: 10px; height: 10px; border-radius: 50%; background: #d9d4ca; }
.browser-bar em { margin-left: 14px; font-style: normal; font-size: 12px; color: #9a948a; }
.browser-shot { display: block; width: 100%; height: auto; }

/* Scroll-reveal browser frame (shows a full-length page on hover) */
.device-scroll { position: relative; }
.scroll-window { height: 380px; overflow: hidden; position: relative; }
.scroll-shot { display: block; width: 100%; height: auto; transition: transform 7s cubic-bezier(0.4, 0, 0.2, 1); }
.device-scroll:hover .scroll-window .scroll-shot,
.gs-card:hover .scroll-window .scroll-shot { transform: translateY(calc(-100% + 380px)); }
.scroll-hint {
  position: absolute; right: 14px; bottom: 12px; z-index: 4;
  font-size: 11px; letter-spacing: .04em; color: var(--ink);
  background: rgba(235, 230, 219, 0.88); backdrop-filter: blur(4px);
  padding: 6px 12px; border-radius: 100px; border: 1px solid var(--line);
  transition: opacity .4s; pointer-events: none;
}
.device-scroll:hover .scroll-hint { opacity: 0; }

/* GS page gallery */
.gs-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: clamp(20px, 4vw, 50px); }
.gs-card { border-radius: 12px; overflow: hidden; }
.gs-card .device-scroll, .gs-card { position: relative; }
.gs-card { background: #fff; border: 1px solid var(--line); box-shadow: 0 30px 60px -40px rgba(26,23,20,.45); }
.browser-bar--mini { padding: 9px 13px; }
.browser-bar--mini span { width: 8px; height: 8px; }
.browser-bar--mini em { margin-left: 10px; font-size: 11px; }
.scroll-window--mini { height: 300px; }
.gs-card .scroll-window--mini .scroll-shot { transition: transform 6s cubic-bezier(0.4, 0, 0.2, 1); }
.gs-card:hover .scroll-window--mini .scroll-shot { transform: translateY(calc(-100% + 300px)); }
.gs-card figcaption { padding: 13px 16px; font-size: 13px; color: var(--ink-soft); border-top: 1px solid var(--line); }

/* ---------- Capabilities ---------- */
.capabilities { padding: clamp(70px, 11vw, 150px) clamp(20px, 5vw, 60px); }
.cap-head { border-top: 1px solid var(--line); padding-top: 30px; margin-bottom: clamp(40px, 6vw, 80px); }
.cap-list { list-style: none; }
.cap-row { display: grid; grid-template-columns: 80px 1fr 1.1fr; gap: 30px; align-items: baseline; padding: clamp(26px, 3.5vw, 44px) 0; border-bottom: 1px solid var(--line); transition: padding-left .5s var(--ease); }
.cap-row:hover { padding-left: 16px; }
.cap-num { font-family: var(--serif); font-size: 16px; color: var(--accent); }
.cap-row h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 3.2vw, 40px); letter-spacing: -.02em; }
.cap-row p { font-size: 16px; color: var(--ink-soft); line-height: 1.6; max-width: 420px; }

/* ---------- Studio ---------- */
.studio { padding: clamp(70px, 11vw, 150px) clamp(20px, 5vw, 60px); max-width: 1100px; }
.studio-text { font-family: var(--serif); font-weight: 300; font-size: clamp(24px, 3.8vw, 48px); line-height: 1.3; letter-spacing: -.02em; }
.studio-text em { color: var(--accent); font-weight: 400; }
.studio-text .reveal-word { display: block; }
.studio-stats { display: flex; flex-wrap: wrap; gap: clamp(36px, 6vw, 90px); margin-top: clamp(46px, 6vw, 80px); padding-top: 40px; border-top: 1px solid var(--line); }
.stat strong { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 3vw, 34px); letter-spacing: -.02em; }
.stat span { font-size: 14px; color: var(--ink-soft); }

/* ---------- Contact ---------- */
.contact { padding: clamp(80px, 13vw, 180px) clamp(20px, 5vw, 60px); border-top: 1px solid var(--line); }
.contact-mail { display: block; font-family: var(--serif); font-weight: 300; font-size: clamp(46px, 11vw, 168px); line-height: .96; letter-spacing: -.035em; }
.contact-mail em { color: var(--accent); font-weight: 400; }
.contact-mail:hover em { font-style: italic; }
.contact-foot { margin-top: clamp(40px, 6vw, 70px); display: flex; flex-wrap: wrap; gap: 18px 40px; align-items: center; }

/* ---------- Footer ---------- */
.footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; padding: 40px clamp(20px, 5vw, 60px); border-top: 1px solid var(--line); }
.footer-links { display: flex; gap: 26px; }
.footer-links a { font-size: 15px; color: var(--ink-soft); transition: color .3s; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 14px; color: var(--ink-soft); }

/* ---------- Reveal states ---------- */
.reveal-fade { opacity: 0; transform: translateY(26px); }
.ln > span { transform: translateY(110%); }
.reveal-word { opacity: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .nav-links { display: none; }
  .burger { display: flex; }
  .project, .project--reverse .project-visual { grid-template-columns: 1fr; order: 0; }
  .project { gap: 40px; }
  .cap-row { grid-template-columns: 50px 1fr; }
  .cap-row p { grid-column: 2; }
  .hero-foot { gap: 28px; }
  .gs-gallery { grid-template-columns: 1fr; gap: 18px; }
  .scroll-window { height: 300px; }
}
@media (max-width: 520px) {
  .project-visual { min-height: 340px; }
  .device-phone--back { transform: translate(40%, 14%) rotate(8deg) scale(.9); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal-fade, .reveal-word { opacity: 1; transform: none; }
  .ln > span { transform: none; }
}
