/* testandwin.net: shared styles */

:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --ink: #26282b;
  --ink-soft: #55595e;
  --graphite: #5a5a5a;
  --lime: #95c11f;
  --lime-ink: #4f6b0a;
  --rule: #dfe3dc;
  --grid: rgba(90, 90, 90, 0.07);
  --pass: #4f8a10;
  --focus: #6f9a0e;

  --font-display: "Saira", "Eurostile", "Arial Narrow", sans-serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: 2.375rem;
  --step-4: clamp(2.75rem, 6vw, 4.75rem);

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 68ch;
  --max: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191b;
    --surface: #1f2224;
    --ink: #e8eae6;
    --ink-soft: #a9ada7;
    --graphite: #c9ccc6;
    --lime-ink: #b4dc45;
    --rule: #33373a;
    --grid: rgba(220, 225, 215, 0.05);
    --pass: #a6d63a;
    --focus: #b4dc45;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17191b;
  --surface: #1f2224;
  --ink: #e8eae6;
  --ink-soft: #a9ada7;
  --graphite: #c9ccc6;
  --lime-ink: #b4dc45;
  --rule: #33373a;
  --grid: rgba(220, 225, 215, 0.05);
  --pass: #a6d63a;
  --focus: #b4dc45;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration-color: var(--lime); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--lime-ink); }

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); letter-spacing: 0; }

p { margin: 0 0 1em; max-width: var(--measure); }

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

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* ---------- Header ---------- */

.site-header { border-bottom: 1px solid var(--rule); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 76px; flex-wrap: wrap; }

.brand { display: block; line-height: 0; }
.brand img { width: 168px; height: auto; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo-light { display: none; }
  :root:not([data-theme="light"]) .brand .logo-dark { display: block; }
}
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }

.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; padding: 0; }
.site-nav a { text-decoration: none; font-size: var(--step--1); font-weight: 500; color: var(--ink-soft); padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--lime); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--lime); }

@media (max-width: 640px) {
  .site-header .wrap { padding-block: 14px; }
  .brand img { width: 140px; }
  .site-nav ul { gap: 2px 16px; }
}

/* ---------- Sections ---------- */

main { display: block; }
.section { padding-block: clamp(56px, 8vw, 104px); }
.section + .section { border-top: 1px solid var(--rule); }

.lead { font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); max-width: 58ch; }

.page-head { padding-block: clamp(48px, 7vw, 88px) clamp(24px, 4vw, 40px); }
.page-head p { color: var(--ink-soft); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; letter-spacing: 0.01em;
  text-decoration: none; padding: 12px 22px; border: 2px solid var(--ink); color: var(--ink); background: transparent;
  transition: background-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-primary { background: var(--lime); border-color: var(--lime); color: #1c2406; }
.btn-primary:hover { background: #a9d62e; border-color: #a9d62e; color: #1c2406; }
.btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* ---------- Project list (used on home) ---------- */

.projects { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.project { border-bottom: 1px solid var(--rule); }
.project a {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) 11rem; gap: 8px 32px; align-items: baseline;
  padding: 26px 0; text-decoration: none; color: inherit;
}
.project a:hover h3 { color: var(--lime-ink); }
.project h3 { margin: 0; font-size: var(--step-2); }
.project p { margin: 0; color: var(--ink-soft); }
.project .meta { font-size: var(--step--1); color: var(--ink-soft); text-align: right; }
@media (max-width: 760px) { .project .meta { text-align: left; } }
@media (max-width: 760px) {
  .project a { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--rule); padding-block: 40px; font-size: var(--step--1); color: var(--ink-soft); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; }
.site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- Prose (imprint, long text) ---------- */

.prose { max-width: var(--measure); }
.prose h2 { font-size: var(--step-2); margin-top: 1.8em; }
.prose h3 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .25em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
