/* =========================================================================
   Christian Laggner Chemistry Consulting — shared design system
   Palette: PATINA — dark blue ground, teal primary, gold mid, ember spark.
   Dark is the default theme; light (warm paper) via [data-theme="light"].
   Type: Exo 2 (display) / IBM Plex Sans (body) / IBM Plex Mono (data).
   ========================================================================= */

/* ---- Tokens: dark Patina is the default ground ---- */
:root {
  --bg:        #0A1A2B;
  --bg-elev:   #122A40;
  --text:      #EBF2F0;
  --text-dim:  #93A6AE;
  --border:    rgba(140, 180, 185, 0.22);
  --border-2:  rgba(140, 180, 185, 0.12);
  --brand:     #25BBAF;   /* patina teal */
  --brand-ink: #A9E6DF;
  --spark:     #F0883A;   /* ember */
  --umber:     #A07E44;   /* aged gold */
  --canvas-node: #2AC2B4;
  --canvas-mid:  #E7B23E;
  --canvas-spark:#F0883A;
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 12px 40px rgba(0,0,0,.45);

  --maxw: 1120px;
  --textw: 66ch;
  --step--1: clamp(.82rem, .8rem + .1vw, .9rem);
  --step-0:  clamp(1rem, .96rem + .2vw, 1.125rem);
  --step-1:  clamp(1.2rem, 1.1rem + .5vw, 1.45rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2.1rem);
  --step-3:  clamp(2.1rem, 1.7rem + 2.2vw, 3.4rem);
  --step-4:  clamp(2.8rem, 2rem + 4.2vw, 5.2rem);
  --font-display: "Exo 2", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* Explicit light toggle: warm paper ground, same Patina accents */
:root[data-theme="light"] {
  --bg:#F4F1EA; --bg-elev:#FBF9F4; --text:#1B2530; --text-dim:#5B6470;
  --border:rgba(70,65,55,.20); --border-2:rgba(70,65,55,.10);
  --brand-ink:#0B4F4D;
  --shadow:0 1px 2px rgba(20,30,45,.06),0 8px 30px rgba(20,30,45,.06);
}

/* ---- Reset-ish ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .4s ease, color .4s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---- Layout helpers ---- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 3rem); }
.section { padding-block: clamp(3.5rem, 8vw, 7rem); }
.prose { max-width: var(--textw); }
.prose p { margin: 0 0 1.1em; color: var(--text-dim); }
.prose p strong { color: var(--text); font-weight: 600; }

/* ---- Type ---- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.08; text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--step-4); font-optical-sizing: auto; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); font-weight: 600; letter-spacing: 0; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--brand);
  font-weight: 500;
  margin: 0 0 1.1rem;
  display: flex; align-items: center; gap: .7rem;
}
.eyebrow::before { content:""; width: 1.6rem; height: 1px; background: currentColor; opacity:.6; }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--text); max-width: 40ch; font-weight: 400; }

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border-2);
}
.nav__in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .85rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 600; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand__name { font-size: .98rem; }
.brand__name b { font-weight: 600; }
.brand__name span { color: var(--text-dim); font-weight: 400; }
.nav__links { display: flex; align-items: center; gap: clamp(.9rem, 2vw, 1.8rem); }
.nav__links a { text-decoration: none; color: var(--text-dim); font-size: .92rem; transition: color .2s; }
.nav__links a:hover { color: var(--text); }
.nav__links .navcta {
  color: var(--bg); background: var(--brand); padding: .5rem .9rem; border-radius: 999px; font-weight: 500;
}
.nav__links .navcta:hover { color: var(--bg); filter: brightness(1.06); }
.theme-toggle {
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; display: grid; place-items: center;
  transition: color .2s, border-color .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--brand); }
@media (max-width: 620px) { .nav__hideable { display: none; } }

/* ---- Hero ---- */
.hero { position: relative; overflow: clip; border-bottom: 1px solid var(--border-2); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(52% 60% at 74% 32%, color-mix(in srgb, var(--brand) 26%, transparent), transparent 68%),
    radial-gradient(40% 50% at 88% 80%, color-mix(in srgb, var(--spark) 12%, transparent), transparent 70%); }
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 55%, transparent 100%); }
.hero__in { position: relative; z-index: 1; padding-block: clamp(4.5rem, 13vw, 9rem); }
.hero h1 { max-width: 15ch; }
.hero .lede { margin-top: 1.5rem; }
.hero__meta { margin-top: 2.4rem; display: flex; flex-wrap: wrap; gap: .6rem .5rem; align-items: center; }
.tag {
  font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: .02em;
  border: 1px solid var(--border); border-radius: 999px; padding: .34rem .8rem; color: var(--text-dim);
  background: color-mix(in srgb, var(--bg-elev) 60%, transparent);
}
.hero__cta { margin-top: 2.4rem; display: flex; gap: .8rem; flex-wrap: wrap; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; text-decoration: none;
  padding: .8rem 1.3rem; border-radius: 999px; font-size: .98rem; transition: transform .15s, filter .2s, background .2s, color .2s, border-color .2s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: var(--bg); }
.btn--primary:hover { filter: brightness(1.07); }
.btn--ghost { border: 1px solid var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--spark { background: var(--spark); color: #fff; }
.btn--spark:hover { filter: brightness(1.05); }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
  background: var(--border-2); border: 1px solid var(--border-2); border-radius: 14px; overflow: hidden; }
.stat { background: var(--bg); padding: 1.5rem 1.4rem; }
.stat__n { font-family: var(--font-display); font-size: var(--step-2); font-weight: 500; line-height: 1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; }
.stat__n b { color: var(--brand); font-weight: 500; }
.stat__n b { text-shadow: 0 0 26px color-mix(in srgb, var(--brand) 55%, transparent); }
:root[data-theme="light"] .stat__n b { text-shadow: none; }
.stat__l { margin-top: .55rem; font-size: var(--step--1); color: var(--text-dim); line-height: 1.4; }
/* compact centered 2×2 variant (Who I am) */
.stats--2x2 { grid-template-columns: repeat(2, 1fr); max-width: 26rem; }
.stats--2x2 .stat { text-align: center; padding: 1.3rem 1rem; }
@media (max-width: 820px) { .stats--2x2 { margin-inline: auto; } }

/* ---- Section header ---- */
.sec-head { max-width: 52ch; margin-bottom: clamp(2rem, 5vw, 3.2rem); }
.sec-head h2 { margin-bottom: 1rem; }
.sec-head p { color: var(--text-dim); font-size: var(--step-1); line-height: 1.5; margin: 0; }

/* ---- Service cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 1.1rem; }
.card { background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 16px; padding: 1.7rem 1.6rem;
  display: flex; flex-direction: column; gap: .8rem; transition: transform .2s, border-color .2s, box-shadow .3s; }
.card:hover { transform: translateY(-3px); border-color: var(--border); box-shadow: var(--shadow); }
.card__ic { width: 40px; height: 40px; color: var(--brand); }
.card h3 { }
.card p { margin: 0; color: var(--text-dim); font-size: .96rem; }
.card__no { font-family: var(--font-mono); font-size: var(--step--1); color: var(--brand); letter-spacing: .1em; }

/* ---- Highlight band (AI navigator) ---- */
.band { background: var(--bg-elev); border-block: 1px solid var(--border-2); position: relative; overflow: clip; }
.band__in { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
.band .eyebrow { color: var(--spark); }
.band h2 { margin-bottom: 1rem; }
.band p { color: var(--text-dim); font-size: var(--step-1); line-height: 1.5; margin: 0 0 1.6rem; }
@media (max-width: 760px) { .band__in { grid-template-columns: 1fr; } }

/* ---- Two-col about ---- */
.split { display: grid; grid-template-columns: 1fr 1.3fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }
.split__side .eyebrow { margin-bottom: 1.4rem; }
.side-portrait { aspect-ratio: 4/5; border-radius: 16px; overflow: hidden; margin: 0;
  border: 1px solid var(--border-2); position: relative; box-shadow: var(--shadow);
  background: radial-gradient(120% 120% at 20% 10%, color-mix(in srgb, var(--brand) 22%, var(--bg-elev)) 0%, var(--bg-elev) 55%); }
.side-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block;
  filter: saturate(1.02) contrast(1.02); }
.side-portrait::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, color-mix(in srgb, var(--bg) 55%, transparent) 100%),
    radial-gradient(120% 90% at 80% 8%, color-mix(in srgb, var(--brand) 20%, transparent), transparent 55%);
  mix-blend-mode: normal; }
:root:not([data-theme="light"]) .side-portrait img { filter: saturate(1.03) contrast(1.03) brightness(.98); }

/* ---- Timeline / track record ---- */
.track { display: flex; flex-direction: column; gap: 0; }
.trk { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1.4rem; padding-block: 1.4rem; border-top: 1px solid var(--border-2); }
.trk:last-child { border-bottom: 1px solid var(--border-2); }
.trk__when { font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-dim); padding-top: .2rem; letter-spacing: .02em; }
.trk__role { font-weight: 600; font-size: var(--step-0); }
.trk__org { color: var(--brand); font-weight: 500; }
.trk__desc { color: var(--text-dim); font-size: .96rem; margin-top: .3rem; max-width: 60ch; }
@media (max-width: 620px) { .trk { grid-template-columns: 1fr; gap: .3rem; } }

/* ---- Tools marquee-ish list ---- */
.tools { display: flex; flex-wrap: wrap; gap: .5rem; max-width: 70ch; }
.tools span { font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-dim);
  border: 1px solid var(--border-2); border-radius: 8px; padding: .3rem .6rem; }
.tools span.k { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }

/* ---- Proof / logos-as-text ---- */
.proof { display: flex; flex-wrap: wrap; gap: 1.4rem 2.2rem; align-items: baseline; }
.proof span { font-family: var(--font-display); font-size: var(--step-1); color: var(--text); opacity: .82; }
.proof .muted { color: var(--text-dim); font-family: var(--font-body); font-size: .9rem; }
/* single-line variant: shrinks type as the viewport narrows; on phones it may
   wrap (centered) rather than overflow the section sideways */
.proof--one { flex-wrap: nowrap; white-space: nowrap; gap: .8rem; }
.proof--one span { font-size: clamp(.9rem, .55rem + 1.4vw, var(--step-1)); }
.proof--one .muted { font-size: clamp(.72rem, .5rem + .9vw, .9rem); }
@media (max-width: 640px) {
  .proof--one { flex-wrap: wrap; white-space: normal; justify-content: center; row-gap: .15rem; text-align: center; }
}

/* ---- Contact / footer ---- */
.contact { border-top: 1px solid var(--border-2); }
.contact__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(1.5rem,4vw,3rem); align-items: end; }
@media (max-width: 700px){ .contact__grid { grid-template-columns: 1fr; align-items: start; } }
.contact h2 { margin-bottom: 1.2rem; }
.contact__links { display: flex; flex-direction: column; gap: .6rem; font-family: var(--font-mono); font-size: .95rem; }
.contact__links a { color: var(--spark); text-decoration: none; display: inline-flex; gap: .6rem; align-items: center; width: fit-content; border-bottom: 1px solid transparent; transition: border-color .2s, color .2s, filter .2s; }
.contact__links a:hover { border-color: var(--spark); filter: brightness(1.12); }
.contact__links .lbl { color: var(--text-dim); }
footer.foot { border-top: 1px solid var(--border-2); padding-block: 2rem; }
.foot__in { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
  font-size: .85rem; color: var(--text-dim); font-family: var(--font-mono); }
.foot__in a { color: var(--text-dim); text-decoration: none; }
.foot__in a:hover { color: var(--brand); }

/* Availability note */
.avail { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-mono); font-size: var(--step--1);
  color: var(--text-dim); }
.avail .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--brand);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 60%, transparent); animation: pulse 2.6s infinite; }
@keyframes pulse { 0%{ box-shadow:0 0 0 0 color-mix(in srgb,var(--brand) 55%,transparent);} 70%{ box-shadow:0 0 0 8px transparent;} 100%{ box-shadow:0 0 0 0 transparent;} }
@media (prefers-reduced-motion: reduce){ .avail .dot { animation: none; } }

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce){ .reveal { opacity: 1; transform: none; transition: none; } }

/* focus */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }

/* version switcher (mockup only) */
.vswitch { position: fixed; z-index: 100; bottom: 1.1rem; left: 50%; transform: translateX(-50%);
  display: flex; gap: .3rem; background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  border: 1px solid var(--border); border-radius: 999px; padding: .3rem; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.vswitch a { text-decoration: none; font-family: var(--font-mono); font-size: .8rem; color: var(--text-dim);
  padding: .4rem .85rem; border-radius: 999px; }
.vswitch a.on { background: var(--brand); color: var(--bg); }
