/* Zone tools: shared by /zone-diff/ and /zone-review/.
   Base layout shared with the other browser-only tools. CSP-clean: no inline styles. */

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: optional;
}
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-v20-latin-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: optional;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('/fonts/playfair-display-v40-latin-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: optional;
}

:root {
  --bg: #f3f3f7;
  --bg2: #ebebee;
  --bg3: #e4e4e4;
  --accent: #0066cc;
  --accent2: #1a7add;
  --text: #191a1f;
  --muted: #66656a;
  --border: rgba(1,1,8,0.1);
  --border-accent: rgba(0,102,204,0.3);
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;

  --content: 760px;   /* single content column width */

  --ok: #0c6b3d;
  --ok-bg: rgba(15,138,79,0.08);
  --warn: #8a5200;
  --warn-bg: rgba(217,119,6,0.08);
  --neutral: #55555c;
  --neutral-bg: rgba(85,85,92,0.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  font-size: 1rem;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 0.08em 0.4em;
  border-radius: 4px;
  word-break: break-word;
}

.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-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 0.6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* NAV */
nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  padding: 1rem 2rem;
  background: rgba(248,248,250,0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav-logo {
  font-family: var(--serif); font-weight: 700; font-size: 1.05rem;
  letter-spacing: 0.05em; color: var(--text); text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  list-style: none; display: flex; gap: 1.4rem; flex-wrap: wrap;
  margin: 0; padding: 0; align-items: center;
}
.nav-links a {
  color: var(--muted); text-decoration: none; font-size: 0.82rem;
  letter-spacing: 0.02em; transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* CONTENT COLUMN — left-aligned, narrow, utilitarian */
main {
  max-width: var(--content);
  margin: 0 auto;
  padding: 2.6rem 1.5rem 3rem;
}

.tool h1 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15;
  letter-spacing: -0.02em; margin: 0 0 0.8rem;
}
.tool .intro {
  font-size: 0.96rem; color: var(--muted); margin: 0 0 1.8rem; max-width: 66ch;
}
.tool .intro strong { color: var(--text); font-weight: 600; }

.btn-primary {
  display: inline-block; text-decoration: none; cursor: pointer;
  font-family: var(--sans); font-size: 0.9rem; font-weight: 600;
  letter-spacing: 0.02em; padding: 0.62rem 1.4rem; border-radius: 6px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }

/* ABOUT + FAQ — kept compact and below the tool */
.about { margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 2.4rem; }
.about h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(1.25rem, 2.5vw, 1.55rem); line-height: 1.2;
  margin: 0 0 1rem; letter-spacing: -0.01em;
}
.about h2:not(:first-child) { margin-top: 2.4rem; }
.about p { font-size: 0.94rem; color: #3a3a40; line-height: 1.8; margin: 0 0 1rem; max-width: 68ch; }
.about p em { color: var(--text); font-style: italic; }

.faq { display: grid; gap: 0.7rem; margin-top: 0.4rem; }
.faq details {
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; padding: 0.1rem 1.1rem;
}
.faq summary {
  cursor: pointer; padding: 0.85rem 0; font-weight: 600; font-size: 0.93rem;
  list-style: none; position: relative; padding-right: 1.5rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; position: absolute; right: 0; top: 0.75rem;
  color: var(--accent); font-size: 1.2rem; line-height: 1;
}
.faq details[open] summary::after { content: '\2212'; }
.faq details p { margin: 0 0 0.9rem; font-size: 0.89rem; color: var(--muted); line-height: 1.75; }

/* FOOTER */
footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 2rem; background: var(--bg2);
  border-top: 1px solid var(--border);
  font-size: 0.72rem; color: var(--muted); letter-spacing: 0.02em;
}
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (max-width: 640px) {
  nav { padding: 0.9rem 1.1rem; }
  .nav-links { gap: 0.9rem; }
  main { padding: 1.8rem 1.1rem 2.4rem; }
  .btn-primary { width: 100%; }
}

/* ===================== Zone tools specifics ===================== */

:root {
  --content: 860px;
  --fix: #b03427;                         /* dark value comes from theme.css */
  --err-bg: rgba(192,57,43,0.07);
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, Consolas, monospace;
}
main a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

.zt-notice {
  margin: 0 0 1rem; padding: 0.9rem 1.1rem; border-radius: 10px; overflow-wrap: anywhere;
  border: 1px solid var(--border); border-left: 4px solid var(--ok);
  background: var(--ok-bg); font-size: 0.88rem; line-height: 1.6; color: var(--prose-muted, #3a3a40);
}
.zt-notice.is-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.zt-notice p { margin: 0; }
.zt-notice strong { color: var(--text); }

/* Inputs */
.zt-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.zt-input {
  padding: 1.1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); min-width: 0;
}
.zt-input.is-over { border-color: var(--accent); background: var(--badge-bg, #eef4fc); }
.zt-input h2 { font-family: var(--serif); font-size: 1.15rem; line-height: 1.25; margin: 0 0 0.2rem; }
.zt-hint { margin: 0 0 0.7rem; font-size: 0.8rem; line-height: 1.5; color: var(--muted); }
.zt-label { display: block; font-size: 0.82rem; font-weight: 600; margin: 0.7rem 0 0.3rem; }
.zt-text, .zt-field {
  display: block; width: 100%; min-width: 0; font-family: var(--mono); font-size: 0.8rem; line-height: 1.5;
  padding: 0.6rem 0.7rem; color: var(--input-text, var(--text)); background: var(--input-bg, #f8f8fb);
  border: 1px solid var(--border); border-radius: 6px;
}
.zt-text { min-height: 10rem; resize: vertical; white-space: pre; overflow: auto; }
.zt-text[aria-invalid="true"], .zt-field[aria-invalid="true"] { border-color: var(--fix); }
.zt-status { margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--muted); overflow-wrap: anywhere; min-height: 1.3em; }
.zt-error { margin: 0.5rem 0 0; font-size: 0.86rem; font-weight: 600; color: var(--fix); overflow-wrap: anywhere; }
.zt-error:empty { margin: 0; }
.zt-options { margin: 1.2rem 0 0; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); }
.zt-options legend { float: left; width: 100%; font-size: 0.86rem; font-weight: 600; margin-bottom: 0.3rem; }
.zt-options legend + * { clear: both; }
.zt-check { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.25rem 0; font-size: 0.87rem; line-height: 1.5; cursor: pointer; }
.zt-check input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0.15rem 0 0; accent-color: var(--accent); }
.zt-check:has(input:disabled) { opacity: 0.55; cursor: default; }
.zt-check small { color: var(--muted); font-size: 0.8rem; }
.zt-options-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.2rem; }
.zt-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.1rem 0 0; }
.btn-ghost {
  font-family: var(--sans); font-size: 0.86rem; font-weight: 600; cursor: pointer;
  padding: 0.6rem 1.1rem; border-radius: 6px; background: transparent; color: var(--text); border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--border-accent); }

/* Results */
.zt-results { margin: 2.2rem 0 0; }
.zt-results > h2 { font-family: var(--serif); font-size: 1.5rem; line-height: 1.25; margin: 0 0 0.9rem; overflow-wrap: anywhere; }
.zt-summary { margin: 0 0 1rem; padding: 1rem 1.2rem; border-radius: 10px; border: 1px solid var(--border); border-left: 4px solid var(--ok); background: var(--surface, #fff); }
.zt-summary.is-medium { border-left-color: var(--warn); }
.zt-summary.is-high { border-left-color: var(--fix); }
.zt-summary strong { display: block; font-size: 1.1rem; }
.zt-summary p { margin: 0.2rem 0 0; font-size: 0.86rem; color: var(--prose-muted, #3a3a40); }
.zt-group { margin: 1.8rem 0 0.7rem; font-size: 1.05rem; }
.zt-card { margin: 0 0 0.8rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); overflow-wrap: anywhere; }
.zt-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.35rem; }
.zt-badge { padding: 0.05rem 0.6rem; border-radius: 999px; border: 1px solid currentColor; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.zt-badge.is-high { color: var(--fix); background: var(--err-bg); }
.zt-badge.is-medium { color: var(--warn); background: var(--warn-bg); }
.zt-badge.is-low { color: var(--muted); background: var(--neutral-bg); }
.zt-action { font-size: 0.8rem; color: var(--muted); }
.zt-card h4 { margin: 0 0 0.25rem; font-size: 0.98rem; line-height: 1.4; }
.zt-type { font-family: var(--mono); font-size: 0.86em; }
.zt-name { font-family: var(--mono); font-size: 0.92em; }
.zt-card p { margin: 0.3rem 0; font-size: 0.86rem; line-height: 1.6; color: var(--prose-muted, #3a3a40); }
.zt-card .zt-note { font-weight: 600; color: var(--text); }
.zt-value { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0.6rem; align-items: baseline; margin: 0.35rem 0; padding: 0.4rem 0.7rem; border-radius: 6px; font-size: 0.82rem; }
.zt-value.is-old { background: var(--err-bg); }
.zt-value.is-new { background: var(--ok-bg); }
.zt-value-label { font-weight: 600; font-size: 0.78rem; }
.zt-card code { background: none; border: 0; padding: 0; font-size: 0.8rem; overflow-wrap: anywhere; word-break: normal; white-space: pre-wrap; }
.zt-details { margin: 0.4rem 0; padding-left: 1.2rem; font-size: 0.84rem; }
.zt-records { list-style: none; margin: 0.6rem 0; padding: 0; display: grid; gap: 0.3rem; }
.zt-records li { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 0.6rem; align-items: baseline; padding: 0.35rem 0.7rem; border-radius: 6px; background: var(--neutral-bg); }
.zt-records li:not(:has(code)) { display: block; font-size: 0.82rem; }
.zt-line { font-size: 0.76rem; color: var(--muted); }
.zt-advice { margin: 0.6rem 0 0; display: grid; gap: 0.2rem; font-size: 0.85rem; line-height: 1.6; }
.zt-advice dt { display: inline; font-weight: 600; }
.zt-advice dt::after { content: ': '; }
.zt-advice dd { display: inline; margin: 0; color: var(--prose-muted, #3a3a40); }
.zt-problems { margin: 0 0 1rem; font-size: 0.86rem; overflow-wrap: anywhere; }
.zt-problems summary { cursor: pointer; font-weight: 600; color: var(--warn); }
.zt-problems ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.zt-panel { margin: 1.4rem 0 0; padding: 1.2rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); }
.zt-panel h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.about ul { font-size: 0.94rem; color: var(--prose-muted, #3a3a40); line-height: 1.8; padding-left: 1.2rem; margin: 0 0 1rem; max-width: 68ch; }

@media (max-width: 720px) {
  .zt-inputs, .zt-options-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .zt-actions .btn-primary { width: 100%; }
  .zt-actions .btn-ghost { flex: 1 1 auto; }
  .zt-records li { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
