/* MailCheck – hand-written styles, no build step, no external resources. */

:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #eeede6;
  --ink: #18222c;
  --ink-soft: #4a5866;
  --line: #d9d7cd;
  --brand: #0c6a66;
  --brand-ink: #ffffff;
  --brand-soft: #d7ece9;
  --accent: #e3a33b;
  --focus: #1f5fd1;

  --ok: #1d7347;
  --ok-bg: #dcf0e3;
  --warn: #8a5300;
  --warn-bg: #fbecc9;
  --bad: #b3261e;
  --bad-bg: #fbdcd8;
  --neutral: #4d5d6e;
  --neutral-bg: #e4e8ec;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(24, 34, 44, .06), 0 6px 24px rgba(24, 34, 44, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1519;
    --surface: #172026;
    --surface-2: #1e2930;
    --ink: #e7ece9;
    --ink-soft: #a6b3b8;
    --line: #2c3a42;
    --brand: #49b8ae;
    --brand-ink: #06201e;
    --brand-soft: #173a38;
    --accent: #f0b85a;
    --focus: #8ab4ff;

    --ok: #6fd39a;
    --ok-bg: #133524;
    --warn: #f2c063;
    --warn-bg: #3a2c0e;
    --bad: #ff8f86;
    --bad-bg: #42181a;
    --neutral: #aebccb;
    --neutral-bg: #26323c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-block: 2rem 4rem; outline: none; }

.wrap { width: min(1080px, 100% - 2rem); margin-inline: auto; }

a { color: var(--brand); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }

code, pre { font-family: var(--mono); font-size: .9em; }
code { overflow-wrap: anywhere; }

.muted { color: var(--ink-soft); }
.lead { font-size: 1.12rem; color: var(--ink-soft); max-width: 62ch; }
.visually-hidden {
  position: absolute !important; 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: 1rem; top: -4rem; z-index: 10;
  background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

/* ---------- header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .8rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.brand-mark { width: 34px; height: 34px; }
.bm-env { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2; }
.bm-flap { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; }
.bm-dot { fill: var(--accent); }
.bm-check { fill: none; stroke: #1b1405; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.main-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.main-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.main-nav a:hover { color: var(--brand); text-decoration: underline; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-size: .85rem; font-weight: 600; }
.lang-switch a, .lang-current { padding: .2rem .65rem; }
.lang-current { background: var(--ink); color: var(--bg); }

.site-footer { border-top: 1px solid var(--line); padding-block: 1.5rem; font-size: .92rem; color: var(--ink-soft); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; align-items: baseline; }
.footer-inner p { margin: 0; max-width: 60ch; }
.footer-inner nav { display: flex; gap: 1rem; }
.footer-inner a { color: var(--ink-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .45rem; justify-content: center;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: .7rem 1.15rem; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn-danger { background: transparent; color: var(--bad); border-color: currentColor; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: .4rem .8rem; font-size: .9rem; }
.icon { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.notice { background: var(--brand-soft); border-left: 4px solid var(--brand); padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; }
.notice-warn { background: var(--warn-bg); border-left-color: var(--warn); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }

/* ---------- home ---------- */
.hero { padding-block: 1.5rem 2rem; }
.hero h1 { max-width: 20ch; }
.address-card {
  margin-top: 1.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); max-width: 760px; position: relative; overflow: hidden;
}
.address-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: linear-gradient(var(--brand), var(--accent)); }
.address-label { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-soft); margin-bottom: .5rem; }
.address-row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.address {
  font-family: var(--mono); font-size: clamp(1rem, 2.6vw, 1.45rem); font-weight: 600;
  background: var(--surface-2); padding: .65rem .9rem; border-radius: var(--radius-sm);
  overflow-wrap: anywhere; word-break: break-all; flex: 1 1 18rem; user-select: all; border: 1px dashed var(--line);
}
.copy-feedback { min-height: 1.5em; margin: .4rem 0 .2rem; font-size: .9rem; color: var(--ok); }
.address-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.address-hint { font-size: .9rem; color: var(--ink-soft); margin: 0; }
.address-card-compact { margin-inline: auto; text-align: left; }

.steps { margin-top: 2.5rem; }
.step-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.step-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.step-list p { margin: 0; color: var(--ink-soft); }
.step-no {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 800; margin-bottom: .6rem;
}
.checks-overview { margin-top: 2.5rem; }
.pill-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.pill-list li { border: 1px solid var(--line); background: var(--surface); padding: .3rem .8rem; border-radius: 999px; font-size: .92rem; }

/* ---------- waiting ---------- */
.waiting { text-align: center; max-width: 760px; margin-inline: auto; padding-top: 1rem; }
.waiting .lead { margin-inline: auto; }
.waiting .address-card { margin-block: 1.5rem; }
.pulse { display: inline-flex; gap: .5rem; margin-bottom: 1.2rem; }
.pulse span { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s ease-in-out infinite; }
.pulse span:nth-child(2) { animation-delay: .2s; }
.pulse span:nth-child(3) { animation-delay: .4s; background: var(--accent); }
.pulse-busy span { animation-duration: .8s; }
@keyframes pulse { 0%, 80%, 100% { transform: scale(.55); opacity: .45; } 40% { transform: scale(1); opacity: 1; } }
.timeout-box { background: var(--warn-bg); border-radius: var(--radius); padding: 1rem 1.25rem; margin-block: 1rem; }
.tips { text-align: left; margin-top: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.tips summary { cursor: pointer; font-weight: 600; }
.tips ul { margin: .75rem 0 0; padding-left: 1.2rem; color: var(--ink-soft); }

/* ---------- message pages ---------- */
.message-page { text-align: center; max-width: 620px; margin: 2rem auto; }
.message-page .lead { margin-inline: auto; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.message-page .actions { justify-content: center; }
.inline-form { display: inline; margin: 0; }

/* ---------- status icons & tags ---------- */
.status-icon { width: 1.6rem; height: 1.6rem; flex: none; stroke-width: 2.2; }
.status-icon-sm { width: 1.1rem; height: 1.1rem; }
.status-icon-xl { width: 3.5rem; height: 3.5rem; margin-bottom: .75rem; }
.status-icon > :not(.si-glyph) { stroke: none; }
.si-glyph { fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.4; }
.si-success { fill: var(--ok); }
.si-warning { fill: var(--warn); }
.si-failure { fill: var(--bad); }
.si-neutral { fill: var(--neutral); }
@media (prefers-color-scheme: dark) { .si-glyph { stroke: #0f1519; } }

.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
.tag-neutral { background: var(--neutral-bg); color: var(--neutral); }
.text-bad { color: var(--bad); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.text-ok { color: var(--ok); font-weight: 600; }

/* ---------- result: score ---------- */
.score-panel {
  display: grid; grid-template-columns: auto 1fr; gap: 2rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
  padding: 2rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; position: relative; overflow: hidden;
}
.score-panel::after { content: ""; position: absolute; inset: auto 0 0 0; height: 6px; background: var(--grade-color); }
.grade-excellent { --grade-color: var(--ok); }
.grade-good { --grade-color: var(--brand); }
.grade-poor { --grade-color: var(--warn); }
.grade-bad { --grade-color: var(--bad); }
.score-ring { position: relative; width: 190px; height: 190px; }
.score-ring svg { width: 100%; height: 100%; }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 11; }
.ring-value { fill: none; stroke: var(--grade-color); stroke-width: 11; stroke-linecap: round; }
.score-number { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 68px; }
.score-value { font-size: 3.4rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.score-max { font-size: 1.2rem; color: var(--ink-soft); font-weight: 600; margin-left: .15rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; font-weight: 700; color: var(--ink-soft); margin-bottom: .3rem; }
.grade-label { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.grade-icon { width: 2rem; height: 2rem; }
.count-list { list-style: none; padding: 0; margin: 1rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; }
.count { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .95rem; }

/* ---------- result: message info ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.info-grid dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; }
.info-grid dd { margin: .15rem 0 0; overflow-wrap: anywhere; }

/* ---------- result: checks ---------- */
.checks { margin-block: 2rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .25rem 1rem; }
.section-head p { margin-bottom: .8rem; }
.check {
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--neutral);
  border-radius: var(--radius); margin-bottom: .75rem; box-shadow: var(--shadow);
}
.check-success { border-left-color: var(--ok); }
.check-warning { border-left-color: var(--warn); }
.check-failure { border-left-color: var(--bad); }
.check summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .9rem;
  padding: 1rem 1.2rem; border-radius: var(--radius);
}
.check summary::-webkit-details-marker { display: none; }
.check summary:hover .check-name { color: var(--brand); }
.check-head { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.check-name { font-weight: 700; font-size: 1.05rem; }
.check-title { color: var(--ink-soft); overflow-wrap: anywhere; }
.mark {
  font-weight: 800; font-variant-numeric: tabular-nums; padding: .25rem .65rem; border-radius: var(--radius-sm);
  min-width: 3.4rem; text-align: center; white-space: nowrap;
}
.mark-minus { background: var(--bad-bg); color: var(--bad); }
.mark-zero { background: var(--surface-2); color: var(--ink-soft); }
.chevron { display: inline-flex; transition: transform .2s; color: var(--ink-soft); }
.check[open] .chevron { transform: rotate(90deg); }
.check-body { padding: 0 1.2rem 1.2rem 3.7rem; }
.status-line { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.check-desc { color: var(--ink-soft); }
.sub-heading { font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin: 1.2rem 0 .5rem; }
.hints ul { margin: 0; padding-left: 1.2rem; }
.hints li { margin-bottom: .35rem; }
.hints { background: var(--brand-soft); border-radius: var(--radius-sm); padding: .2rem 1rem .8rem; margin-top: .8rem; }
.hints .sub-heading { color: var(--brand); }

/* details renderers */
.kv { margin: 0; display: grid; gap: .1rem; }
.kv-row { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; gap: .25rem 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { font-weight: 600; color: var(--ink-soft); overflow-wrap: anywhere; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv .kv { background: var(--surface-2); border-radius: var(--radius-sm); padding: 0 .75rem; }
.value-list { margin: 0; padding-left: 1.1rem; }
.code-block {
  margin: 0; background: var(--surface-2); padding: .6rem .8rem; border-radius: var(--radius-sm);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22rem; overflow: auto;
}
.wrap-any { overflow-wrap: anywhere; word-break: break-word; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: .94rem; }
table.data th, table.data td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .row-bad td { background: var(--bad-bg); }
table.data .row-muted td { color: var(--ink-soft); opacity: .75; }
.cell-note { margin: .2rem 0 0; color: var(--ink-soft); font-size: .85rem; }
.data-compact td { padding-block: .35rem; }
.subrow td { background: var(--surface-2); }
.explain { margin: .35rem 0 0; color: var(--ink-soft); font-size: .9rem; }
.bl-summary, .sa-score { margin-bottom: .6rem; }

/* ---------- result: mail views ---------- */
.tablist { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin-bottom: 1rem; overflow-x: auto; overflow-y: hidden; }
.tablist [role="tab"] {
  font: inherit; font-weight: 600; background: none; border: 0; color: var(--ink-soft); cursor: pointer;
  padding: .6rem 1rem; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap;
}
.tablist [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.tablist [role="tab"]:hover { color: var(--brand); }
.tabpanel { margin-bottom: 1.5rem; }
.js .tabpanel { margin-bottom: 0; }
.js .tabpanel[hidden] { display: none; }
.js .panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.preview-bar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; font-size: .92rem; background: var(--surface-2); padding: .5rem .8rem; border-radius: var(--radius-sm); margin-bottom: .75rem; }
.frame-wrap { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; resize: vertical; height: 640px; min-height: 240px; background: #fff; }
.mail-frame { width: 100%; height: 100%; border: 0; background: #fff; display: block; color-scheme: light; }
.mail-text, .mail-raw {
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 1rem; margin: 0;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 640px; overflow: auto; font-size: .86rem;
}

/* ---------- prose pages ---------- */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.2rem; }
.faq-item { border-bottom: 1px solid var(--line); padding: .9rem 0; }
.faq-item summary { cursor: pointer; font-weight: 650; font-size: 1.05rem; }
.faq-item p { margin: .7rem 0 0; color: var(--ink-soft); }
mark.placeholder { background: var(--warn-bg); color: var(--warn); padding: .05rem .35rem; border-radius: 4px; font-weight: 600; }
.imprint .kv-row { grid-template-columns: minmax(9rem, 18rem) 1fr; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  main { padding-block: 1.25rem 3rem; }
  .score-panel { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 1.5rem 1.1rem 2rem; gap: 1rem; }
  .grade-label { justify-content: center; }
  .score-text .lead { margin-inline: auto; }
  .count-list { justify-content: center; }
  .check summary { padding: .85rem .9rem; gap: .6rem; }
  .check-body { padding: 0 .9rem 1rem; }
  .kv-row { grid-template-columns: 1fr; }
  .frame-wrap { height: 480px; }
  .card { padding: 1.1rem; }
  .main-nav { gap: .8rem; font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .site-header nav, .site-footer, .actions-card, .mail-views, .chevron { display: none; }
  .check { break-inside: avoid; box-shadow: none; }
}
