/* ── Systemsoft — "Editorial ink" ────────────────────────────────────────
   Calm, spacious company site. Warm-neutral paper ground, deep teal accent,
   serif display headings on a humanist-sans body. Light-first, with a fully
   designed dark theme. Theme-aware via tokens: :root defines light, the
   prefers-color-scheme media query provides the OS-dark default, and the
   [data-theme] attribute (set by the header toggle) wins in both directions.

   Built to be the proof of its own pitch: WCAG 2.1 AA contrast, visible focus
   states, semantic landmarks, fully readable without JavaScript. js/app.js is
   pure enhancement. */

/* ── tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg: #f4f4f1;
  --bg-soft: #ecece6;
  --bg-card: #fbfbf9;
  --ink: #1b1e24;
  --dim: #545860;
  --faint: #83867f;
  --line: #dad9d2;
  --acc: #0d5a52;
  --acc-ink: #ffffff;
  --acc-link: #0a4f48;
  --acc-soft: rgba(13, 90, 82, 0.08);
  --ok: #0d7a54;
  --err: #b5361f;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1120px;
  --rad: 8px;
  --rad-lg: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a; --bg-soft: #1c1e21; --bg-card: #1e2023;
    --ink: #eceae4; --dim: #a2a49c; --faint: #71746d; --line: #2a2c2c;
    --acc: #58c8b7; --acc-ink: #0a1614; --acc-link: #74d4c3; --acc-soft: rgba(88, 200, 183, 0.12);
    --ok: #58c8a0; --err: #ff9a86;
  }
}
:root[data-theme="light"] {
  --bg: #f4f4f1; --bg-soft: #ecece6; --bg-card: #fbfbf9;
  --ink: #1b1e24; --dim: #545860; --faint: #83867f; --line: #dad9d2;
  --acc: #0d5a52; --acc-ink: #ffffff; --acc-link: #0a4f48; --acc-soft: rgba(13, 90, 82, 0.08);
  --ok: #0d7a54; --err: #b5361f;
}
:root[data-theme="dark"] {
  --bg: #16171a; --bg-soft: #1c1e21; --bg-card: #1e2023;
  --ink: #eceae4; --dim: #a2a49c; --faint: #71746d; --line: #2a2c2c;
  --acc: #58c8b7; --acc-ink: #0a1614; --acc-link: #74d4c3; --acc-soft: rgba(88, 200, 183, 0.12);
  --ok: #58c8a0; --err: #ff9a86;
}

/* ── base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.62;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--acc-link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
em { font-style: normal; color: var(--acc-link); font-weight: 600; }

h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; letter-spacing: -0.02em; line-height: 1.06; }

:focus-visible { outline: 3px solid var(--acc); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute; left: 0; top: 0; z-index: 200;
  background: var(--acc); color: var(--acc-ink);
  padding: 0.7em 1.1em; font-weight: 700; border-radius: 0 0 var(--rad) 0;
  transform: translateY(-120%);
}
.skip-link:focus { transform: translateY(0); text-decoration: none; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: clamp(1.3rem, 5vw, 3rem);
  padding-right: clamp(1.3rem, 5vw, 3rem);
  width: 100%;
}

/* ── shared type ────────────────────────────────────────────────────── */
.kicker {
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--acc-link);
  margin: 0 0 1.3rem;
}
.section-title { font-size: clamp(2rem, 4.5vw, 3.2rem); margin: 0; text-wrap: balance; }
.section-lead {
  font-family: var(--font-sans);
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
  color: var(--dim);
  max-width: 54ch;
  margin: 1.1rem 0 0;
  line-height: 1.6;
}

/* ── buttons ────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--acc-ink);
  background: var(--acc);
  border: 0;
  border-radius: var(--rad);
  padding: 0.82em 1.5em;
  cursor: pointer;
  transition: filter 0.14s ease, transform 0.14s ease;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-big { font-size: 1.12rem; padding: 0.95em 1.8em; }
.btn-sm { font-size: 0.86rem; padding: 0.6em 1.05em; }
.link-out { font-weight: 700; font-size: 0.98rem; color: var(--acc-link); }

/* ── badges & tags ──────────────────────────────────────────────────── */
.badge {
  display: inline-block; font-family: var(--font-sans);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.32em 0.8em; border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge-experiment { color: var(--acc-link); border-color: color-mix(in srgb, var(--acc) 40%, transparent); background: var(--acc-soft); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 1.3rem 0 0; }
.tags li {
  font-size: 0.82rem; font-weight: 600; color: var(--dim);
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.35em 0.75em;
}

/* ── header ─────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: transform 0.28s ease, background 0.3s ease;
}
.site-header.header-hidden { transform: translateY(-100%); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: var(--header-h); padding-top: 0.5rem; padding-bottom: 0.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 16px; height: 16px; border-radius: 4px; background: var(--acc); box-shadow: inset 0 0 0 3px var(--bg); outline: 1.5px solid var(--acc); }
.brand-name { font-family: var(--font-serif); font-size: 1.32rem; font-weight: 700; letter-spacing: -0.02em; }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; display: flex; gap: 1.6rem; margin: 0; padding: 0; }
.site-nav a { color: var(--dim); font-size: 0.92rem; font-weight: 600; }
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 0.9rem; }
.theme-toggle { width: 38px; height: 38px; border-radius: 50%; background: transparent; border: 1px solid var(--line); display: inline-grid; place-items: center; cursor: pointer; transition: border-color 0.14s ease, background 0.14s ease; }
.theme-toggle:hover { border-color: var(--acc); background: var(--acc-soft); }
.theme-icon { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--ink); background: linear-gradient(90deg, var(--ink) 0 50%, transparent 50% 100%); }
@media (max-width: 760px) { .site-nav { display: none; } .header-inner { gap: 0.8rem; } }

/* ── hero ───────────────────────────────────────────────────────────── */
.hero { padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(2.5rem, 5vw, 4rem); }
.hero-title { max-width: 20ch; font-size: clamp(2.9rem, 8vw, 5.4rem); line-height: 1.0; margin: 0 0 1.4rem; text-wrap: balance; }
.hero-lead { font-size: clamp(1.1rem, 2.2vw, 1.42rem); color: var(--dim); line-height: 1.55; max-width: 46ch; margin: 0 0 2.2rem; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; }

/* ── pillars strip ──────────────────────────────────────────────────── */
.pillars-strip { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.pillars-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.pillar { display: flex; flex-direction: column; gap: 0.35rem; padding: 1.7rem clamp(1rem, 2.2vw, 1.7rem); border-left: 1px solid var(--line); }
.pillar:first-child { border-left: 0; padding-left: 0; }
.pillar-label { font-size: 0.72rem; letter-spacing: 0.13em; text-transform: uppercase; font-weight: 700; color: var(--acc-link); }
.pillar-title { font-size: 1rem; font-weight: 700; color: var(--ink); }
.pillar-note { font-size: 0.82rem; color: var(--dim); }
@media (max-width: 760px) {
  .pillars-grid { grid-template-columns: 1fr 1fr; }
  .pillar { padding: 1.3rem 1.1rem; }
  .pillar:first-child { padding-left: 1.1rem; border-left: 1px solid var(--line); }
  .pillar:nth-child(odd) { border-left: 0; padding-left: 0; }
}
@media (max-width: 440px) {
  .pillars-grid { grid-template-columns: 1fr; }
  .pillar, .pillar:first-child, .pillar:nth-child(odd) { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
  .pillar:first-child { border-top: 0; }
}

/* ── section rhythm ─────────────────────────────────────────────────── */
.section { padding: clamp(3.5rem, 9vh, 7rem) 0; }
.section + .section { border-top: 1px solid var(--line); }

/* ── services ───────────────────────────────────────────────────────── */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; margin-top: clamp(2rem, 4vw, 3rem); }
.service { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--rad-lg); padding: clamp(1.6rem, 2.5vw, 2.1rem); display: flex; flex-direction: column; }
.service-label { font-family: var(--font-serif); font-size: 1.4rem; margin: 0 0 0.7rem; color: var(--ink); }
.service-claim { font-weight: 600; color: var(--ink); margin: 0 0 0.9rem; font-size: 1.02rem; }
.service-body { color: var(--dim); margin: 0 0 1.3rem; font-size: 0.98rem; }
.service-points { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.service-points li { position: relative; padding-left: 1.4rem; font-size: 0.9rem; color: var(--ink); }
.service-points li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 7px; height: 7px; border-radius: 2px; background: var(--acc); }
@media (max-width: 880px) { .services-grid { grid-template-columns: 1fr; } }

/* ── approach ───────────────────────────────────────────────────────── */
.approach { background: var(--bg-soft); }
.principles-grid { list-style: none; margin: clamp(2rem, 4vw, 3rem) 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem 2.4rem; }
.principle { padding-top: 1.4rem; border-top: 2px solid var(--acc); }
.principle-title { font-size: 1.24rem; margin: 0 0 0.5rem; color: var(--ink); }
.principle-body { color: var(--dim); margin: 0; font-size: 0.98rem; }
@media (max-width: 720px) { .principles-grid { grid-template-columns: 1fr; } }

/* ── work / cases ───────────────────────────────────────────────────── */
.work-body { color: var(--dim); margin: 1.2rem 0 0; font-size: 1.05rem; max-width: 60ch; }
.cases-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: clamp(2rem, 4vw, 3rem); }
.case-card {
  display: flex; flex-direction: column; gap: 0.7rem;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--rad-lg);
  padding: 1.5rem; color: var(--ink);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.case-card:hover { text-decoration: none; border-color: var(--acc); transform: translateY(-2px); box-shadow: 0 16px 40px -24px rgba(0,0,0,0.4); }
.case-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.case-title { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 700; }
.case-claim { color: var(--dim); font-size: 0.95rem; flex: 1; }
.case-more { color: var(--acc-link); font-weight: 700; font-size: 0.9rem; margin-top: auto; }
@media (max-width: 880px) { .cases-grid { grid-template-columns: 1fr; } }

/* ── contact ────────────────────────────────────────────────────────── */
.contact-inner { max-width: 620px; }
.contact-form { margin-top: clamp(1.8rem, 3vw, 2.6rem); display: flex; flex-direction: column; gap: 1.2rem; }
.field { display: flex; flex-direction: column; gap: 0.45rem; margin: 0; }
.field label { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.contact-form input, .contact-form textarea {
  font-family: var(--font-sans); font-size: 1rem; color: var(--ink);
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--rad);
  padding: 0.75em 0.9em; width: 100%;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form .btn-big { align-self: flex-start; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 0; padding: 0.85em 1em; border-radius: var(--rad); font-size: 0.95rem; font-weight: 600; }
.form-status[data-tone="ok"] { background: var(--acc-soft); color: var(--acc-link); border: 1px solid var(--acc); }
.form-status[data-tone="err"] { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); border: 1px solid color-mix(in srgb, var(--err) 45%, transparent); }
.contact-fallback { font-size: 0.92rem; color: var(--dim); margin: 0.4rem 0 0; }

/* ── footer ─────────────────────────────────────────────────────────── */
.site-foot { border-top: 1px solid var(--line); background: var(--bg-soft); }
.foot-inner { display: grid; grid-template-columns: 1.6fr 1fr; gap: 2rem; padding-top: clamp(2.5rem, 5vw, 4rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.foot-brand { display: flex; flex-direction: column; gap: 0.4rem; }
.foot-name { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; margin: 0; color: var(--ink); }
.foot-tag { color: var(--dim); margin: 0; font-size: 0.95rem; max-width: 42ch; }
.foot-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.foot-nav a { color: var(--dim); font-weight: 600; font-size: 0.95rem; }
.foot-nav a:hover { color: var(--ink); }
.foot-credit { grid-column: 1 / -1; margin: 1.5rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.85rem; }
@media (max-width: 620px) { .foot-inner { grid-template-columns: 1fr; gap: 1.6rem; } }

/* ── sub-page hero ──────────────────────────────────────────────────── */
.page-hero { padding: clamp(3rem, 7vw, 5rem) 0 clamp(1.6rem, 3vw, 2.6rem); border-bottom: 1px solid var(--line); }
.page-title { font-size: clamp(2.4rem, 6vw, 4rem); margin: 0 0 1rem; text-wrap: balance; }
.page-lead { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--dim); max-width: 58ch; margin: 0; line-height: 1.55; }

/* active nav item */
.site-nav a[aria-current="page"] { color: var(--acc-link); }

/* service teaser (home) */
.service-teaser { color: var(--ink); }
.service-teaser:hover { text-decoration: none; border-color: var(--acc); transform: translateY(-2px); box-shadow: 0 16px 40px -24px rgba(0,0,0,0.4); }
.service-more { color: var(--acc-link); font-weight: 700; font-size: 0.9rem; margin-top: auto; }

/* "more" link after a grid */
.section-more { display: inline-block; margin-top: clamp(1.5rem, 3vw, 2.2rem); }

/* approach teaser + contact band (home) */
.approach-teaser-inner, .contact-band-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem 2.5rem; flex-wrap: wrap;
}
.approach-teaser-inner > div, .contact-band-inner > div { max-width: 58ch; }
.contact-band { background: var(--bg-soft); }
.approach-lead { margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }

/* ── case detail & process pages ────────────────────────────────────── */
.proj-nav { padding: 1.6rem 0 0; }
.proj-nav a { font-weight: 600; font-size: 0.95rem; }
.project { padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(3rem, 6vw, 5rem); }
.proj-hero { padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--line); margin-bottom: clamp(2rem, 4vw, 3rem); }
.proj-hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 1rem; }
.proj-hero .lead { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--dim); margin: 1.2rem 0 0; max-width: 54ch; }
.proj-section { margin: 0 0 clamp(2.5rem, 5vw, 3.5rem); max-width: 70ch; }
.proj-section h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 1rem; }
.proj-section p { color: var(--dim); margin: 0 0 1rem; }
.proj-section p em { color: var(--acc-link); }
.proc-list { color: var(--dim); padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.7rem; }
.proc-list li { padding-left: 0.3rem; }
.proj-media { max-width: 100%; }
.media { margin: 1.5rem 0; }
.media img, .media-video { width: 100%; border-radius: var(--rad-lg); border: 1px solid var(--line); }
.media figcaption { font-size: 0.85rem; color: var(--faint); margin-top: 0.6rem; }
.act-cta { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.5rem; }
.act-links { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: 1rem; }
.use-cases { color: var(--dim); font-style: italic; }

.process-page { padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(3rem, 6vw, 5rem); }
.process-hero { padding: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(2rem, 4vw, 3rem); border-bottom: 1px solid var(--line); margin-bottom: clamp(2rem, 4vw, 3rem); }
.process-hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 1rem; }
.process-hero .lead { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--dim); margin: 0 0 1.5rem; }
.process-intro { font-size: 1.1rem; color: var(--ink); max-width: 62ch; }
.process-body { max-width: 68ch; }
.process-sec { margin: 0 0 clamp(2rem, 4vw, 3rem); }
.process-sec h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 0 0 0.8rem; }
.process-sec p { color: var(--dim); margin: 0; }
.process-cta { margin-top: clamp(2rem, 4vw, 3rem); }
