/* ATS Key design system — see ../../DESIGN_SYSTEM.md */
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

/* 1. Tokens */
:root {
  --bg: #F7F6F2; --bg-2: #EEECE6; --card: #FFFFFF;
  --text: #343631; --text-2: #6B6B63; /* #77776F darkened slightly for 4.5:1 on cards */
  --accent: #A5A18F; --accent-ink: #5E5B4C; --accent-soft: #F1F0EA;
  --border: #E5E2DA; --border-strong: #CFCBC0;
  --ok: #5F7355; --ok-bg: #EEF2EA; --warn: #8A6D3B; --warn-bg: #F7F1E4; --err: #9A4B42; --err-bg: #F8ECEA;
  --focus: #6F7A5C;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* type scale (1.2 minor third) */
  --fs-sm: .875rem; --fs-base: 1.0625rem; --fs-md: 1.25rem; --fs-lg: 1.5rem; --fs-xl: 2rem; --fs-2xl: clamp(2.25rem, 4vw + 1rem, 3.25rem);
  /* spacing scale (4px base) */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(52,54,49,.04), 0 4px 16px rgba(52,54,49,.04);
  --max: 70rem; --measure: 44rem;
  --ease: 160ms ease;
}

/* 2. Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: var(--fs-base); line-height: 1.65; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4, h5 { color: var(--text); line-height: 1.25; margin: 0 0 var(--s3); font-weight: 600; letter-spacing: -.01em; }
h1 { font-family: var(--serif); font-weight: 500; font-size: var(--fs-xl); letter-spacing: -.015em; margin-bottom: var(--s4); }
h2 { font-size: var(--fs-md); }
h3 { font-size: 1.0625rem; margin-top: var(--s5); }
h4, h5 { font-size: 1rem; margin-top: var(--s5); }
p, ul, ol, dl { margin: 0 0 var(--s4); }
p, li { max-width: var(--measure); }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: var(--s1); }
li::marker { color: var(--accent); }
strong { font-weight: 600; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--ease), text-decoration-color var(--ease); }
a:hover { color: var(--accent-ink); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
main:focus, [tabindex="-1"]:focus { outline: none; }
::selection { background: #E2DFD3; }

/* 3. Utilities */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s4); top: -100px; background: var(--text); color: var(--card); padding: var(--s2) var(--s4); border-radius: var(--radius-sm); z-index: 100; text-decoration: none; }
.skip:focus { top: var(--s4); color: var(--card); }
.inline { display: inline; }
.muted, .hint { color: var(--text-2); }
.eyebrow { font-size: var(--fs-sm); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: var(--s3); }
.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--s5); }

/* 4. Header / nav */
header.site { background: rgba(247,246,242,.92); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; backdrop-filter: saturate(140%) blur(8px); }
header.site .container { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 4.25rem; flex-wrap: wrap; }
.brand { margin: 0; display: flex; align-items: baseline; gap: var(--s3); }
.brand a { font-family: var(--serif); font-size: 1.375rem; font-weight: 600; text-decoration: none; letter-spacing: -.01em; }
.brand a::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 2px; background: var(--accent); margin-right: .5rem; transform: translateY(-2px) rotate(45deg); }
.tagline { font-size: var(--fs-sm); color: var(--text-2); }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s5); }
nav li { margin: 0; }
nav a, nav button.linklike { font-size: .9375rem; color: var(--text-2); text-decoration: none; padding: var(--s2) 0; }
nav a:hover, nav button.linklike:hover { color: var(--text); background: none; }
nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -1px 0 var(--accent); }
@media (max-width: 760px) { .tagline { display: none; } header.site { position: static; } header.site .container { padding-top: var(--s3); padding-bottom: var(--s3); } nav ul { gap: var(--s1) var(--s4); } }

/* 5. Main layout + sections as cards */
main { display: block; max-width: var(--max); margin: 0 auto; padding: var(--s7) var(--s5) var(--s8); }
main > h1 + p, .lead { font-size: 1.125rem; color: var(--text-2); max-width: var(--measure); }
main > section, main > form > section, .card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s6); margin: 0 0 var(--s5); }
main > section > section { border-top: 1px solid var(--border); padding-top: var(--s5); margin-top: var(--s5); }
main > section > :last-child, .card > :last-child { margin-bottom: 0; }
@media (max-width: 600px) { main { padding: var(--s6) var(--s4) var(--s7); } main > section, main > form > section, .card { padding: var(--s5); } h1 { font-size: 1.75rem; } }

/* 6. Buttons */
button, a.button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); font: inherit; font-size: .9375rem; font-weight: 500; line-height: 1.2; padding: .8rem 1.35rem; border-radius: var(--radius-sm); border: 1px solid var(--text); background: var(--text); color: var(--bg); cursor: pointer; text-decoration: none; transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease); }
button:hover, a.button:hover { background: #22241F; border-color: #22241F; color: var(--bg); }
button.secondary, a.button.secondary, .actions button + button { background: var(--card); color: var(--text); border-color: var(--border-strong); }
button.secondary:hover, a.button.secondary:hover, .actions button + button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
button.danger { background: var(--card); color: var(--err); border-color: #D9B9B4; }
button.danger:hover { background: var(--err-bg); color: var(--err); border-color: var(--err); }
button[aria-disabled=true] { opacity: .6; cursor: progress; }
button.linklike { background: none; border: 0; padding: 0; font-weight: 400; color: inherit; border-radius: 0; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
form > button, form > .actions { margin-top: var(--s2); }

/* 7. Forms */
.field { display: flex; flex-direction: column; gap: var(--s1); margin: 0 0 var(--s5); max-width: var(--measure); }
label { font-weight: 500; font-size: .9375rem; }
.hint { font-size: var(--fs-sm); line-height: 1.5; margin-bottom: var(--s1); }
input[type=text], input[type=email], input[type=url], input[type=password], textarea, select {
  font: inherit; font-size: 1rem; color: var(--text); width: 100%; padding: .75rem .9rem; background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); transition: border-color var(--ease), box-shadow var(--ease); }
input:hover, textarea:hover { border-color: var(--accent); }
input:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(111,122,92,.18); }
textarea { font-family: var(--mono); font-size: .9rem; line-height: 1.6; resize: vertical; }
input[type=file] { font: inherit; font-size: .9375rem; padding: var(--s4); background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-size: .875rem; margin-right: var(--s3); padding: .5rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--text); cursor: pointer; }
.field.check { flex-direction: row; align-items: flex-start; gap: var(--s3); }
.field.check label { font-weight: 400; }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin-top: .3rem; accent-color: var(--text); flex: none; }

/* 8. Alerts / status */
.notice, .error, .success { border-radius: var(--radius-sm); padding: var(--s3) var(--s4); margin: 0 0 var(--s5); border: 1px solid var(--border); background: var(--accent-soft); border-left: 3px solid var(--accent); max-width: none; }
.error { background: var(--err-bg); border-color: #EBD3CF; border-left-color: var(--err); color: #5A2E28; }
.error p { margin: 0; }
.error p::before { content: "Error: "; font-weight: 600; }
.success, #ready-msg { background: var(--ok-bg); border: 1px solid #DCE4D5; border-left: 3px solid var(--ok); border-radius: var(--radius-sm); padding: var(--s4); max-width: none; }
.badge { display: inline-block; font-size: .8125rem; font-weight: 500; padding: .15rem .55rem; border-radius: 4px; background: var(--bg-2); color: var(--text-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.no { background: var(--warn-bg); color: var(--warn); }

/* 9. Definition lists (facts) */
dl.facts { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: 0; border-top: 1px solid var(--border); }
dl.facts dt, dl.facts dd { padding: var(--s3) 0; border-bottom: 1px solid var(--border); margin: 0; }
dl.facts dt { color: var(--text-2); font-size: .9375rem; padding-right: var(--s4); }
dl.facts dd { overflow-wrap: anywhere; }
@media (max-width: 600px) { dl.facts { grid-template-columns: 1fr; } dl.facts dt { border-bottom: 0; padding-bottom: 0; } }

/* 10. Job list */
ol.jobs { list-style: none; padding: 0; margin: 0 0 var(--s4); display: grid; gap: var(--s3); }
li.job { max-width: none; margin: 0; padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); transition: border-color var(--ease), box-shadow var(--ease); }
li.job:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.jobtitle { font-size: 1.0625rem; margin: 0 0 var(--s2); }
li.job p { color: var(--text-2); font-size: .9375rem; max-width: none; }
.lbl { color: var(--text); font-weight: 500; }
li.job .actions { gap: var(--s4); }
li.job .actions a { font-size: .9375rem; }
li.job button { padding: .6rem 1rem; }

/* 11. Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
caption { text-align: left; color: var(--text-2); font-size: var(--fs-sm); padding: 0 0 var(--s3); }
th, td { text-align: left; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--bg-2); font-weight: 500; font-size: .8125rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
tbody th { font-weight: 500; }
tbody tr:nth-child(even) { background: #FBFAF8; }
tbody tr:last-child > * { border-bottom: 0; }
td.found { color: var(--ok); font-weight: 500; } td.missing { color: var(--warn); font-weight: 500; }

/* 12. Details / pre */
details { margin: var(--s4) 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); padding: 0 var(--s4); }
details[open] { padding-bottom: var(--s4); }
summary { cursor: pointer; font-weight: 500; padding: var(--s3) 0; list-style-position: inside; }
summary:hover { color: var(--accent-ink); }
pre.orig { white-space: pre-wrap; font-family: var(--mono); font-size: .875rem; background: var(--bg); padding: var(--s4); border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 0; }

/* 13. Score meter */
.score { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; margin-bottom: var(--s4); }
.score-num { font-family: var(--serif); font-size: 3rem; line-height: 1; font-weight: 500; }
.meter { flex: 1 1 14rem; height: 8px; background: var(--bg-2); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* 14. Steps */
.steps { list-style: none; padding: 0; margin: 0 0 var(--s4); display: flex; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-2); flex-wrap: wrap; }
.steps li { margin: 0; display: flex; align-items: center; gap: var(--s2); }
.steps li + li::before { content: ""; width: 1.5rem; height: 1px; background: var(--border-strong); }
.steps li[aria-current] { color: var(--text); font-weight: 500; }

/* 15. Home */
.hero { padding: var(--s6) 0 var(--s7); max-width: 46rem; }
.hero h1 { font-size: var(--fs-2xl); line-height: 1.1; margin-bottom: var(--s5); }
.hero .lead { font-size: 1.1875rem; margin-bottom: var(--s6); }
.hero .actions { gap: var(--s4); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--s4); margin: 0 0 var(--s6); padding: 0; list-style: none; }
.features li { max-width: none; margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s5); }
.features .num { font-family: var(--serif); font-size: 1.25rem; color: var(--accent-ink); display: block; margin-bottom: var(--s3); }
.features h2 { font-size: 1.0625rem; margin-bottom: var(--s2); }
.features p { color: var(--text-2); font-size: .9375rem; margin: 0; }
main > section.plan { display: flex; justify-content: space-between; align-items: center; gap: var(--s5); flex-wrap: wrap; background: var(--bg-2); box-shadow: none; }
.price { font-family: var(--serif); font-size: 2rem; }
.auth { max-width: 28rem; margin: 0 auto; }
.auth form { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s6); }
.auth form button[type=submit] { width: 100%; margin-bottom: var(--s4); }
.auth form > p:last-child { margin: 0; color: var(--text-2); font-size: .9375rem; text-align: center; max-width: none; }
.prose { max-width: var(--measure); }
.prose h2 { margin-top: var(--s6); }

/* 16. Footer */
footer.site { border-top: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: var(--fs-sm); }
footer.site .container { padding-top: var(--s6); padding-bottom: var(--s6); display: grid; gap: var(--s4) var(--s7); grid-template-columns: 2fr 1fr; }
footer.site p { margin: 0; }
footer.site nav ul { justify-content: flex-end; gap: var(--s4); }
footer.site nav a { font-size: var(--fs-sm); }
@media (max-width: 760px) { footer.site .container { grid-template-columns: 1fr; } footer.site nav ul { justify-content: flex-start; } }

.testbanner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #EADFC8; padding: var(--s2) var(--s5); text-align: center; font-size: var(--fs-sm); margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { header.site, footer.site, .actions, .skip { display: none; } body { background: #fff; } main > section { box-shadow: none; border: 0; padding: 0; } }
