/* Phishing Email Analyser — mylesagnew.com/phishing-analyser/
   Base layout shared with /pqctest/ and /redirect-tracer/ (same tokens, nav, form, FAQ,
   footer) so the tools look like one family; tool-specific rules are at the bottom.
   CSP-clean: no inline styles. Dynamic sizes are set from JS via the CSSOM. */

@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: #0f8a4f;
  --ok-bg: rgba(15,138,79,0.08);
  --warn: #b26a00;
  --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; }

/* FORM — label + input + button on one line, SSL-Labs style */
.scan-form {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 1.3rem 1.4rem 1rem;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
}
.scan-form label {
  font-weight: 600; font-size: 0.92rem; color: var(--text);
}
.scan-input {
  flex: 1 1 300px; min-width: 0; font-family: var(--sans); font-size: 1rem;
  padding: 0.62rem 0.8rem; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 6px;
}
.scan-input:focus { outline: 2px solid var(--border-accent); outline-offset: 1px; border-color: var(--accent); }
.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; }
.scan-hint { font-size: 0.78rem; color: var(--muted); margin: 0.7rem 0 0; }
.scan-hint code { font-size: 0.9em; }

/* RESULT PANEL */
.scan-result {
  margin: 1.4rem 0 0; text-align: left;
  border: 1px solid var(--border); border-left-width: 4px;
  border-radius: 10px; background: #fff; padding: 1.3rem 1.4rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.scan-result.is-ok { border-left-color: var(--ok); background: var(--ok-bg); }
.scan-result.is-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.scan-result.is-neutral { border-left-color: var(--neutral); background: var(--neutral-bg); }
.scan-result.is-busy { border-left-color: var(--accent); }
.scan-result h3 {
  font-family: var(--serif); font-size: 1.2rem; margin: 0 0 0.4rem; line-height: 1.25; word-break: break-word;
}
.scan-result.is-ok h3 { color: #0c6b3d; }
.scan-result.is-warn h3 { color: #8a5200; }
.scan-result p { margin: 0 0 0.6rem; font-size: 0.9rem; color: #3a3a40; line-height: 1.7; }
.scan-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; margin-top: 0.9rem; }
.scan-meta span {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.78rem; color: var(--muted);
}
.scan-meta strong { color: var(--text); font-weight: 600; }

/* 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; }
  .scan-form { flex-direction: column; align-items: stretch; }
  .scan-form label { margin-bottom: 0.1rem; }
  .btn-primary { width: 100%; }
}

/* ===================== Phishing Email Analyser 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;
}

/* Privacy + safety notices above the tool */
.pea-notices { display: grid; gap: 0.7rem; margin: 0 0 1.4rem; }
.pea-notice {
  display: flex; gap: 0.8rem; align-items: flex-start;
  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;
}
.pea-notice p { margin: 0; color: var(--prose-muted, #3a3a40); }
.pea-notice strong { color: var(--text); }
.pea-notice svg { flex: none; width: 1.3rem; height: 1.3rem; margin-top: 0.1rem; color: var(--ok); }
.pea-notice.is-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.pea-notice.is-warn svg { color: var(--warn); }

/* Input card */
.pea-form {
  padding: 1.3rem 1.4rem 1.1rem;
  background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px;
}
.pea-form > label { display: block; font-weight: 600; font-size: 0.92rem; margin: 0 0 0.5rem; }
.pea-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0.8rem; }
.pea-samples-label { font-size: 0.78rem; color: var(--muted); margin-right: 0.2rem; }
.pea-chip {
  font-family: var(--sans); font-size: 0.76rem; font-weight: 600; cursor: pointer;
  padding: 0.28rem 0.7rem; border-radius: 999px;
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  transition: color 0.15s, border-color 0.15s;
}
.pea-chip:hover, .pea-chip[aria-pressed="true"] { color: var(--accent); border-color: var(--border-accent); }
.pea-chip[aria-pressed="true"] { background: var(--badge-bg, #eef4fc); }
.pea-textarea {
  display: block; width: 100%; min-height: 15rem; resize: vertical;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.55;
  padding: 0.8rem 0.9rem; color: var(--input-text, var(--text)); background: var(--input-bg, #f8f8fb);
  border: 1px solid var(--border); border-radius: 6px;
}
.pea-textarea:focus { outline: 2px solid var(--border-accent); outline-offset: 1px; border-color: var(--accent); }
.pea-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.9rem; }
.pea-count { margin-left: auto; font-family: var(--mono); font-size: 0.74rem; color: var(--muted); }
.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(--muted); border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--border-accent); }
.btn-ghost.is-small { font-size: 0.76rem; padding: 0.3rem 0.7rem; }

/* Results */
.pea-results { margin-top: 1.6rem; }
.pea-results:focus { outline: none; }
.pea-summary {
  padding: 1.4rem 1.4rem 1.2rem; border-radius: 10px;
  background: var(--surface, #fff); border: 1px solid var(--border); border-left: 4px solid var(--ok);
}
.pea-summary.is-suspicious { border-left-color: var(--warn); }
.pea-summary.is-high { border-left-color: var(--fix); }
.pea-summary-head { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.pea-eyebrow { margin: 0; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pea-score-row { display: flex; align-items: center; gap: 1rem 1.4rem; flex-wrap: wrap; margin: 0.6rem 0 0.2rem; }
.pea-score { font-family: var(--serif); font-size: 3.2rem; font-weight: 700; line-height: 1; color: var(--text); }
.pea-score small { font-family: var(--sans); font-size: 0.95rem; font-weight: 400; color: var(--muted); margin-left: 0.15rem; }
.pea-band {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.25rem 0.8rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  border: 1px solid currentColor; white-space: nowrap; flex: none;
}
.pea-band::before { content: ''; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.pea-band.is-low { color: var(--ok); background: var(--ok-bg); }
.pea-band.is-suspicious { color: var(--warn); background: var(--warn-bg); }
.pea-band.is-high { color: var(--fix); background: var(--err-bg); }
.pea-verdict { margin: 0.7rem 0 0; font-size: 0.92rem; color: var(--prose-muted, #3a3a40); max-width: 64ch; }

/* Gauge: three fixed zones + a marker positioned from JS (CSSOM, CSP-safe). */
.pea-gauge { position: relative; margin: 1.1rem 0 0.3rem; }
.pea-gauge-track { display: flex; height: 0.55rem; border-radius: 999px; overflow: hidden; }
.pea-gauge-track span { height: 100%; }
.pea-zone-low { flex: 30; background: var(--ok); opacity: 0.55; }
.pea-zone-sus { flex: 30; background: var(--warn); opacity: 0.55; }
.pea-zone-high { flex: 40; background: var(--fix); opacity: 0.55; }
.pea-gauge-marker {
  position: absolute; top: -0.3rem; width: 0.3rem; height: 1.15rem; margin-left: -0.15rem;
  border-radius: 2px; background: var(--text); box-shadow: 0 0 0 2px var(--surface, #fff);
}
.pea-gauge-scale { position: relative; height: 1rem; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); margin-top: 0.35rem; }
.pea-gauge-scale span { position: absolute; top: 0; transform: translateX(-50%); }
.pea-gauge-scale .s0 { left: 0; transform: none; }
.pea-gauge-scale .s30 { left: 30%; }
.pea-gauge-scale .s60 { left: 60%; }
.pea-gauge-scale .s100 { right: 0; transform: none; }

.pea-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem;
  margin: 1.1rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--border);
}
.pea-stats dt { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pea-stats dd { margin: 0.15rem 0 0; font-family: var(--mono); font-size: 1.1rem; font-weight: 600; color: var(--text); }

.pea-section-title {
  margin: 2rem 0 0.9rem; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}

/* Triggered rules */
.pea-hits { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.pea-hit {
  display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 0.2rem 0.9rem;
  padding: 0.9rem 1rem; border-radius: 10px;
  background: var(--surface, #fff); border: 1px solid var(--border);
}
.pea-points {
  grid-row: span 3; align-self: start; text-align: center;
  font-family: var(--mono); font-weight: 600; font-size: 0.95rem;
  padding: 0.35rem 0; border-radius: 8px; color: var(--warn); background: var(--warn-bg);
}
.pea-hit.is-strong .pea-points { color: var(--fix); background: var(--err-bg); }
.pea-hit h3 { margin: 0; font-size: 0.95rem; line-height: 1.4; }
.pea-cat { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pea-hit p { margin: 0.15rem 0 0; font-size: 0.86rem; color: var(--prose-muted, #3a3a40); line-height: 1.6; }
.pea-evidence { list-style: none; margin: 0.45rem 0 0; padding: 0; display: grid; gap: 0.3rem; }
.pea-evidence li {
  font-family: var(--mono); font-size: 0.76rem; line-height: 1.5; word-break: break-word;
  padding: 0.3rem 0.6rem; border-radius: 6px; background: var(--bg3); color: var(--prose-muted, #3a3a40);
}
.pea-evidence mark { background: var(--warn-bg); color: var(--text); font-weight: 600; padding: 0 0.15em; border-radius: 3px; box-shadow: inset 0 -2px 0 var(--warn); }
.pea-total {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin: 0.8rem 0 0; padding: 0.7rem 1rem; border-radius: 8px;
  background: var(--neutral-bg); font-size: 0.86rem; color: var(--muted);
}
.pea-total strong { font-family: var(--mono); color: var(--text); }
.pea-empty { margin: 0; padding: 0.9rem 1rem; border-radius: 10px; background: var(--ok-bg); border: 1px solid var(--border); font-size: 0.88rem; color: var(--prose-muted, #3a3a40); }

/* Reassuring signs + notes */
.pea-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.35rem; font-size: 0.86rem; color: var(--prose-muted, #3a3a40); }
.pea-list li { position: relative; padding-left: 1.4rem; }
.pea-list li::before { content: '\2713'; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.pea-list.is-notes li::before { content: 'i'; font-family: var(--serif); font-style: italic; color: var(--accent); }
.pea-caption { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--muted); }

/* Detail tables */
.pea-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--surface, #fff); }
.pea-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.pea-table th, .pea-table td { padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.pea-table thead th { border-top: 0; font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--neutral-bg); }
.pea-table tbody tr:first-child th, .pea-table tbody tr:first-child td { border-top: 0; }
.pea-table thead + tbody tr:first-child th, .pea-table thead + tbody tr:first-child td { border-top: 1px solid var(--border); }
.pea-table th[scope="row"] { width: 28%; white-space: nowrap; font-weight: 600; color: var(--text); }
.pea-table td { color: var(--prose-muted, #3a3a40); }
.pea-mono { font-family: var(--mono); font-size: 0.76rem; word-break: break-all; }
.pea-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pea-tag {
  display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600;
  border: 1px solid currentColor; white-space: nowrap;
}
.pea-tag.is-ok { color: var(--ok); background: var(--ok-bg); }
.pea-tag.is-warn { color: var(--warn); background: var(--warn-bg); }
.pea-tag.is-bad { color: var(--fix); background: var(--err-bg); }
.pea-tag.is-neutral { color: var(--muted); background: var(--neutral-bg); }

/* Next steps */
.pea-next {
  margin: 2rem 0 0; padding: 1.2rem 1.4rem; border-radius: 10px;
  background: var(--surface, #fff); border: 1px solid var(--border-accent, var(--border));
}
.pea-next h2 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.pea-next ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.4rem; font-size: 0.88rem; color: var(--prose-muted, #3a3a40); }
.pea-next strong { color: var(--text); }

/* Rulebook (in the About section) */
.pea-rulebook { margin-top: 0.4rem; }
.pea-rulebook td:first-child { width: 4rem; font-family: var(--mono); font-weight: 600; color: var(--text); }
.pea-bands { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.4rem; font-size: 0.92rem; color: var(--prose-muted, #3a3a40); }
.pea-bands li { display: flex; align-items: center; gap: 0.6rem; }

.about a, .pea-next a, .pea-notice a { color: var(--accent); }

@media (max-width: 640px) {
  .pea-form { padding: 1.1rem 1rem 1rem; }
  .pea-actions .btn-primary { width: 100%; }
  .pea-actions .btn-ghost { flex: 1; }
  .pea-count { margin-left: 0; width: 100%; text-align: right; }
  .pea-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pea-score { font-size: 2.6rem; }
  .pea-hit { grid-template-columns: 2.8rem minmax(0, 1fr); padding: 0.8rem; gap: 0.2rem 0.7rem; }
  .pea-table th[scope="row"] { width: auto; white-space: normal; }
  .pea-rulebook th:nth-child(3), .pea-rulebook td:nth-child(3) { display: none; }
  .pea-rulebook td:first-child { width: 3rem; }
  .pea-bands li { align-items: flex-start; }
}
