/* Superb Software — shared theme.
 * Modern CSS: cascade layers, oklch()/color-mix() tokens, :is()/:where()/:has(),
 * container queries for the case grid, text-wrap balance/pretty, tabular numerals. */

@property --paper-ink {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(240, 236, 228, 0.5);
}
@property --lattice-ink {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(240, 96, 77, 0.5);
}
@property --trace-ink {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(240, 96, 77, 0.12);
}
@property --reticle-ink {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(240, 236, 228, 0.18);
}

/* ------------------------------------------------------------------ fonts */

@font-face {
  font-family: "Noto Sans";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/NotoSans-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Serif";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/NotoSerif-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/NotoSansMono-latin.woff2") format("woff2");
}
/* ----------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;
  /* manual toggle wins over the OS preference */

  /* the accents — vermilion, indigo, jade */
  --accent: #f0604d;
  --accent: light-dark(#d84a36, #f0604d);
  --accent2: #2E5C8A;
  --jade: #38B48B;
  --jade: light-dark(#2e8a6b, #38B48B);

  /* surfaces & text — light theme first, dark second */
  --bg: light-dark(#f4efe4, #0e0e10);
  --fg: light-dark(#231d14, #F2E0C2);
  --panel: light-dark(#fbf7ef, #16161a);
  --panel-hi: light-dark(#f0e9db, #17171c);
  --field: light-dark(#fbf7ef, #101014);
  --muted: light-dark(#7d766a, #6b6b70);
  --note: light-dark(#a79d8c, #3a3a40);

  /* hairlines */
  --line: light-dark(rgba(35, 29, 20, 0.16), rgba(240, 236, 228, 0.14));
  --line-strong: light-dark(rgba(35, 29, 20, 0.3), rgba(240, 236, 228, 0.28));
  --line-input: light-dark(rgba(35, 29, 20, 0.26), rgba(240, 236, 228, 0.25));
  --line-hard: light-dark(rgba(35, 29, 20, 0.34), rgba(240, 236, 228, 0.3));

  /* buttons — cream fill on dark, ink fill on light; hover inverts */
  --btn-bg: light-dark(#231d14, #F2E0C2);
  --btn-fg: light-dark(#F2E0C2, #0e0e10);

  /* canvas inks — read by lens.js */
  --paper-ink: light-dark(rgba(35, 29, 20, 0.4), rgba(240, 236, 228, 0.5));
  --lattice-ink: light-dark(rgba(216, 74, 54, 0.55), rgba(240, 96, 77, 0.5));
  --trace-ink: light-dark(rgba(216, 74, 54, 0.12), rgba(240, 96, 77, 0.12));
  --reticle-ink: light-dark(rgba(35, 29, 20, 0.2), rgba(240, 236, 228, 0.18));

  /* logo marks — cream on dark, ink on light */
  --logo-filter: none;
}

:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --logo-filter: brightness(0);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --logo-filter: brightness(0); }
}

/* ------------------------------------------------------------ layer order */

@layer reset, base, components, utilities;

/* ------------------------------------------------------------------ reset */

@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; }
  :where(strong, b, em, i) { font-weight: 400; font-style: normal; }
}

/* ------------------------------------------------------------------- base */

@layer base {
  html { font-size: 16px; }

  body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    font-family: "Noto Serif", serif;
    line-height: 1.6;
  }

  :where(h1, h2, h3) { text-wrap: balance; }
  :where(p, li) { text-wrap: pretty; }

  #paper {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
  }

  /* the column: every direct child gets the sheet */
  body > * {
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
    padding: 4rem 1.5rem 5rem;
    background: var(--bg);
    /* border-left: 1px solid var(--line); */
    /* border-right: 1px solid var(--line); */
  }
  body > nav {
    max-width: none;
    padding: 1.5rem 1.5rem;
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  body > footer {
    max-width: none;
    padding: 4rem 1.5rem 3rem;
    border-left: 0;
    border-right: 0;
  }
  body > #paper {
    position: fixed;
    inset: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
  }
  body > main {
    position: relative;
  }
}

/* ------------------------------------------------------------- components */

@layer components {

  /* nav ---------------------------------------------------------------- */
  nav {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.5rem 1.5rem;
    font-family: "Noto Sans Mono", monospace;
    font-size: 0.9rem;
    font-weight: 400;
  }
  nav a { color: var(--fg); text-decoration: none; }
  .brand {
    font-family: "Noto Sans", sans-serif;
    font-weight: 600;
    font-size: 1.7rem;
    letter-spacing: 0.05em;
    line-height: 1;
  }
  .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
  }
  .nav-links a:hover { color: var(--accent); }
  .nav-links a:not(:first-child)::before {
    content: "•";
    margin: 0 1rem;
    color: var(--muted);
  }
  .theme-toggle {
    background: none;
    border: 1px solid var(--line-input);
    border-radius: 2px;
    color: var(--fg);
    font-family: "Noto Sans", sans-serif;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
  }
  .theme-toggle:hover { border-color: var(--accent); }

  /* footer ------------------------------------------------------------- */
  footer {
    text-align: left;
    /* border-top: 1px solid var(--line-hard); */
    padding: 4rem 1.5rem 3rem;
    font-family: "Noto Sans Mono", monospace;
    font-size: 0.8rem;
    color: var(--fg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  footer::before {
    content: "";
    display: block;
    height: 6px;
    margin-bottom: 1rem;
    background:
      linear-gradient(90deg, transparent 0% 55%, var(--accent) 55% 67%, transparent 67% 78%, var(--accent2) 78% 90%, transparent 90% 100%),
      repeating-conic-gradient(var(--fg) 0% 25%, transparent 0% 50%);
    background-size: 100% 100%, 6px 6px;
  }
  footer .parent {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
  }
  footer .parent img { height: 1.5rem; }
  footer .parent img:first-child { height: 2.5rem; }

  /* panels — one recipe, many names ------------------------------------ */
  /* generic pages ------------------------------------------------------ */
  .page h1 {
    font-family: "Noto Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(1.9rem, 4.5vw, 2.5rem);
    text-align: left;
    margin-bottom: 2.5rem;
    letter-spacing: 0.02em;
  }

  .prose a { color: var(--accent2); }
  .prose h1 {
    font-family: "Noto Sans", sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    margin-top: 1.75rem;
    letter-spacing: 0;
  }
  .prose h1::before {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent);
    margin-right: 0.75rem;
    vertical-align: -0.12em;
  }
  .prose h1:first-child { margin-top: 0; }
  .prose :is(h2, h3) {
    font-family: "Noto Sans", sans-serif;
    font-weight: 400;
    margin-top: 1.5rem;
    font-size: 1.05rem;
  }
  .prose p { margin-top: 1.25rem; }
  .prose p:first-child { margin-top: 0; }
  .prose ul { margin-top: 1rem; padding-left: 1.4rem; }
  .prose li { margin-top: 0.5rem; }
  .prose em { font-family: "Noto Serif", serif; }
  .prose code {
    font-family: "Noto Sans Mono", monospace;
    font-size: 0.9em;
  }
  .prose pre {
    background: var(--field);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-top: 1rem;
  }

  /* hero --------------------------------------------------------------- */
  .hero {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem 0 2.5rem;
    flex-wrap: wrap;
  }
  .hero-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2rem;
  }
  .hero h1 {
    font-family: "Noto Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(2rem, 4.5vw, 2.8rem);
    line-height: 1.15;
    letter-spacing: 0.02em;

    /* hero lines — tune each line here */
    --hero-line-1-size: 1em;
    --hero-line-1-style: normal;
    --hero-line-2-size: 1em;
    --hero-line-2-style: normal;
    --hero-line-3-size: 0.8em;
    --hero-line-3-style: italic;
    --hero-line-4-size: 1em;
    --hero-line-4-style: normal;
  }
  .hero-line-1 { font-size: var(--hero-line-1-size); font-style: var(--hero-line-1-style); }
  .hero-line-2 { font-size: var(--hero-line-2-size); font-style: var(--hero-line-2-style); }
  .hero-line-3 { font-size: var(--hero-line-3-size); font-style: var(--hero-line-3-style); }
  .hero-line-4 { font-size: var(--hero-line-4-size); font-style: var(--hero-line-4-style); }
  .hero .sub {
    font-family: "Noto Sans", sans-serif;
    font-size: clamp(1rem, 2.5vw, 1.05rem);
  }
  .hero-trusted {
    flex-basis: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 0.5rem;
  }
  .hero-trusted-label {
    font-family: "Noto Sans Mono", monospace;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent2);
  }
  .hero-trusted .clients-logos { margin-top: 0; }
  @media (max-width: 40rem) {
    .hero { flex-direction: column; align-items: flex-start; }
  }

  /* CTA ---------------------------------------------------------------- */
  .cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--btn-bg);
    color: var(--btn-fg);
    text-decoration: none;
    font-weight: 400;
    font-family: "Noto Sans", sans-serif;
    line-height: 1;
    border-radius: 2px;
    border: 1px solid var(--btn-bg);
    cursor: pointer;
    font-size: 1rem;
  }
  .cta:is(:hover, :focus-visible) {
    background: var(--btn-fg);
    color: var(--btn-bg);
    outline: none;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 4px;
  }
  /* buttons on light surfaces: dark fill, invert on hover */
  .cta-on-light {
    --btn-bg: #0e0e10;
    --btn-fg: #F2E0C2;
  }
  .cta-icon {
    width: 1.05em;
    height: 1.05em;
    fill: currentColor;
  }

  /* section titles & rules --------------------------------------------- */
  .section-title {
    font-family: "Noto Sans", sans-serif;
    font-weight: 400;
    text-align: left;
    margin: 4rem 0 2rem;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  :is(.section-title, .differentiator h2)::before {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent);
    margin-right: 0.75rem;
    vertical-align: -0.12em;
    box-shadow: 0 0 8px rgba(127, 163, 207, 0.5);
  }
  .rule {
    height: 6px;
    margin: 3.5rem 0;
    background:
      linear-gradient(90deg, transparent 0% 55%, var(--accent) 55% 67%, transparent 67% 78%, var(--accent2) 78% 90%, transparent 90% 100%),
      repeating-conic-gradient(var(--fg) 0% 25%, transparent 0% 50%);
    background-size: 100% 100%, 6px 6px;
  }
  .startline {
    height: 6px;
    margin: 3rem 0 4rem;
    background:
      linear-gradient(90deg, transparent 0% 55%, var(--accent) 55% 67%, transparent 67% 78%, var(--accent2) 78% 90%, transparent 90% 100%),
      repeating-conic-gradient(var(--fg) 0% 25%, transparent 0% 50%);
    background-size: 100% 100%, 6px 6px;
  }

  /* columns & differentiator -------------------------------------------- */
  .columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
  }
  .columns-five {
    grid-template-columns: repeat(5, 1fr);
  }
  .columns-five .column { padding: 0 1rem; }
  .columns-five .column:first-child { padding-left: 0; }
  .columns-five .column:last-child { padding-right: 0; }
  .columns-five .column h2 { font-size: 0.9rem; }
  .columns-five .column p { font-size: 0.8rem; line-height: 1.5; }
  .column {
    padding: 0 1.5rem;
    border-left: 1px solid var(--line);
  }
  .column:first-child { border-left: 0; padding-left: 0; }
  .column:last-child { padding-right: 0; }
  @media (max-width: 48rem) {
    .columns, .columns-five { grid-template-columns: 1fr; }
    .column {
      border-left: 0;
      border-top: 1px solid var(--line);
      padding: 1rem 0 0;
    }
    .column:first-child { border-top: 0; padding-top: 0; }
  }
  .column h2 {
    font-family: "Noto Sans", sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
  }
  .column p { font-size: 0.9rem; line-height: 1.55; }

  .differentiator {
    margin-top: 2.5rem;
  }
  .differentiator h2 {
    font-family: "Noto Sans", sans-serif;
    font-weight: 400;
    font-size: 1.3rem;
    margin-bottom: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .differentiator p { margin-top: 1rem; }
  .differentiator p:first-of-type { margin-top: 0; }

  /* client logos -------------------------------------------------------- */
  .clients-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
  }
  .clients-logos a {
    display: inline-flex;
    align-items: center;
  }
  .clients-logos a:hover { opacity: 0.82; }
  /* group focus: dim siblings while one is hovered */
  .clients-logos:has(a:hover) a:not(:hover) { opacity: 0.6; }
  :is(.clients-logos img, footer .parent img) { filter: var(--logo-filter); }
  .clients-logos img { height: 1.5rem; width: auto; }
  .clients-logos img.blockpqr { height: 2rem; }
  .clients-logos img.origin { height: 1.1rem; }

  /* engage — email-only */
  /* case studies --------------------------------------------------------- */
  .cases {
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
  }
  .case {
    container-type: inline-size;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--line);
  }
  .case:last-child { border-bottom: 0; padding-bottom: 0; }
  .case-num {
    font-family: "Noto Sans Mono", monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent2);
  }
  .case-title {
    font-family: "Noto Sans", sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    margin: 0.5rem 0 1rem;
  }
  .case-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .case-cell {
    border-left: 0;
    padding-left: 0;
  }
  /* three columns when the case itself is wide enough */
  @container (min-width: 40rem) {
    .case-grid { grid-template-columns: repeat(3, 1fr); }
    .case-cell {
      border-left: 1px solid var(--line);
      padding-left: 1rem;
    }
    .case-cell:first-child { border-left: 0; padding-left: 0; }
  }
  .case-label {
    font-family: "Noto Sans Mono", monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg);
    margin-bottom: 0.5rem;
  }
  .case-cell p { font-size: 0.9rem; }
  .case-metrics {
    font-family: "Noto Sans Mono", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 1.5rem;
    font-variant-numeric: tabular-nums;
  }

  /* fallback for browsers without container queries */
  @media (min-width: 48rem) {
    .case-grid { grid-template-columns: repeat(3, 1fr); }
    .case-cell {
      border-left: 1px solid var(--line);
      padding-left: 1rem;
    }
    .case-cell:first-child { border-left: 0; padding-left: 0; }
  }

}

/* ---------------------------------------------------------------- utilities */

@layer utilities {
  /* the accents — apply freely to any element */
  .accent-v { color: var(--accent); }
  .accent-i { color: var(--accent2); }
  .accent-j { color: var(--jade); }
  /* accent ticks for titles: pair with .section-title or any heading */
  .tick-v::before { background: var(--accent); }
  .tick-i::before { background: var(--accent2); }
  .tick-j::before { background: var(--jade); }
  /* all links — jade at rest, vermilion on hover */
  a:not(.cta):not(nav a) { color: var(--jade); }
  a:not(.cta):not(nav a):hover { color: var(--accent); }
}
