/* ---------------------------------------------------------------------------
   Self-hosted fonts (no third-party requests).
   Run static/fonts/fetch-fonts.sh once to download the .woff2 files into
   static/fonts/. Until then the browser falls back to the stack in
   --font-head / --font-body below, so the site still works.
   --------------------------------------------------------------------------- */
@font-face { font-family:'Atkinson Hyperlegible Next'; font-style:normal; font-weight:200 800; font-display:swap; src:url('/fonts/atkinson-next-wght-normal.woff2') format('woff2'); }
@font-face { font-family:'Atkinson Hyperlegible Next'; font-style:italic; font-weight:200 800; font-display:swap; src:url('/fonts/atkinson-next-wght-italic.woff2') format('woff2'); }

/* ===========================================================================
   Cache Hits LLC — main.css
   Dark "phosphor terminal / server room" aesthetic.
   Palette and type are defined as variables below; tweak in one place.
   =========================================================================== */

:root {
  --bg:           #000000;
  --bg-grid:      rgba(120, 230, 150, 0.05);
  --panel:        #0a140d;
  --panel-2:      #0d1b12;
  --line:         rgba(120, 230, 150, 0.20);
  --line-strong:  rgba(120, 230, 150, 0.42);
  --ink-bright:   #f4fff8;   /* brightest — headings, hero name */
  --ink:          #e9fff1;   /* primary body text */
  --muted:        #c3ead2;   /* secondary text — still high-contrast, not gray */
  --dim:          #8fbfa1;   /* minor labels/accents */
  --accent:       #5df08a;
  --accent-bright:#9bff66;
  --glow:         rgba(93, 240, 138, 0.35);

  /* Type — all Atkinson Hyperlegible Next (variable). Distinct, accessible
     letterforms throughout; hierarchy comes from size + weight, not a second
     family. Three display registers, all independent of body text:
       hero titles  -> heavier, for presence over the video
       page/section -> lighter + slightly open (the chosen "refined" register)
       sub-headings -> a middle weight so nothing out-bolds the hero
     Body stays Regular (400) and is never tracked, so reading text keeps full
     legibility regardless of heading choices.

     WANT HELVETICA HEADINGS BACK? Set --font-head to:
       'Helvetica Neue', Helvetica, 'Nimbus Sans', Arial, sans-serif
     and re-add a self-hosted clone (e.g. TeX Gyre Heros) to the fallback. */
  --font-body: 'Atkinson Hyperlegible Next', system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-head: var(--font-body);

  --hero-weight:    600;       /* hero title — more presence over the video */
  --hero-tracking:  0em;
  --head-weight:    500;       /* page / section titles */
  --head-tracking:  0.015em;
  --subhead-weight: 600;       /* service-card + About sub-headings */

  --wrap: 1080px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
}

/* ---- reset-ish --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  /* faint engineering grid + corner vignette for atmosphere */
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    radial-gradient(120% 80% at 50% -10%, rgba(93,240,138,0.06), transparent 60%);
  background-size: 64px 64px, 64px 64px, 100% 100%;
  line-height: 1.65;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }

main { flex: 1 0 auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #04140a; padding: .6rem 1rem;
  font-family: var(--font-head); z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---- brand mark (uses the square circuit image) ------------------------ */
.brand-mark {
  width: 30px; height: 30px; flex: none;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: url('/images/circuit-square.jpg') center/cover no-repeat;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset, 0 0 14px -4px var(--glow);
}
.brand-mark.sm { width: 22px; height: 22px; border-radius: 4px; }

/* ---- header ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink-bright); }
.brand:hover { color: var(--ink-bright); }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; letter-spacing: .01em; }

.nav { display: flex; gap: clamp(.9rem, 2.5vw, 1.9rem); }
.nav a {
  font-family: var(--font-head); font-size: .85rem; color: var(--muted);
  text-transform: lowercase; letter-spacing: .04em;
  padding: .35rem 0; position: relative;
}
.nav a:hover { color: var(--ink); }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px; height: 1px;
  background: var(--accent); transition: right .25s ease;
}
.nav a:hover::after, .nav a[aria-current="page"]::after { right: 0; }
.nav a[aria-current="page"] { color: var(--accent); }

/* ---- hero -------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  /* poster shows instantly, and remains the fallback if the video is
     suppressed (reduced motion / small screens) or fails to load */
  background: var(--bg) url('/images/hero-poster.jpg') center/cover no-repeat;
}
.hero-video {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
  /* push the footage back so foreground text stays legible on any frame */
  filter: brightness(0.68) saturate(1.15) contrast(1.04);
}
.hero-scrim {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.74) 55%, #000 100%),
    linear-gradient(90deg, rgba(0,0,0,.88) 0%, rgba(0,0,0,.32) 60%, rgba(0,0,0,.15) 100%);
}
.hero-inner {
  padding-block: clamp(2.25rem, 6vh, 3.75rem);
  max-width: 880px;
}
.hero-name {
  font-family: var(--font-head); font-weight: var(--hero-weight);
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.02; letter-spacing: var(--hero-tracking);
  color: var(--ink-bright); text-wrap: balance;
}
.hero-tagline {
  margin-top: .5rem;
  font-family: var(--font-head); font-weight: var(--head-weight);
  font-size: clamp(1.15rem, 2.4vw, 1.6rem); letter-spacing: var(--head-tracking);
  color: var(--accent);
}
.hero-sub {
  margin-top: 1.1rem; max-width: 60ch;
  font-size: 1.1rem; color: var(--ink);
}
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  margin-top: 2.2rem;
  font-family: var(--font-head); font-size: .9rem; letter-spacing: .03em;
  color: var(--accent);
  padding: .7rem 1.25rem;
  border: 1px solid var(--line-strong); border-radius: 6px;
  background: rgba(93,240,138,.04);
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.btn:hover {
  color: #04140a; background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 22px -4px var(--glow); transform: translateY(-1px);
}
.btn .arrow { transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---- services ---------------------------------------------------------- */
.services { padding-block: clamp(1.75rem, 4vw, 3rem); }
.section-label {
  font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  letter-spacing: .06em; color: var(--ink); text-transform: uppercase;
  padding-bottom: 1rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.prompt { color: var(--accent); margin-right: .35rem; }

.cards {
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  position: relative;
  padding: 1.6rem 1.6rem 1.7rem;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: 10px; padding: 1px;
  background: linear-gradient(180deg, var(--line-strong), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 14px 40px -22px var(--glow);
}
.card:hover::before { opacity: 1; }
.card-title {
  font-family: var(--font-head); font-weight: var(--subhead-weight); font-size: 1.2rem;
  color: var(--ink-bright); line-height: 1.3;
}
.card-body { margin-top: .7rem; color: var(--muted); font-size: 1rem; }

/* ---- generic page + prose --------------------------------------------- */
.page { padding-block: clamp(2.8rem, 7vw, 4.5rem); }
.page-head { padding-bottom: 1.8rem; margin-bottom: 2.4rem; border-bottom: 1px solid var(--line); }
.page-title {
  font-family: var(--font-head); font-weight: var(--head-weight);
  font-size: clamp(1.8rem, 4vw, 2.6rem); letter-spacing: var(--head-tracking); color: var(--ink-bright);
}
.prose { max-width: 68ch; }
.prose h2 {
  font-family: var(--font-head); font-weight: var(--subhead-weight); font-size: 1.5rem;
  color: var(--ink-bright); margin-top: 2.4rem;
}
.prose h3 {
  font-family: var(--font-head); font-weight: var(--subhead-weight); font-size: 1.15rem;
  color: var(--accent); margin-top: 1.8rem; letter-spacing: .01em;
}
.prose h3::before { content: "> "; color: var(--dim); }
.prose p { margin-top: 1.05rem; color: var(--ink); }
.prose p:first-of-type { margin-top: 1.2rem; }
.prose a { border-bottom: 1px solid var(--line-strong); }
.prose-section { padding-block: clamp(2rem, 6vw, 4rem); }

/* ---- footer ------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; }
.footer-inner {
  display: flex; align-items: center; gap: .8rem;
  padding-block: 2rem;
}
.copy { font-family: var(--font-head); font-size: .8rem; color: var(--dim); letter-spacing: .02em; }

/* ---- entrance animation (home hero) ------------------------------------ */
.reveal { opacity: 0; transform: translateY(14px); animation: rise .7s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: var(--d, 0ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-video { display: none; }   /* fall back to the static poster image */
}

/* On small screens, skip the video download entirely; the poster carries it. */
@media (max-width: 600px) {
  .hero-video { display: none; }
}

/* ---- small screens ----------------------------------------------------- */
@media (max-width: 560px) {
  .header-inner { height: 58px; }
  .brand-name { font-size: .92rem; }
  .nav { gap: 1rem; }
}
