/* Restore Drill Recorder: mylesagnew.com/restore-drill/
   Base layout shared with /phishing-analyser/ and /redirect-tracer/ (same tokens, nav,
   FAQ, footer) so the tools look like one family; tool-specific rules are at the bottom.
   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%; }
}

/* ===================== Restore Drill Recorder specifics ===================== */

:root {
  --fix: #c0392b;                         /* 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; }

/* Notices */
.rd-notice {
  margin: 0 0 1rem; padding: 0.9rem 1.1rem; border-radius: 10px;
  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);
}
.rd-notice.is-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.rd-notice.is-bad { border-left-color: var(--fix); background: var(--err-bg); }
.rd-notice p { margin: 0; }
.rd-notice strong { color: var(--text); }

/* Panels */
.rd-panel {
  margin: 0 0 1.2rem; padding: 1.3rem 1.4rem;
  background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px;
}
.rd-panel > h2, .rd-record h2 { font-family: var(--serif); font-size: 1.25rem; line-height: 1.25; margin: 0 0 0.3rem; }
.rd-lead { margin: 0 0 1rem; font-size: 0.88rem; color: var(--muted); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

/* Fields */
.rd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.rd-field { display: block; min-width: 0; }
.rd-field.is-wide { grid-column: 1 / -1; }
.rd-label { display: block; font-size: 0.84rem; font-weight: 600; margin: 0 0 0.3rem; }
.rd-hint { display: block; font-size: 0.76rem; color: var(--muted); margin: 0.3rem 0 0; line-height: 1.5; }
.rd-input {
  display: block; width: 100%; min-width: 0; font: inherit; font-size: 1rem; line-height: 1.4;
  min-height: 2.7rem; padding: 0.55rem 0.7rem; color: var(--input-text, var(--text)); background: var(--input-bg, #f8f8fb);
  border: 1px solid var(--border); border-radius: 6px;
}
textarea.rd-input { min-height: 3.2rem; resize: vertical; }
.rd-input[aria-invalid="true"] { border-color: var(--fix); }
.rd-amount { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; }
.rd-group { margin: 1.4rem 0 0; }
.rd-group > legend, .rd-group > .rd-label { font-size: 0.84rem; font-weight: 600; margin: 0 0 0.5rem; }

/* Scenario picker */
.rd-scenarios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
.rd-scenario {
  display: block; position: relative; padding: 0.9rem 1rem 0.9rem 2.5rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg, #f8f8fb);
}
.rd-scenario input { position: absolute; left: 0.9rem; top: 1.1rem; accent-color: var(--accent); margin: 0; width: 1rem; height: 1rem; }
.rd-scenario strong { display: block; font-size: 0.92rem; }
.rd-scenario span { display: block; font-size: 0.78rem; line-height: 1.5; color: var(--muted); }
.rd-scenario:has(input:checked) { border-color: var(--accent); background: var(--badge-bg, #eef4fc); }
.rd-scenario:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }

.rd-check { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.4rem 0; font-size: 0.88rem; line-height: 1.55; cursor: pointer; }
.rd-check input { flex: none; width: 1.1rem; height: 1.1rem; margin: 0.15rem 0 0; accent-color: var(--accent); }

/* Buttons */
.rd-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 1.2rem; }
.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); }
.btn-ghost.is-danger { color: var(--fix); }
.btn-ghost.is-small { font-size: 0.78rem; padding: 0.4rem 0.8rem; }
.rd-error { margin: 0.8rem 0 0; font-size: 0.86rem; font-weight: 600; color: var(--fix); }
.rd-status { margin: 0.6rem 0 0; font-size: 0.84rem; color: var(--muted); min-height: 1.4em; }

/* Drill steps */
.rd-phase { margin: 0 0 1.6rem; }
.rd-phase > h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 0.7rem; }
.rd-steps { display: grid; gap: 0.7rem; }
.rd-step {
  padding: 1rem 1.1rem; border-radius: 10px; background: var(--surface, #fff);
  border: 1px solid var(--border); border-left: 4px solid var(--border);
}
.rd-step[data-value="pass"] { border-left-color: var(--ok); }
.rd-step[data-value="problem"] { border-left-color: var(--warn); }
.rd-step[data-value="fail"] { border-left-color: var(--fix); }
.rd-step[data-value="na"] { border-left-color: var(--neutral); }
/* A floated legend stays inside the bordered card instead of on its edge. */
.rd-step legend { float: left; width: 100%; font-size: 0.95rem; font-weight: 600; line-height: 1.45; margin: 0 0 0.2rem; }
.rd-step legend + * { clear: both; }
.rd-tag { display: inline-block; padding: 0 0.5rem; border-radius: 999px; border: 1px solid currentColor; font-size: 0.68rem; font-weight: 600; color: var(--accent); white-space: nowrap; vertical-align: 0.08em; }
.rd-detail { margin: 0 0 0.7rem; font-size: 0.85rem; line-height: 1.55; color: var(--muted); }
.rd-options { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.7rem; }
.rd-option {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.75rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem;
}
.rd-option input { margin: 0; accent-color: var(--accent); }
.rd-option:has(input:checked) { border-color: var(--accent); background: var(--badge-bg, #eef4fc); font-weight: 600; }
.rd-option:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.rd-time { margin: 0.4rem 0 0; font-family: var(--mono); font-size: 0.74rem; color: var(--muted); }

/* Clock bar */
.rd-bar {
  position: sticky; bottom: 0; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  margin: 0 -0.6rem; padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  background: var(--surface, #fff); border: 1px solid var(--border-accent); border-radius: 10px 10px 0 0;
  box-shadow: 0 -4px 18px rgba(0,0,0,0.08);
}
.rd-clock { font-family: var(--mono); font-size: 1.45rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rd-bar-info { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.rd-bar-buttons { display: flex; gap: 0.5rem; margin-left: auto; }
.rd-bar.is-paused .rd-clock { color: var(--warn); }
.rd-confirm { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; font-size: 0.84rem; }
.rd-confirm p { margin: 0; flex: 1 1 240px; }
html:has(.rd-bar:not([hidden])) { scroll-padding-bottom: 7rem; }

/* Follow-up rows */
.rd-rows { display: grid; gap: 0.8rem; margin: 0 0 0.8rem; }
.rd-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.5rem; align-items: end; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border); }
.rd-row .rd-field:first-child { grid-column: 1 / -1; }
.rd-row .rd-label { font-size: 0.74rem; color: var(--muted); }
.rd-row .rd-input { font-size: 0.86rem; }

/* Record */
.rd-record { margin: 0 0 1.2rem; padding: 1.5rem 1.4rem; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; }
.rd-record h3 { margin: 1.6rem 0 0.5rem; font-size: 0.95rem; }
.rd-verdict { margin: 0.9rem 0 1.1rem; padding: 0.9rem 1.1rem; border-radius: 8px; border: 1px solid var(--border); border-left: 4px solid var(--ok); background: var(--ok-bg); }
.rd-verdict.is-problems { border-left-color: var(--warn); background: var(--warn-bg); }
.rd-verdict.is-none { border-left-color: var(--fix); background: var(--err-bg); }
.rd-verdict strong { display: block; font-size: 1.05rem; }
.rd-verdict p { margin: 0.15rem 0 0; font-size: 0.86rem; color: var(--prose-muted, #3a3a40); }
.rd-measures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; margin: 0; }
.rd-measures > div { padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: 8px; }
.rd-measures dt { font-size: 0.78rem; color: var(--muted); }
.rd-measures dd { margin: 0; font-size: 0.82rem; color: var(--prose-muted, #3a3a40); }
.rd-measures .rd-value { font-size: 1.2rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.rd-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.25rem 1rem; margin: 1.2rem 0 0; font-size: 0.85rem; }
.rd-facts dt { color: var(--muted); }
.rd-facts dd { margin: 0; }
.rd-table-wrap { overflow-x: auto; }
.rd-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; line-height: 1.5; }
.rd-table th, .rd-table td { padding: 0.5rem 0.6rem; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.rd-table thead th { border-top: 0; font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.rd-table tbody th { font-weight: 400; width: 38%; }
.rd-table td:nth-child(3) { font-family: var(--mono); white-space: nowrap; font-size: 0.76rem; padding-top: 0.6rem; }
.rd-result { font-weight: 600; }
.rd-result.is-pass { color: var(--ok); } .rd-result.is-problem { color: var(--warn); }
.rd-result.is-fail, .rd-result.is-empty { color: var(--fix); }
.rd-flag { display: block; font-size: 0.76rem; color: var(--warn); }
.rd-list { margin: 0; padding-left: 1.2rem; font-size: 0.86rem; }
.rd-notes { white-space: pre-wrap; font-size: 0.86rem; margin: 0; }
.rd-limits { font-size: 0.8rem; color: var(--muted); }

.rd-edit { margin: 0 0 1.2rem; }
.rd-edit > summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; padding: 0.6rem 0; color: var(--accent); }
.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) {
  .rd-scenarios { grid-template-columns: minmax(0, 1fr); }
  .rd-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rd-row .btn-ghost { justify-self: start; }
}
@media (max-width: 640px) {
  .rd-panel, .rd-record { padding: 1.1rem 1rem; }
  .rd-grid, .rd-measures { grid-template-columns: minmax(0, 1fr); }
  .rd-actions .btn-ghost { flex: 1 1 auto; }
  .rd-bar .btn-primary { width: auto; }
  .rd-bar-buttons { flex: 1 1 100%; margin-left: 0; }
  .rd-bar-buttons button { flex: 1; padding-left: 0.6rem; padding-right: 0.6rem; }
  .rd-options { display: grid; grid-template-columns: minmax(0, 1fr); }
  .rd-option { padding: 0.55rem 0.75rem; }
  .rd-facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rd-facts dd { margin: 0 0 0.5rem; }
  .rd-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .rd-table, .rd-table tbody, .rd-table tr, .rd-table th, .rd-table td { display: block; width: auto; }
  .rd-table tbody tr { border-top: 1px solid var(--border); padding: 0.6rem 0; }
  .rd-table tbody th, .rd-table td, .rd-table td:nth-child(3) { border: 0; padding: 0.1rem 0; width: auto; }
}

/* Print only the record, always in light colours */
@media print {
  nav, footer, .skip-link, .about, .rd-noprint, .tool > h1, .tool > .intro { display: none !important; }
  body, main, .rd-record { background: #fff !important; color: #000 !important; }
  main { max-width: none; padding: 0; }
  .rd-record { border: 0; padding: 0; margin: 0; line-height: 1.4; }
  .rd-record h3 { margin-top: 1.1rem; }
  .rd-table, .rd-list, .rd-notes, .rd-limits { line-height: 1.4; }
  .rd-record * { color: #000 !important; }
  .rd-record, .rd-record * { border-color: #999 !important; }
  .rd-verdict { background: none !important; }
  .rd-table { font-size: 9pt; }
  .rd-table tr, .rd-verdict, .rd-measures > div { break-inside: avoid; }
  .rd-record h3 { break-after: avoid; }
}
