/* Minimal stylesheet for the Klarshelf public pages. No build step, no external requests. */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5c5f62;
  --line: #e3e3e3;
  --accent: #1f5f4f;
  --accent-fg: #ffffff;
  --accent-bg: #eaf3f0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --fg: #ececec;
    --muted: #a9adb4;
    --line: #2a2e35;
    --accent: #7fd1bb;
    /* The dark-mode accent is light, so button text has to be dark to stay readable. */
    --accent-fg: #10231e;
    --accent-bg: #1b2a27;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

.wrap { max-width: 44rem; margin: 0 auto; padding: 2.5rem 16px 4rem; }

header.site { border-bottom: 1px solid var(--line); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; padding: 1rem 16px; gap: 1rem; }
.brand { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; color: var(--fg); }
nav a { color: var(--muted); text-decoration: none; margin-left: 1rem; font-size: 0.95rem; }
nav a:hover, .brand:hover { color: var(--accent); }

h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1.5rem 0 0.35rem; }
p, li { color: var(--fg); }
.lede { font-size: 1.15rem; color: var(--muted); margin-top: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }

ul { padding-left: 1.2rem; }
li { margin: 0.35rem 0; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.95rem; }
th, td { border: 1px solid var(--line); padding: 0.5rem 0.65rem; text-align: left; vertical-align: top; }
th { background: var(--accent-bg); }

code { background: var(--accent-bg); padding: 0.1rem 0.3rem; border-radius: 4px; font-size: 0.9em; }

.card { border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; margin: 1.25rem 0; }
.cta { display: inline-block; background: var(--accent); color: var(--accent-fg); padding: 0.6rem 1.1rem; border-radius: 8px; text-decoration: none; font-weight: 600; }
.cta:hover { opacity: 0.92; }

footer.site { border-top: 1px solid var(--line); margin-top: 3rem; }
footer.site .wrap { padding: 1.25rem 16px; display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: space-between; color: var(--muted); font-size: 0.9rem; }
footer.site a { color: var(--muted); }

/* Language picker in the header. A <details> element: it opens without JavaScript and every
   translation stays a real link. */
nav { display: flex; align-items: center; }
.langs { position: relative; margin-left: 1rem; }
.langs > summary {
  list-style: none; cursor: pointer; color: var(--muted); font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.langs > summary::-webkit-details-marker { display: none; }
.langs > summary::after {
  content: ""; width: 0.38em; height: 0.38em; margin-top: -0.2em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
}
.langs[open] > summary::after { margin-top: 0.15em; transform: rotate(-135deg); }
.langs > summary:hover { color: var(--accent); }
.langs > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.langs-menu {
  position: absolute; right: 0; top: calc(100% + 0.6rem); z-index: 20;
  display: grid; min-width: 9.5rem; padding: 0.35rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}
.langs-menu a, .langs-menu span {
  margin: 0; padding: 0.4rem 0.6rem; border-radius: 6px; white-space: nowrap; font-size: 0.95rem;
}
.langs-menu a:hover { background: var(--accent-bg); color: var(--accent); }
.langs-menu [aria-current="true"] { color: var(--fg); font-weight: 600; }
table th { white-space: nowrap; }

/* FAQ: one question per block, readable line length, no JavaScript needed to open an answer */
.qa { border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 1.6rem; }
.qa:first-of-type { border-top: none; }
.qa h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.qa p { margin: 0; max-width: 64ch; }

/* Free audit page. The only interactive page on the site, so it carries the only animation. */
:root { --sev-high: #b23c2e; --sev-medium: #b8860b; --sev-low: #5c5f62; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --sev-high: #e98a7c; --sev-medium: #e0b96b; --sev-low: #a9adb4; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.audit-form { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.5rem 0 0.5rem; }
.audit-form input {
  flex: 1 1 18rem; min-width: 0; font: inherit; color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.9rem;
}
.audit-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.audit-form button {
  font: inherit; font-weight: 600; cursor: pointer; border: none; border-radius: 10px;
  padding: 0.7rem 1.3rem; background: var(--accent); color: var(--accent-fg);
}
.audit-form button:disabled { opacity: 0.55; cursor: progress; }

.audit-status { margin: 1rem 0; color: var(--muted); }
.audit-status.running::before {
  content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.5em;
  border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite; vertical-align: baseline;
}
.audit-status.error { color: var(--sev-high); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .audit-status.running::before { animation: none; } }

.audit-head {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  margin: 2rem 0 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-bg), transparent 70%);
}
.audit-head-text h2 { margin: 0; font-size: 1.35rem; overflow-wrap: anywhere; }
.audit-head-text p { margin: 0.3rem 0 0; }

.score-ring { position: relative; width: 92px; height: 92px; flex: none; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 10; }
.ring-value {
  fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round;
  transition: stroke-dashoffset 0.9s ease;
}
.ring-value[data-band="fair"] { stroke: var(--sev-medium); }
.ring-value[data-band="poor"] { stroke: var(--sev-high); }
@media (prefers-reduced-motion: reduce) { .ring-value { transition: none; } }
.score-number {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

.finding { border-left: 3px solid var(--sev-low); padding: 0.1rem 0 0.1rem 0.9rem; margin: 1.1rem 0; }
.finding.sev-high { border-left-color: var(--sev-high); }
.finding.sev-medium { border-left-color: var(--sev-medium); }
.finding h3 { margin: 0 0 0.25rem; font-size: 1.02rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.finding p { margin: 0; color: var(--muted); max-width: 64ch; }
.pill {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 999px; padding: 0.1rem 0.5rem; color: var(--sev-low);
}
.sev-high .pill { color: var(--sev-high); }
.sev-medium .pill { color: var(--sev-medium); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.cta-secondary { text-decoration: none; font-weight: 600; color: var(--accent); border-bottom: 1px solid currentColor; }

/* Narrow screens: the header wraps instead of pushing the language picker off the edge */
@media (max-width: 560px) {
  header.site .wrap { flex-wrap: wrap; gap: 0.35rem 0.5rem; }
  nav { flex-wrap: wrap; justify-content: flex-end; }
  nav a { margin-left: 0.85rem; font-size: 0.9rem; }
  .langs { margin-left: 0.85rem; }
  .langs > summary { font-size: 0.9rem; }
}
