/* =============================================================================
   PH Networks AG – E-Mail-Sicherheits-Check (interne Arbeitsoberfläche)
   Gestaltungsregeln: siehe CLAUDE.md (Abschnitt "Design").
   Alle Farben/Schriften nur über die Variablen in :root ändern.
   ============================================================================= */

/* Optional: eigene Webfonts (selbst gehostet) in assets/fonts/ ablegen, z.B. D-DIN (SIL OFL):
@font-face { font-family: "D-DIN"; src: url("../fonts/D-DIN.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "D-DIN"; src: url("../fonts/D-DIN-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
*/

:root {
    /* Marke */
    --navy-950: #10202f;
    --navy-900: #192a3d;   /* Primärfarbe PH Networks */
    --navy-800: #253f60;
    --slate: #3a4f66;
    --accent: #0275b9;     /* Akzentblau PH Networks */
    --accent-strong: #01629c;
    --accent-soft: #e8f2f9;

    /* Flächen & Text */
    --paper: #f2f4f7;
    --surface: #ffffff;
    --line: #d9dfe6;
    --line-strong: #c2ccd6;
    --ink: #142231;
    --text: #2e4155;
    --muted: #5f7184;

    /* Status */
    --good: #12784a;
    --fair: #a35c00;
    --poor: #b42318;
    --na: #8593a3;
    --star: #cf8f0c;

    /* Typografie */
    --font-display: "D-DIN", "PHN - D-DIN", Bahnschrift, "DIN Alternate", "DIN Next", "Barlow", sans-serif;
    --font-text: "Source Sans 3", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;

    --radius: 3px;
    --wrap: 1360px;
    --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--text);
    font: 400 15px/1.5 var(--font-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; }
p { margin: 0 0 .75em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
code { font-family: var(--font-mono); font-size: .92em; }
small { font-size: .8rem; }

main { flex: 1 0 auto; padding-block: 20px 40px; }
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 16px; top: -48px; background: var(--surface); color: var(--ink); padding: 8px 14px; z-index: 10; }
.skip-link:focus { top: 8px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon--sm { width: 16px; height: 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tone-good { --tone: var(--good); }
.tone-fair { --tone: var(--fair); }
.tone-poor { --tone: var(--poor); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.group-title {
    font-family: var(--font-display); font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted); margin: 0 0 8px;
}

/* ---------------------------------------------------------------- Kopfzeile */
.topbar { background: var(--navy-900); color: #fff; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 14px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand__logo { display: block; width: 140px; height: auto; }
.brand__product {
    font-family: var(--font-display); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
    color: rgba(255, 255, 255, .65); padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .25);
}
.topnav { display: flex; gap: 24px; }
.topnav a {
    color: rgba(255, 255, 255, .75); text-decoration: none;
    font-family: var(--font-display); font-size: 13.5px; letter-spacing: .1em; text-transform: uppercase;
    padding-block: 17px 15px; border-bottom: 2px solid transparent;
}
.topnav a:hover { color: #fff; }
.topnav a[aria-current="page"] { color: #fff; border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- Formular */
.check-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.segmented {
    display: inline-grid; grid-template-columns: 1fr 1fr; margin: 0 0 12px; padding: 0;
    border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
    padding: 7px 18px; cursor: pointer; text-align: center; white-space: nowrap;
    font-family: var(--font-display); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate);
}
.segmented label + input + label { border-left: 1px solid var(--line-strong); }
.segmented input:checked + label { background: var(--navy-900); color: #fff; }
.segmented input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: -2px; }

.check-form__fields { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.field { min-width: 0; }
.field--header { display: none; }
.check-form:has(#mode-header:checked) .field--domain, .check-form.is-header .field--domain { display: none; }
.check-form:has(#mode-header:checked) .field--header, .check-form.is-header .field--header { display: block; }

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
input[type="text"], input[type="search"], textarea {
    width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
input[type="text"] { height: 44px; padding-inline: 14px; font: 500 1rem/1 var(--font-mono); }
input[type="search"] { height: 40px; padding-inline: 14px; font: inherit; }
.input-icon input[type] { padding-left: 42px; }
textarea { padding: 10px 12px; font: 12px/1.5 var(--font-mono); resize: vertical; min-height: 220px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(2, 117, 185, .18); }
::placeholder { color: #9aa7b4; }

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 44px; padding: 0 22px; border: 0; border-radius: var(--radius); cursor: pointer; text-decoration: none;
    font-family: var(--font-display); font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    transition: background-color .15s;
}
.button--primary { background: var(--accent); color: #fff; }
.button--primary:hover { background: var(--accent-strong); color: #fff; }
.button[disabled] { cursor: progress; opacity: .85; }

.progress { height: 3px; margin-top: 8px; overflow: hidden; }
.progress span { display: block; width: 30%; height: 100%; background: var(--accent); transform: translateX(-100%); opacity: 0; }
.is-busy .progress span { opacity: 1; animation: progress 1.1s ease-in-out infinite; }
@keyframes progress { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.form-error { display: flex; gap: 8px; align-items: center; color: var(--poor); margin: 4px 0 0; }
.form-error[hidden] { display: none; }
.form-error .icon { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- Ergebnis */
.result-slot:not(:empty) { margin-top: 20px; }
.result:focus { outline: none; }
.result__head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 18px 22px; }
.score { display: grid; justify-items: center; gap: 1px; min-width: 120px; padding-right: 28px; border-right: 1px solid var(--line); }
.score__grade { font-family: var(--font-display); font-weight: 600; font-size: 56px; line-height: 1; color: var(--tone); font-variant-numeric: tabular-nums; }
.score__verbal { font-size: .85rem; color: var(--text); margin-bottom: 2px; }
.result__domain { font-size: 1.6rem; overflow-wrap: anywhere; margin-bottom: 6px; }

.result__meta, .tally { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: .875rem; color: var(--muted); }
.result__meta li { padding-right: 12px; margin-right: 12px; border-right: 1px solid var(--line-strong); line-height: 1.3; }
.result__meta li:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.tally { margin-top: 8px; gap: 4px 16px; }
.tally li { display: inline-flex; align-items: center; gap: 5px; color: var(--status); font-weight: 600; }

.scale { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 34px); gap: 2px; }
.scale__step { height: 28px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 13px; background: #edf0f3; color: var(--muted); }
.scale__step.is-active { background: var(--tone); color: #fff; }

.note { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; padding: 8px 12px; font-size: .875rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.note .icon { color: var(--accent); }
.note--error .icon { color: var(--poor); }

.result__body { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; margin-top: 20px; align-items: start; }
.test-group + .test-group { margin-top: 18px; }
.test-list { list-style: none; margin: 0; padding: 0; }
.test + .test { border-top: 1px solid var(--line); }
.test { --status: var(--na); }
.status-pass { --status: var(--good); }
.status-warn { --status: var(--fair); }
.status-fail { --status: var(--poor); }
.status-na { --status: var(--na); }

.test__row {
    display: grid; grid-template-columns: 24px minmax(180px, 2fr) minmax(0, 3fr) 124px 16px; gap: 14px; align-items: center;
    padding: 9px 14px; cursor: pointer; list-style: none;
}
.test__row::-webkit-details-marker { display: none; }
.test__row:hover { background: #f8f9fb; }
.test__icon { width: 24px; height: 24px; display: grid; place-items: center; border: 1.6px solid var(--status); border-radius: 50%; color: var(--status); }
.test__icon .icon { width: 14px; height: 14px; }
.test__name { display: grid; min-width: 0; }
.test__title { font-weight: 600; color: var(--ink); line-height: 1.3; }
.test__label { font-size: .78rem; color: var(--muted); }
.test__label code { font-size: .95em; }
.test__detail { font-family: var(--font-mono); font-size: 12px; line-height: 1.45; color: var(--text); overflow-wrap: anywhere; }
.test__status {
    display: grid; justify-items: end; text-align: right; white-space: nowrap;
    font-family: var(--font-display); font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--status);
}
.test__status small { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--muted); }
.test__chevron { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
details[open] .test__chevron { transform: rotate(90deg); }
.test__body { padding: 0 14px 12px 52px; font-size: .875rem; color: var(--text); }
.test__body p:last-child { margin-bottom: 0; }
.test__body strong { color: var(--ink); }
.status-na .test__title { color: var(--muted); font-weight: 400; }

.result__aside { position: sticky; top: 16px; }
.facts { margin: 0; padding: 4px 14px; }
.facts__row { padding: 8px 0; }
.facts__row + .facts__row { border-top: 1px solid var(--line); }
.facts dt { font-size: .78rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; }
.facts code { font-size: 11.5px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Sterne */
.stars { display: inline-flex; gap: 1px; color: var(--star); }
.star { width: 15px; height: 15px; fill: none; }
.star.is-full { fill: currentColor; }
.star .star-fill { fill: currentColor; }

/* ---------------------------------------------------------------- Bewertung (aufklappbar) */
.method { margin-top: 24px; }
.panel__summary {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none;
    font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--slate);
}
.panel__summary::-webkit-details-marker { display: none; }
.panel__chevron { width: 16px; height: 16px; transition: transform .2s; }
details[open] > .panel__summary .panel__chevron { transform: rotate(90deg); }
.method__formula { padding: 0 14px; font-size: .875rem; color: var(--muted); }
.method .table-scroll { border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- Tabellen */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.data-table th, .data-table td { padding: 8px 12px; text-align: left; vertical-align: middle; }
.data-table thead th {
    font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    color: var(--muted); border-bottom: 2px solid var(--navy-900); white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid var(--line); }
.data-table tbody tr:last-child { border-bottom: 0; }
.data-table tbody tr:hover { background: #f8f9fb; }
.data-table tbody th { color: var(--ink); font-weight: 600; white-space: nowrap; }
.data-table .num { text-align: right; font-family: var(--font-mono); font-size: .875rem; }

.tag {
    display: inline-flex; align-items: center; padding: 1px 7px; white-space: nowrap;
    border: 1px solid var(--line-strong); border-radius: 2px;
    font-family: var(--font-display); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--slate);
}
.tag--muted { color: var(--muted); border-style: dashed; }

/* ---------------------------------------------------------------- Rangliste */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.page-title { font-size: 1.35rem; }
.page-title .muted { font-weight: 400; }
.ranking-search { width: min(320px, 100%); }
.ranking .rank { color: var(--muted); width: 64px; }
.ranking .domain a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ranking .domain a:hover { color: var(--accent); text-decoration: underline; }
.grade-pill {
    display: inline-block; min-width: 50px; padding: 1px 8px; text-align: center;
    border: 1.5px solid var(--tone); border-radius: 2px; color: var(--tone);
    font-family: var(--font-display); font-weight: 600; font-size: .95rem;
}
.pagination { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 16px; color: var(--muted); }

/* ---------------------------------------------------------------- Statuszeile */
.statusbar { background: var(--navy-950); color: rgba(255, 255, 255, .6); font-size: .8rem; }
.statusbar__inner { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; padding-block: 10px; }
.statusbar code { color: rgba(255, 255, 255, .85); }

/* ---------------------------------------------------------------- Responsiv */
@media (max-width: 1100px) {
    .result__body { grid-template-columns: minmax(0, 1fr); }
    .result__aside { position: static; }
    .test__row { grid-template-columns: 24px minmax(0, 1fr) 124px 16px; }
    .test__detail { grid-column: 2 / -1; grid-row: 2; }
}
@media (max-width: 720px) {
    :root { --gutter: 12px; }
    .brand__product { display: none; }
    .brand__logo { width: 116px; }
    .topnav { gap: 14px; }
    .topnav a { font-size: 12px; letter-spacing: .06em; }
    .check-form__fields { grid-template-columns: minmax(0, 1fr); }
    .button--primary { width: 100%; }
    .result__head { grid-template-columns: auto minmax(0, 1fr); gap: 16px; padding: 14px; }
    .score { min-width: 0; padding-right: 16px; }
    .score__grade { font-size: 44px; }
    .scale { grid-column: 1 / -1; grid-template-columns: repeat(6, 1fr); }
    .test__row { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; padding: 9px 10px; }
    .test__chevron { display: none; }
    .test__body { padding: 0 10px 12px 44px; }
    .data-table th, .data-table td { padding: 7px 8px; }
}

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

@media print {
    .topbar, .statusbar, .check-form, .method { display: none; }
    .result__body { grid-template-columns: 1fr; }
    details > .test__body { display: block; }
}
