@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400..700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --ink: #0a0a0a;        /* near-black base */
  --paper: #f5f5f2;      /* off-white */
  --accent: #74b896;     /* muted sage-emerald: brand green, dimmed off the neon */
  --accent-ink: #0a0a0a; /* text that sits on the accent (CTA labels) */
  --muted: #8a8a8a;
  --line: rgba(255,255,255,0.10); /* hairline separator */
  --surface: rgba(255,255,255,0.02); /* faint raised surface */
  --radius: 1rem;        /* the one card radius (16px) */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { font-family: "Inter", sans-serif; background: var(--ink); color: var(--paper); scroll-behavior: auto; }

body {
  font-family: "Inter", sans-serif;
  font-weight: 300;
  color: var(--paper);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Typography defaults override the old tailpress stack */
h1, h2, h3, h4, h5, h6, .hero-title, .case-title {
  font-family: "DM Sans", "Inter", sans-serif;
  color: var(--paper);
  margin: 0;
  line-height: 1;
  font-feature-settings: "ss01", "ss02";
}

p { margin: 0 0 1rem 0; }
a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; padding: 0; margin: 0; }
button { background: none; border: 0; cursor: pointer; font: inherit; color: inherit; }

/* Selection */
::selection { background: var(--accent); color: var(--ink); }

/* Prose styling for ACF wysiwyg blocks */
.prose-portfolio p { margin-bottom: 1.25rem; }
.prose-portfolio p:last-child { margin-bottom: 0; }
.prose-portfolio strong { color: #fff; font-weight: 500; }
.prose-portfolio em { color: var(--accent); font-style: normal; }
.prose-portfolio a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(116,184,150,0.4);
  text-underline-offset: 4px;
  transition: all .25s ease;
}
.prose-portfolio a:hover { text-decoration-color: var(--accent); }
.prose-portfolio h2 { font-size: 2rem; line-height: 1.1; margin: 2rem 0 1rem; font-weight: 500; }
.prose-portfolio h3 { font-size: 1.5rem; line-height: 1.2; margin: 2rem 0 1rem; font-weight: 500; }
.prose-portfolio ul { list-style: none; margin: 1rem 0; padding: 0; }
.prose-portfolio ul li { padding-left: 1.25rem; position: relative; margin-bottom: .5rem; }
.prose-portfolio ul li::before {
  content: ""; position: absolute; left: 0; top: .8em; width: .5rem; height: 1px; background: var(--accent);
}
.prose-portfolio ol { list-style: decimal inside; margin: 1rem 0; }
.prose-portfolio blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-size: 1.25rem;
  font-weight: 400;
}

/* Heading emphasis: same family, italic, same colour. No serif, no accent by default. */
h1 em, h2 em, h3 em, h4 em, h5 em, h6 em,
.hero-title em, .case-title em {
  font-family: inherit;
  font-style: italic;
  font-weight: inherit;
  color: inherit;
  letter-spacing: inherit;
}

/* The single deliberate accent word (used at most once per page, e.g. hero). */
.accent-word {
  color: var(--accent);
  font-style: italic;
  font-weight: inherit;
}

/* Header scrolled state */
#siteHeader.is-scrolled {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 10, 10, 0.5);
}
#siteHeader.is-scrolled > div { padding-top: .6rem; padding-bottom: .6rem; }

/* Wordmark per-char hover lift */
.header-wordmark:hover .header-char { transform: translateY(-2px); color: var(--accent); }

/* Menu button → X transform on active */
#menuToggle.is-active .menu-icon span:nth-child(1) {
  top: 50%; right: 50%;
  transform: translate(50%,-50%) rotate(45deg);
  width: 14px;
}
#menuToggle.is-active .menu-icon span:nth-child(2) {
  top: 50%; right: 50%;
  transform: translate(50%,-50%) rotate(-45deg);
  width: 14px;
}
#menuToggle.is-active { border-color: var(--accent); }

/* Overlay fade */
#menuOverlay { transition: opacity .5s cubic-bezier(.4,0,.2,1), visibility .5s; }
#menuOverlay.is-open { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; }

/* Overlay links - hover swap */
.overlay-link .overlay-link-title {
  padding: 0.18em 0.04em; /* generous room for italic ascenders/descenders & side-bearings */
}
.overlay-link .overlay-char {
  line-height: 1.25;
  height: 1.25em;
  overflow: hidden;
  padding: 0 0.04em;
  vertical-align: top;
}
.overlay-link .overlay-char > span {
  display: block;
  line-height: 1.25;
  will-change: transform;
}

/* Marquee */
.marquee { mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: inline-flex; gap: 4rem; align-items: center; }

/* WP default nav menu reset */
.menu-item > a { color: rgba(245,245,242,0.75); transition: color .2s; }
.menu-item > a:hover { color: var(--paper); }

/* Form controls */
input, select, textarea { font-family: inherit; }
select option { background: var(--ink); color: var(--paper); }

/* Utility */
.baseTransition { transition: all .5s cubic-bezier(0.4, 0, 0.2, 1); }

/* Prevent FOUC on reveals */
[data-reveal] { will-change: transform, opacity; }

/* Mobile tweaks */
@media (max-width: 768px) {
  .hero-title, .case-title { letter-spacing: -0.02em; }
}

/* Footer shape consistency */
[role="contentinfo"] a:hover { color: var(--accent); }

/* WP core compatibility */
.alignfull { width: 100vw; margin-left: calc(50% - 50vw); }
.alignwide { max-width: 1400px; margin-left: auto; margin-right: auto; }

/* Quform overrides for dark theme (if shortcode is used) */
.quform input[type="text"],
.quform input[type="email"],
.quform textarea,
.quform select {
  background: transparent !important;
  color: var(--paper) !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 0 !important;
  padding: .75rem 0 !important;
}
.quform .quform-input input:focus,
.quform .quform-input textarea:focus,
.quform .quform-input select:focus {
  border-color: var(--accent) !important;
  outline: none !important;
  box-shadow: none !important;
}
.quform .quform-submit button {
  background: var(--accent) !important;
  color: var(--ink) !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 1rem 1.5rem !important;
  font-weight: 500 !important;
}
.quform label { color: rgba(245,245,242,0.5) !important; text-transform: uppercase; letter-spacing: 0.2em; font-size: 11px !important; }

/* True full-height hero that respects mobile browser UI */
.hero-fullscreen {
  min-height: 100vh;
  min-height: 100svh;
  height: 100vh;
  height: 100svh;
}

/* Archive year filter chip */
.year-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

/* Line clamp helper (Tailwind v3 has it but CDN config may miss plugin) */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Skills tabs */
.skill-tab { position: relative; }
.skill-tab::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .4s cubic-bezier(.4,0,.2,1);
}
.skill-tab.is-active::before,
.skill-tab:hover::before { transform: scaleY(1); }
.skill-tab.is-active,
.skill-tab:hover { background: rgba(255,255,255,0.02); }
.skill-tab.is-active .skill-tab-title { color: var(--accent); }
.skill-tab.is-active .skill-tab-arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
  transform: rotate(-45deg);
}

/* Work index - row hover accent */
.work-row:hover .work-row-title-inner { letter-spacing: -0.02em; }
.work-preview-slide { transition: opacity .5s cubic-bezier(0.4, 0, 0.2, 1); }

/* Case study chapter active link */
.chapter-link.is-active { color: var(--paper); }
.chapter-link.is-active .chapter-link-bar { width: 100%; }
.chapter-link.is-active .font-mono { color: var(--accent); }

/* Horizontal gallery - hide scrollbar, drag cursor */
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.case-gallery { cursor: grab; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.case-gallery.dragging { cursor: grabbing; user-select: none; scroll-snap-type: none !important; }
.case-gallery img { user-select: none; -webkit-user-drag: none; }
/* soft snap only when idle, on touch devices */
@media (pointer: coarse) {
  .case-gallery { scroll-snap-type: x proximity; scroll-padding: 1.5rem; }
  .case-gallery > div > .case-gallery-item { scroll-snap-align: start; }
}

/* Case title line wrap */
.case-title span { display: block; }

/* Font mono helper (Tailwind CDN handles font-mono already but fallback) */
.font-mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* Spline viewer: hide default logo + ensure canvas fills */
spline-viewer {
  display: block;
  width: 100%;
  height: 100%;
  --logo-display: none;
}
spline-viewer::part(logo) { display: none !important; }
spline-viewer canvas { display: block; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  [data-reveal], .case-title-line, .case-hero-img, .case-meta-track, .marquee-track {
    transform: none !important;
    opacity: 1 !important;
    animation: none !important;
  }
}

/* ===== Service bento: choreographed hover ===== */
/* Visual group: gentle zoom + base strokes lighten on hover. */
.svc-viz {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: transform .6s cubic-bezier(.22,1,.36,1), color .4s ease;
}
.service-cell:hover .svc-viz { transform: scale(1.035); color: rgba(245,245,242,0.30); }

/* Accent strokes draw themselves in (pathLength="1" normalises any length). */
.svc-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset .8s cubic-bezier(.22,1,.36,1), opacity .35s ease;
}
.service-cell:hover .svc-draw { stroke-dashoffset: 0; opacity: 1; }

/* Accent fills scale + fade in from their own centre. */
.svc-pop {
  opacity: 0;
  transform: scale(.5);
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transition: opacity .4s ease, transform .55s cubic-bezier(.22,1,.36,1);
}
.service-cell:hover .svc-pop { opacity: 1; transform: scale(1); }

/* Soft tints just fade. */
.svc-fade { opacity: 0; transition: opacity .5s ease; }
.service-cell:hover .svc-fade { opacity: 1; }

/* Gauge needle: rests pointing left (min) and sweeps right to the value on hover. */
.svc-needle {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 0% 100%;
  transform: rotate(-128deg);
  transition: transform .8s cubic-bezier(.22,1,.36,1), opacity .4s ease;
}
.service-cell:hover .svc-needle { opacity: 1; transform: rotate(0deg); }

/* Stagger so each visual feels choreographed, not all-at-once. */
.svc-d1 { transition-delay: .03s; }
.svc-d2 { transition-delay: .08s; }
.svc-d3 { transition-delay: .18s; }
.svc-d4 { transition-delay: .28s; }
.svc-d5 { transition-delay: .36s; }

/* ===== Note covers ===== */
.note-cover-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(245,245,242,0.05) 1px, transparent 1px);
  background-size: 18px 18px;
  pointer-events: none;
}
.note-cover-art { transition: transform .6s cubic-bezier(.22,1,.36,1); }
.note-cover-art svg { width: 76%; height: auto; }
.group:hover .note-cover-art { transform: scale(1.04); }
.note-cover-img { transition: transform .7s cubic-bezier(.22,1,.36,1); }
.group:hover .note-cover-img { transform: scale(1.04); }

/* Forced reveal: the single-service hero shows its visual already in the accent state. */
.svc-show .svc-draw { stroke-dashoffset: 0; opacity: 1; }
.svc-show .svc-pop { opacity: 1; transform: scale(1); }
.svc-show .svc-fade { opacity: 1; }
.svc-show .svc-needle { opacity: 1; transform: rotate(0deg); }
.svc-show .svc-viz { color: rgba(245,245,242,0.30); }

@media (prefers-reduced-motion: reduce) {
  .svc-viz, .svc-draw, .svc-pop, .svc-fade, .svc-needle { transition: none !important; }
  .svc-viz { transform: none !important; }
  .service-cell:hover .svc-draw { stroke-dashoffset: 0; opacity: 1; }
  .service-cell:hover .svc-pop { opacity: 1; transform: none; }
  .service-cell:hover .svc-fade { opacity: 1; }
  .service-cell:hover .svc-needle { opacity: 1; transform: rotate(0deg); }
}

/* ===== Service page bento (single-service.php) ===== */
.svcpage-bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(92px, auto);
  grid-auto-flow: dense;
  gap: 0.75rem;
}
.svcpage-tile {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}
.svcpage-tile:hover {
  border-color: rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.04);
}
.svcpage-hero  { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; justify-content: center; }
.svcpage-shot  { grid-column: span 2; grid-row: span 2; padding: 0; overflow: hidden; display: flex; }
.svcpage-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.svcpage-shot-fallback { width: 100%; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.svcpage-stat   { grid-column: span 1; grid-row: span 1; display: flex; flex-direction: column; justify-content: center; }
.svcpage-stat .v { font-size: clamp(1.6rem, 2.4vw, 2.2rem); font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: var(--accent); }
.svcpage-stat .l { font-size: 0.8rem; color: rgba(245, 245, 242, 0.55); margin-top: 0.4rem; }
.svcpage-deliver { grid-column: span 2; grid-row: span 2; }
.svcpage-solve, .svcpage-who { grid-column: span 1; grid-row: span 2; }

@media (max-width: 1024px) {
  .svcpage-bento { grid-template-columns: repeat(2, 1fr); }
  .svcpage-hero, .svcpage-shot, .svcpage-deliver { grid-column: span 2; }
  .svcpage-solve, .svcpage-who { grid-column: span 1; }
}
@media (max-width: 640px) {
  .svcpage-bento { grid-template-columns: 1fr; }
  .svcpage-hero, .svcpage-shot, .svcpage-stat, .svcpage-deliver, .svcpage-solve, .svcpage-who {
    grid-column: span 1; grid-row: auto;
  }
  .svcpage-shot { min-height: 200px; }
}

/* Process timeline */
.svcpage-steps .num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* Animate the line-art visual inside the bento hero (self-draws once on load).
   Reuses the .svc-* classes from inc/service-visual.php; here they run on
   load instead of waiting for a .service-cell:hover. */
.svcpage-shot .svc-viz    { color: rgba(245, 245, 242, 0.30); }
.svcpage-shot .svc-fade   { animation: svcpage-fade   0.5s ease                       0.15s forwards; }
.svcpage-shot .svc-draw   { animation: svcpage-draw   0.9s cubic-bezier(.22,1,.36,1)  0.25s forwards; }
.svcpage-shot .svc-needle { animation: svcpage-needle 0.8s cubic-bezier(.22,1,.36,1)  0.35s forwards; }
.svcpage-shot .svc-pop    { animation: svcpage-pop    0.55s cubic-bezier(.22,1,.36,1) 0.50s forwards; }
@keyframes svcpage-fade   { to { opacity: 1; } }
@keyframes svcpage-draw   { to { stroke-dashoffset: 0; opacity: 1; } }
@keyframes svcpage-pop    { to { opacity: 1; transform: scale(1); } }
@keyframes svcpage-needle { to { opacity: 1; transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) {
  .svcpage-shot .svc-fade,
  .svcpage-shot .svc-draw,
  .svcpage-shot .svc-needle,
  .svcpage-shot .svc-pop { animation: none; opacity: 1; stroke-dashoffset: 0; transform: none; }
}
