/* =========================================================================
   Fielding — fielding.dev
   Consulting practice of Fabian Renn-Giles. Real-time audio software.
   Design: "Signal" — near-black, steel-blue structure, electric-cyan accent,
   confident display type, oscilloscope motif.
   Hand-authored, no build step.
   ========================================================================= */

/* ---- Self-hosted fonts ------------------------------------------------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/SpaceGrotesk-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-Italic-VariableFont_opsz,wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* ---- Design tokens ---------------------------------------------------- */
:root {
  /* Surfaces */
  --bg:        #0d0f12;   /* near-black */
  --bg-2:      #14181d;   /* raised surface */
  --bg-3:      #1b2027;   /* card / hover */
  --line:      #262d36;   /* hairlines */
  --line-2:    #323b46;

  /* Brand */
  --steel:     #4a5c75;   /* shared "Fielding" family colour */
  --steel-lt:  #9dabbd;
  --accent:    #2fe6cf;   /* electric signal cyan */
  --accent-dim:#1c8f81;
  --gold:      #dba922;   /* sibling-brand tie-in, used sparingly */

  /* Text */
  --ink:       #eef2f6;
  --ink-2:     #b6c0cc;
  --ink-3:     #7f8b99;

  /* Type */
  --display: "Space Grotesk", "Futura", "Trebuchet MS", system-ui, sans-serif;
  --body:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Layout */
  --maxw: 1120px;
  --pad: clamp(1.1rem, 4vw, 2.5rem);
  --radius: 14px;
  --radius-sm: 9px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---- Reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #04110f; }

/* ---- Type scale ------------------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.08; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 7vw, 5rem); }
h2 { font-size: clamp(1.9rem, 4.4vw, 3rem); }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }
p  { color: var(--ink-2); }

.mono { font-family: var(--mono); }

/* Eyebrow / kicker label */
.kicker {
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: .6rem;
}
.kicker::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--accent);
  opacity: .8;
}

/* ---- Layout helpers --------------------------------------------------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }
.section { padding-block: clamp(3.5rem, 9vw, 7rem); }
.section--tight { padding-block: clamp(2.5rem, 6vw, 4rem); }
.lead { font-size: clamp(1.1rem, 1.8vw, 1.35rem); color: var(--ink-2); max-width: 62ch; }
.measure { max-width: 64ch; }
.hairline { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.4rem;
  border-radius: 100px;
  font-weight: 600; font-size: .98rem;
  border: 1px solid transparent;
  transition: transform .25s var(--ease), background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
.btn .arr { transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }
.btn--primary { background: var(--accent); color: #04110f; }
.btn--primary:hover { transform: translateY(-2px); background: #4af2dd; }
.btn--ghost { border-color: var(--line-2); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---- Header / nav ----------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; }
.brand:hover .brand-mark path { stroke: var(--accent); }
.nav-links { display: flex; align-items: center; gap: .35rem; }
.nav-links a {
  padding: .5rem .85rem; border-radius: 8px;
  font-size: .96rem; color: var(--ink-2);
  transition: color .2s, background .2s;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); background: var(--bg-3); }
.nav-cta { margin-left: .4rem; }
.nav-links .btn--primary { color: #04110f; background: var(--accent); }
.nav-links .btn--primary:hover { color: #04110f; background: #4af2dd; }

.nav-toggle { display: none; background: none; border: 0; color: var(--ink); padding: .4rem; }
.nav-toggle svg { width: 26px; height: 26px; }

@media (max-width: 760px) {
  .nav-cta { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; inset: 72px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    padding: .5rem var(--pad) 1rem;
    transform: translateY(-130%); transition: transform .35s var(--ease);
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: .9rem .25rem; border-radius: 0; border-bottom: 1px solid var(--line); }
}

/* ---- Hero ------------------------------------------------------------- */
.hero { position: relative; padding-top: clamp(2.5rem, 6vw, 4.5rem); padding-bottom: clamp(2.5rem, 6vw, 4rem); overflow: hidden; }
.hero::before {
  /* steel radial glow */
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 70%;
  background: radial-gradient(60% 80% at 30% 0%, color-mix(in srgb, var(--steel) 32%, transparent), transparent 70%);
  pointer-events: none; z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { margin: 1.2rem 0 1.4rem; max-width: 16ch; }
.hero h1 .em { color: var(--accent); }
.hero-sub { font-size: clamp(1.05rem, 1.7vw, 1.3rem); color: var(--ink-2); max-width: 56ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }

/* oscilloscope canvas band */
.scope {
  position: relative;
  margin-top: clamp(2.2rem, 5vw, 3.5rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--bg-2), var(--bg-2)) padding-box,
    repeating-linear-gradient(0deg, transparent 0 23px, color-mix(in srgb, var(--steel) 14%, transparent) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 31px, color-mix(in srgb, var(--steel) 14%, transparent) 31px 32px);
  overflow: hidden;
  height: clamp(150px, 22vw, 240px);
}
.scope canvas { width: 100%; height: 100%; display: block; }
.scope-label {
  position: absolute; left: 14px; bottom: 10px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .08em;
  color: var(--steel-lt); opacity: .8;
}
.scope-dot { position: absolute; top: 12px; right: 14px; display: inline-flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .72rem; color: var(--steel-lt); }
.scope-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 2s infinite var(--ease); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---- Stat strip ------------------------------------------------------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.stat { background: var(--bg-2); padding: 1.4rem 1.3rem; }
.stat dt { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: .5rem; }
.stat dd { font-family: var(--display); font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--ink); line-height: 1.2; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---- Section heading -------------------------------------------------- */
.sec-head { max-width: 60ch; margin-bottom: clamp(2rem, 4vw, 3rem); }
.sec-head h2 { margin: .9rem 0 1rem; }

/* ---- Services grid ---------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card {
  background: var(--bg-2); padding: 1.8rem 1.7rem;
  transition: background .25s var(--ease);
  position: relative;
}
.card:hover { background: var(--bg-3); }
.card .idx { font-family: var(--mono); font-size: .78rem; color: var(--accent); }
.card h3 { margin: .9rem 0 .6rem; }
.card p { font-size: .96rem; }

/* ---- Clients ---------------------------------------------------------- */
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.client {
  background: var(--bg-2); display: flex; align-items: center; justify-content: center;
  min-height: 92px; padding: 1rem;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em;
  color: var(--ink-2);
  transition: color .25s, background .25s;
}
.client:hover { color: var(--ink); background: var(--bg-3); }
.client small { display: block; font-family: var(--mono); font-weight: 400; font-size: .65rem; letter-spacing: .08em; color: var(--ink-3); margin-top: .3rem; text-transform: uppercase; }
.client-c { text-align: center; }

/* ---- Testimonials ----------------------------------------------------- */
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.3rem; }
.quote { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.9rem; position: relative; }
.quote::before { content: "\201C"; font-family: var(--display); font-size: 4rem; line-height: 1; color: var(--steel); position: absolute; top: .4rem; right: 1.1rem; opacity: .4; }
.quote blockquote { font-size: 1.08rem; color: var(--ink); line-height: 1.55; }
.quote figcaption { margin-top: 1.2rem; font-size: .92rem; color: var(--ink-3); }
.quote figcaption strong { color: var(--ink); font-weight: 600; }

/* ---- Credentials band ------------------------------------------------- */
.creds { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.cred { border-left: 2px solid var(--steel); padding-left: 1.1rem; }
.cred h3 { font-size: 1.05rem; color: var(--accent); margin-bottom: .4rem; font-family: var(--mono); font-weight: 500; letter-spacing: -0.01em; }
.cred p { font-size: .95rem; }

/* ---- CTA band --------------------------------------------------------- */
.cta-band {
  background:
    radial-gradient(70% 140% at 80% 20%, color-mix(in srgb, var(--steel) 30%, transparent), transparent 60%),
    var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(2.2rem, 5vw, 3.6rem);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.6rem;
}
.cta-band h2 { max-width: 18ch; }
.cta-band p { margin-top: .6rem; }

/* ---- Generic page intro ----------------------------------------------- */
.page-intro { padding-top: clamp(2.4rem, 6vw, 4rem); padding-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.page-intro h1 { font-size: clamp(2.2rem, 6vw, 4rem); margin: 1rem 0 1.2rem; }

/* ---- Engagements (work page) ------------------------------------------ */
.engagements { display: grid; gap: 1.1rem; }
.eng {
  display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.7rem 1.8rem;
  transition: border-color .25s var(--ease);
}
.eng:hover { border-color: var(--line-2); }
.eng-meta .name { font-family: var(--display); font-weight: 600; font-size: 1.25rem; }
.eng-meta .tag { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-top: .5rem; display: inline-block; }
.eng-body p { color: var(--ink-2); }
.eng-body .stack { margin-top: .9rem; display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { font-family: var(--mono); font-size: .72rem; color: var(--steel-lt); border: 1px solid var(--line-2); border-radius: 100px; padding: .25rem .7rem; }
@media (max-width: 680px) { .eng { grid-template-columns: 1fr; gap: .9rem; } }

/* ---- Talks list ------------------------------------------------------- */
.talks { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.talk {
  background: var(--bg-2); display: grid; grid-template-columns: 1fr auto;
  gap: 1rem; align-items: center; padding: 1.3rem 1.6rem;
  transition: background .2s var(--ease);
}
.talk:hover { background: var(--bg-3); }
.talk .t-title { font-family: var(--display); font-weight: 600; font-size: 1.12rem; }
.talk .t-desc { color: var(--ink-3); font-size: .92rem; margin-top: .25rem; max-width: 70ch; }
.talk .t-meta { font-family: var(--mono); font-size: .76rem; color: var(--steel-lt); white-space: nowrap; text-align: right; }
.talk .t-meta .play { display: inline-flex; align-items: center; gap: .4rem; color: var(--accent); margin-top: .4rem; }
@media (max-width: 620px) { .talk { grid-template-columns: 1fr; } .talk .t-meta { text-align: left; } }

/* ---- Simple list (publications, patents) ------------------------------ */
.reflist { list-style: none; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.reflist li { background: var(--bg-2); padding: 1.2rem 1.5rem; }
.reflist .r-title { font-weight: 600; color: var(--ink); }
.reflist .r-meta { font-family: var(--mono); font-size: .78rem; color: var(--ink-3); margin-top: .3rem; }
.reflist a.r-link { color: var(--accent); }
.reflist a.r-link:hover { text-decoration: underline; }

/* ---- Prose (about) ---------------------------------------------------- */
.prose { max-width: 68ch; }
.prose p { margin-bottom: 1.2rem; font-size: 1.08rem; }
.prose h2 { margin: 2.6rem 0 1rem; }
.prose h3 { margin: 1.8rem 0 .6rem; color: var(--accent); font-family: var(--mono); font-weight: 500; font-size: 1rem; letter-spacing: .02em; }
.prose strong { color: var(--ink); }
.prose a { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.prose a:hover { border-bottom-color: var(--accent); }

/* ---- Contact form ----------------------------------------------------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
@media (max-width: 820px) { .contact-grid { grid-template-columns: 1fr; } }
.field { margin-bottom: 1.2rem; }
.field label { display: block; font-family: var(--mono); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: .5rem; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--ink); padding: .8rem .9rem; font: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field .err { color: #ff8a8a; font-size: .82rem; margin-top: .4rem; display: none; }
.field.invalid input, .field.invalid textarea { border-color: #ff8a8a; }
.field.invalid .err { display: block; }
.form-note { font-size: .85rem; color: var(--ink-3); margin-top: 1rem; }
.form-status { margin-top: 1rem; padding: 1rem 1.2rem; border-radius: var(--radius-sm); display: none; font-size: .95rem; }
.form-status.show { display: block; }
.form-status.ok { background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); border: 1px solid var(--accent-dim); color: var(--ink); }

.contact-aside dl { margin-top: 1.4rem; }
.contact-aside dt { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 1.1rem; }
.contact-aside dd { color: var(--ink); margin-top: .25rem; }
.contact-aside a { color: var(--accent); }

/* ---- Footer ----------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding-block: clamp(2.5rem, 5vw, 3.5rem); margin-top: 2rem; }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }
.footer-brand { max-width: 32ch; }
.footer-brand .brand { margin-bottom: 1rem; }
.footer-brand p { font-size: .92rem; color: var(--ink-3); }
.footer-cols { display: flex; gap: clamp(2rem, 6vw, 4.5rem); flex-wrap: wrap; }
.footer-col h4 { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: .9rem; }
.footer-col a { display: block; color: var(--ink-2); font-size: .95rem; padding: .25rem 0; transition: color .2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--ink-3); font-family: var(--mono); }
.footer-bottom a { color: var(--ink-3); }
.footer-bottom a:hover { color: var(--ink-2); }

/* ---- Scroll reveal ---------------------------------------------------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; } }

/* ---- Team ------------------------------------------------------------- */
.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); gap: 1.3rem; }
.member {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.8rem 1.7rem; display: flex; flex-direction: column;
  transition: border-color .25s var(--ease), background .25s var(--ease);
}
.member:hover { border-color: var(--line-2); background: var(--bg-3); }
.avatar, .avatar-mono { width: 78px; height: 78px; border-radius: 50%; flex: none; }
.avatar { object-fit: cover; border: 1px solid var(--line-2); }
.avatar-mono {
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 1.55rem; letter-spacing: -0.03em;
  color: var(--accent);
  background: linear-gradient(135deg, var(--bg-3), var(--bg));
  border: 1px solid var(--line-2);
}
.member h3 { margin: 1.15rem 0 .35rem; }
.member .role { font-family: var(--mono); font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.member p { font-size: .95rem; margin-top: .9rem; }
.member-links { margin-top: auto; padding-top: 1.2rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.member-links a { font-family: var(--mono); font-size: .8rem; color: var(--steel-lt); display: inline-flex; align-items: center; gap: .3rem; }
.member-links a:hover { color: var(--accent); }
.member--lead { background: linear-gradient(160deg, color-mix(in srgb, var(--steel) 16%, var(--bg-2)), var(--bg-2)); border-color: var(--line-2); }

/* ---- Founder header --------------------------------------------------- */
.founder-head { display: grid; grid-template-columns: 300px 1fr; gap: clamp(1.6rem, 5vw, 3rem); align-items: center; margin-top: 1.4rem; }
.founder-photo { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
@media (max-width: 720px) {
  .founder-head { grid-template-columns: 1fr; }
  .founder-photo { max-width: 220px; }
}

/* ---- Misc ------------------------------------------------------------- */
.inline-link { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.inline-link:hover { border-bottom-color: var(--accent); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #04110f; padding: .6rem 1rem; border-radius: 0 0 8px 0; z-index: 100; }
.skip-link:focus { left: 0; }
