/* ═══════════════════════════════════════════════════════════════════════════
   RDAP.nu — Nordic Slate Theme
   Modern CSS (2026): light-dark(), nesting, clamp(), logical properties
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ──────────────────────────────────────────────────── */

:root {
    color-scheme: light dark;

    /* Font stacks */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Type scale */
    --text-xs: 0.625rem;
    --text-sm: 0.75rem;
    --text-base: 0.875rem;
    --text-md: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;

    /* Radii */
    --radius-sm: 3px;
    --radius: 6px;
    --radius-lg: 8px;

    /* Shadows */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    /* Surfaces */
    --bg-primary: light-dark(#ffffff, #0f172a);
    --bg-secondary: light-dark(#f8fafc, #1e293b);
    --bg-header: light-dark(#dbeafe, #1e3a5f);
    --bg-highlight: light-dark(#f0f9ff, #253347);
    --bg-code: #0f172a;
    --text-code: #e2e8f0;

    /* Text */
    --text-primary: light-dark(#0f172a, #f1f5f9);
    --text-secondary: light-dark(#334155, #cbd5e1);
    --text-muted: light-dark(#64748b, #94a3b8);

    /* Links */
    --link: light-dark(#2563eb, #60a5fa);
    --link-hover: light-dark(#1d4ed8, #93c5fd);
    --link-visited: light-dark(#4f46e5, #a5b4fc);

    /* Borders */
    --border: light-dark(#e2e8f0, #334155);
    --border-strong: light-dark(#cbd5e1, #475569);

    /* Source backgrounds */
    --source-rdap: light-dark(#dbeafe, #1e3a5f);
    --source-whois: light-dark(#fef3c7, #422006);
    --source-both: light-dark(#d1fae5, #064e3b);

    /* Accent */
    --accent: #3b82f6;
    --accent-hover: light-dark(#2563eb, #60a5fa);
    --accent-focus: color-mix(in srgb, var(--accent) 35%, transparent);

    /* State colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Badge colors */
    --badge-positive-bg: light-dark(#dcfce7, #064e3b);
    --badge-positive-text: light-dark(#166534, #a7f3d0);
    --badge-caution-bg: light-dark(#fef3c7, #78350f);
    --badge-caution-text: light-dark(#92400e, #fde68a);
    --badge-danger-bg: light-dark(#fee2e2, #7f1d1d);
    --badge-danger-text: light-dark(#991b1b, #fecaca);

    /* Source status */
    --source-available-text: light-dark(#065f46, #a7f3d0);
    --source-unavail-bg: light-dark(#fee2e2, #7f1d1d);
    --source-unavail-text: light-dark(#991b1b, #fecaca);
    --source-loading-bg: light-dark(#dbeafe, #1e3a8a);
    --source-loading-text: light-dark(#1e40af, #93c5fd);

    /* Source indicators */
    --source-rdap-text: light-dark(#2563eb, #60a5fa);
    --source-whois-text: light-dark(#d97706, #fbbf24);

    /* Message colors */
    --msg-error-text: light-dark(#991b1b, #fecaca);
    --msg-error-bg: light-dark(#fee2e2, #7f1d1d);
    --msg-error-border: light-dark(#fecaca, #991b1b);
    --msg-warning-text: light-dark(#92400e, #fde68a);
    --msg-warning-bg: light-dark(#fef3c7, #78350f);
    --msg-warning-border: light-dark(#fde68a, #92400e);

    /* Type badges */
    --type-badge-domain-bg: light-dark(var(--source-rdap), rgba(59, 130, 246, 0.2));
    --type-badge-domain-text: light-dark(#1e40af, #93c5fd);
    --type-badge-ip-bg: light-dark(var(--source-whois), rgba(245, 158, 11, 0.2));
    --type-badge-ip-text: light-dark(#92400e, #fcd34d);
    --type-badge-asn-bg: light-dark(var(--source-both), rgba(16, 185, 129, 0.2));
    --type-badge-asn-text: light-dark(#065f46, #6ee7b7);

    /* Syntax highlighting */
    --hl-keyword: light-dark(#2563eb, #93c5fd);
    --hl-value: light-dark(#16a34a, #86efac);
    --hl-property: light-dark(#0f172a, #e2e8f0);
    --hl-comment: #64748b;
    --hl-type: light-dark(#7c3aed, #c4b5fd);

    /* Scrollbar */
    scrollbar-color: light-dark(#cbd5e1, #475569) transparent;
}

/* ── 2. Reset & Base ───────────────────────────────────────────────────── */

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s;

    &:hover {
        color: var(--link-hover);
        text-decoration: underline;
    }

    &:visited {
        color: var(--link-visited);
    }
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
}

/* ── 3. Layout ─────────────────────────────────────────────────────────── */

.container {
    max-width: 900px;
    margin-inline: auto;
    padding: clamp(var(--space-4), 4vw, var(--space-8)) var(--space-4);
}

header {
    text-align: center;
    margin-bottom: var(--space-8);
}

header h1 {
    font-size: clamp(1.75rem, 5vw + 0.5rem, 2.5rem);
    font-weight: 700;
    margin: 0 0 var(--space-2);
    color: var(--text-primary);
    text-wrap: balance;
}

.tagline {
    color: var(--text-muted);
    margin: 0;
}

footer {
    margin-top: var(--space-12);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-base);

    & a {
        color: var(--link);
    }
}

/* ── 4. Search ─────────────────────────────────────────────────────────── */

.search-box {
    display: flex;
    gap: var(--space-2);
    background: var(--bg-primary);
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);

    & input[type="text"] {
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-md);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        outline: none;
        background: var(--bg-primary);
        color: var(--text-primary);
        transition: border-color 0.15s, box-shadow 0.15s;

        &:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--accent-focus);
        }

        &:focus-visible {
            outline: none;
        }
    }

    & select {
        padding: var(--space-3);
        font-size: var(--text-base);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--bg-primary);
        color: var(--text-primary);
        cursor: pointer;
        accent-color: var(--accent);
    }

    & button {
        padding: var(--space-3) var(--space-6);
        font-size: var(--text-md);
        font-weight: 500;
        color: white;
        background: var(--accent);
        border: none;
        border-radius: var(--radius);
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: var(--space-2);
        transition: background 0.15s, transform 0.1s;

        &:hover {
            background: var(--accent-hover);
        }

        &:active {
            transform: scale(0.97);
        }
    }
}

.input-wrapper {
    position: relative;
    flex: 1;

    & input[type="text"] {
        width: 100%;
        padding-inline-end: 4rem;
    }
}

/* ── 5. Results Shell ──────────────────────────────────────────────────── */

.results {
    margin-top: var(--space-8);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

@keyframes results-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-loading {
    animation: results-enter 0.2s ease-out;
}

.results-header {
    padding: var(--space-4) var(--space-6);
    background: var(--bg-header);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);

    & h2 {
        margin: 0;
        font-size: var(--text-lg);
        font-weight: 600;
        text-wrap: balance;
    }

    & code {
        background: var(--bg-primary);
        padding: 0.125rem var(--space-2);
        border-radius: var(--radius-sm);
        font-size: 0.9em;
    }
}

.source-status {
    display: flex;
    gap: var(--space-3);
    font-size: var(--text-sm);

    & .source {
        padding: var(--space-1) var(--space-2);
        border-radius: var(--radius-sm);
        font-weight: 500;

        &.available {
            background: var(--source-both);
            color: var(--source-available-text);
        }

        &.unavailable {
            background: var(--source-unavail-bg);
            color: var(--source-unavail-text);
        }

        &.loading {
            background: var(--source-loading-bg);
            color: var(--source-loading-text);
        }

        &.registry {
            background: var(--bg-secondary);
            color: var(--text-secondary);
        }
    }
}

.cached-indicator {
    font-weight: 400;
    font-style: italic;
    opacity: 0.7;
}

/* ── 6. Tabs ───────────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-4);
    background: var(--bg-secondary);
}

.tab {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, transform 0.1s;

    &:hover {
        color: var(--text-primary);
    }

    &:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: -2px;
        z-index: 1;
    }

    &.active {
        color: var(--accent);
        border-bottom-color: var(--accent);
    }

    &:active {
        transform: scale(0.97);
    }
}

/* ── 7. View Toggle ────────────────────────────────────────────────────── */

.view-controls {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-5);
    padding: var(--space-1);
    background: var(--bg-secondary);
    border-radius: var(--radius);
    width: fit-content;
}

.view-option {
    display: flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: color 0.15s, background 0.15s, box-shadow 0.15s;

    &:hover {
        color: var(--text-primary);
    }

    & input[type="radio"] {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    &:has(input:checked) {
        color: var(--text-primary);
        background: var(--bg-primary);
        box-shadow: var(--shadow);
    }
}

.tab-panels {
    padding: var(--space-6);
}

.panel.hidden {
    display: none;
}

/* ── 8. Data Display ───────────────────────────────────────────────────── */

.data-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-card-header,
.raw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.data-card-header {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-header);
}

.raw-header {
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);

    & h3 {
        margin: 0;
        font-size: var(--text-base);
        font-weight: 500;
        color: var(--text-secondary);
    }
}

/* Field table */
.field-table {
    width: 100%;
    border-collapse: collapse;

    & tr {
        border-bottom: 1px solid var(--border);

        &:last-child {
            border-bottom: none;
        }
    }

    & th,
    & td {
        padding: var(--space-2) var(--space-4);
        text-align: start;
        vertical-align: top;
    }

    & th {
        width: 150px;
        font-weight: 500;
        font-size: var(--text-base);
        color: var(--text-muted);
        font-family: var(--font-mono);
        cursor: help;
        white-space: nowrap;
        transition: color 0.15s;

        &:hover {
            color: var(--text-secondary);
        }
    }

    & td {
        color: var(--text-primary);
        word-break: break-word;

        & code {
            background: var(--bg-secondary);
            padding: 0.125rem 0.375rem;
            border-radius: var(--radius-sm);
        }
    }

    & td.source-indicator {
        width: 70px;
        text-align: end;
        font-size: 0.6875rem;
        font-weight: 500;
        color: var(--text-muted);
        font-family: var(--font-mono);
        padding-inline-end: var(--space-4);
        white-space: nowrap;

        &.rdap {
            color: var(--source-rdap-text);
        }

        &.whois {
            color: var(--source-whois-text);
        }
    }

    /* Compact variant */
    &.compact {
        & th {
            font-weight: 600;
            font-size: 0.8125rem;
            padding: var(--space-1) var(--space-3) var(--space-1) 0;
            white-space: nowrap;
        }

        & td {
            font-size: 0.8125rem;
            padding: var(--space-1) 0;
        }
    }
}

/* Click-to-copy field values */
.field-value[data-controller="field-copy"] {
    cursor: copy;
    position: relative;
}

.field-table tr:has(.field-value[data-controller="field-copy"]:hover) {
    background: var(--bg-highlight);
}

.field-value[data-controller="field-copy"].copied::after {
    content: "Copied";
    position: absolute;
    top: var(--space-1);
    inset-inline-end: var(--space-2);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--success);
    animation: copied-fade 1s ease-out forwards;
}

@keyframes copied-fade {
    0%, 60% { opacity: 1; }
    100% { opacity: 0; }
}

/* Compare table */
.compare-scroll {
    overflow-x: auto;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
    table-layout: fixed;
    min-width: 400px;

    & thead {
        background: var(--bg-secondary);
    }

    & th {
        padding: var(--space-3) var(--space-4);
        text-align: start;
        font-weight: 600;
        color: var(--text-secondary);
        border-bottom: 2px solid var(--border);

        &:first-child {
            width: 140px;
            font-family: var(--font-mono);
            font-weight: 500;
        }
    }

    & tbody th,
    & tbody td {
        padding: var(--space-2) var(--space-4);
        vertical-align: top;
        border-bottom: 1px solid var(--border);
        word-break: break-word;
        overflow-wrap: break-word;
    }

    & tr:last-child td {
        border-bottom: none;
    }

    & tr.matches td {
        color: var(--text-muted);
    }

    & tr.differs {
        border-left: 3px solid var(--warning);

        & th,
        & td {
            color: var(--text-primary);
        }
    }

    & .no-value {
        color: var(--text-muted);
        font-style: italic;
    }

    & .rdap-value,
    & .whois-value {
        background: transparent;
    }
}

/* ── 9. Badges (consolidated) ──────────────────────────────────────────── */

.badge {
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;

    &.success {
        color: white;
        background: var(--success);
    }

    &.error {
        color: white;
        background: var(--error);
    }
}

.status-badge {
    display: inline-block;
    padding: 0.125rem var(--space-2);
    margin: 0.125rem 0;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--bg-secondary);
    color: var(--text-secondary);

    &.status-positive {
        background: var(--badge-positive-bg);
        color: var(--badge-positive-text);
    }

    &.status-lock {
        background: var(--badge-caution-bg);
        color: var(--badge-caution-text);
    }

    &.status-warning {
        background: var(--badge-danger-bg);
        color: var(--badge-danger-text);
    }
}

.expiry-badge {
    display: inline-block;
    padding: 0.125rem var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    margin-inline-start: var(--space-2);
}

.expiry-ok {
    background: var(--badge-positive-bg);
    color: var(--badge-positive-text);
}

.expiry-warning {
    background: var(--badge-caution-bg);
    color: var(--badge-caution-text);
}

.expiry-critical {
    background: var(--badge-danger-bg);
    color: var(--badge-danger-text);
}

.expiry-expired {
    background: var(--badge-danger-bg);
    color: var(--badge-danger-text);
    font-weight: 600;
}

/* Small semantic badges (DNS intel, tags) */
.badge-positive,
.badge-caution,
.badge-danger,
.badge-neutral,
.badge-dns-tag {
    font-size: var(--text-xs);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.badge-positive,
.badge-dns-tag {
    background: var(--badge-positive-bg);
    color: var(--badge-positive-text);
}

.badge-caution {
    background: var(--badge-caution-bg);
    color: var(--badge-caution-text);
}

.badge-danger {
    background: var(--badge-danger-bg);
    color: var(--badge-danger-text);
}

.badge-neutral {
    background: var(--bg-highlight);
    color: var(--text-muted);
}

.badge-dns-tag {
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── 10. DNS Records ──────────────────────────────────────────────────── */

.dns-records {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);

    & [data-view-toggle-target="panel"] {
        display: flex;
        flex-direction: column;
        gap: var(--space-5);
    }
}

.dns-record-group {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);

    & h4 {
        margin: 0 0 var(--space-2);
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--text-secondary);
    }

    & .record-count {
        font-weight: 400;
        color: var(--text-muted);
    }
}

.dns-records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;

    & tr {
        border-bottom: 1px solid var(--border);
        cursor: pointer;
        transition: background 0.15s;

        &:last-child {
            border-bottom: none;
        }

        &:hover {
            background: var(--bg-highlight);
        }
    }

    & td {
        padding: 0.375rem var(--space-3);
        vertical-align: middle;

        &:first-child {
            padding-inline-start: 0;
        }

        & code {
            background: var(--bg-primary);
            padding: 0.125rem 0.375rem;
            border-radius: var(--radius-sm);
            font-size: 0.8125rem;
        }
    }
}

.dns-ttl {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: end;
    white-space: nowrap;
}

.dns-priority {
    font-weight: 600;
    color: var(--text-secondary);
    width: 3rem;
    text-align: center;
}

.dns-caa-tag {
    width: 5rem;
}

.dns-txt-record {
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    flex-wrap: wrap;

    &:last-child {
        border-bottom: none;
    }

    & code {
        word-break: break-all;
        font-size: var(--text-sm);
        cursor: pointer;
        flex: 1;
        min-width: 0;
    }
}

.dns-intel-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    font-size: 0.8125rem;
}

.dns-intel-detail {
    color: var(--text-secondary);
}

.dns-resolver-ip {
    width: 8rem;
}

.dns-no-records {
    padding: var(--space-4);
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.dns-metadata {
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ── 11. Raw Panels ────────────────────────────────────────────────────── */

.raw-panels {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.raw-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;

    & pre {
        margin: 0;
        padding: var(--space-4);
        background: var(--bg-code);
        color: var(--text-code);
        font-size: var(--text-sm);
        overflow-x: auto;
        max-height: 400px;
    }

    & code {
        font-family: var(--font-mono);
        background: none;
        padding: 0;
    }

    /* Syntax highlighting */
    & .hl-keyword { color: var(--hl-keyword); }
    & .hl-value { color: var(--hl-value); }
    & .hl-property { color: var(--hl-property); }
    & .hl-comment { color: var(--hl-comment); }
    & .hl-type { color: var(--hl-type); }
}

.copy-btn {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-block-size: 1.75rem;
    transition: color 0.15s, border-color 0.15s, transform 0.1s;

    &:hover {
        color: var(--text-primary);
        border-color: var(--border-strong);
    }

    &:disabled {
        cursor: default;
    }

    &:active {
        transform: scale(0.95);
    }
}

/* ── 12. Link Sections (shared base) ───────────────────────────────────── */

.suggested-lookups,
.related-links {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);

    & h4 {
        margin: 0 0 var(--space-3);
        font-size: var(--text-sm);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-muted);
    }

    & ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2) var(--space-6);
    }

    & li a {
        font-size: var(--text-base);
        display: inline-flex;
        align-items: center;
        gap: var(--space-1);

        &::after {
            font-size: 0.75em;
            opacity: 0.5;
        }
    }
}

.suggested-lookups li a::after {
    content: "\2192";
}

.related-links li a::after {
    content: "\2197";
}

/* ── 13. Components ────────────────────────────────────────────────────── */

/* Abuse contact */
.abuse-action {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: var(--space-1) 0.625rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--text-base);
    transition: background 0.15s, border-color 0.15s;

    &,
    &:visited,
    &:hover {
        color: var(--link);
        text-decoration: none;
    }

    &::before {
        content: "\2709";
        font-size: var(--text-md);
    }

    &:hover {
        background: var(--bg-highlight);
        border-color: var(--accent);
    }
}

/* Collapsible notices */
.field-collapsible {
    font-size: 0.78rem;

    & summary {
        cursor: pointer;
        list-style: none;
        display: flex;
        align-items: baseline;
        gap: var(--space-2);

        &::-webkit-details-marker {
            display: none;
        }
    }

    &[open] summary .notice-text,
    &[open] .collapsible-hint {
        display: none;
    }

    &[open] summary::after {
        content: "collapse";
        font-size: 0.6875rem;
        color: var(--accent);
        cursor: pointer;
    }
}

.collapsible-hint {
    font-size: 0.6875rem;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.collapsible-body {
    margin-top: 0.375rem;
}

.notice-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Error card */
.error-card {
    text-align: center;
    padding: var(--space-10) var(--space-6);
}

.error-card-message {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: var(--space-5);
}

.error-card-retry {
    display: inline-block;
    padding: var(--space-2) var(--space-5);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;

    &:hover {
        background: var(--accent);
        color: #fff;
    }
}

/* Alert messages */
.error-message {
    padding: var(--space-4);
    color: var(--msg-error-text);
    background: var(--msg-error-bg);
    border: 1px solid var(--msg-error-border);
    border-radius: var(--radius);
}

.warning-message {
    padding: var(--space-4);
    color: var(--msg-warning-text);
    background: var(--msg-warning-bg);
    border: 1px solid var(--msg-warning-border);
    border-radius: var(--radius);
    margin-bottom: var(--space-4);
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
    padding: var(--space-4) 0;
}

/* Spinner */
.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── 14. Overlays ──────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-8);
    max-width: 360px;
    width: 90%;
    box-shadow: var(--shadow-md);

    & h3 {
        margin: 0 0 var(--space-4);
        font-size: 1.1rem;
        color: var(--text-primary);
    }

    & button {
        width: 100%;
        padding: var(--space-2);
        background: var(--accent);
        color: #fff;
        border: none;
        border-radius: var(--radius);
        cursor: pointer;
        font-size: 0.9rem;
        transition: background 0.15s;

        &:hover {
            background: var(--accent-hover);
        }
    }
}

.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-4);

    & td {
        padding: 0.4rem 0;
        color: var(--text-secondary);

        &:first-child {
            width: 60px;
        }
    }
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    box-shadow: 0 1px 0 var(--border);
    color: var(--text-primary);
}

/* ── 15. History Sidebar ───────────────────────────────────────────────── */

.history-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    width: 280px;
    max-width: 85vw;
    block-size: 100dvh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
    z-index: 90;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-bottom: 1px solid var(--border);

    & h3 {
        margin: 0;
        font-size: 0.95rem;
        color: var(--text-primary);
    }
}

.history-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;

    &:hover {
        color: var(--text-primary);
    }
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;

    & li {
        border-bottom: 1px solid var(--border);

        & a {
            display: block;
            padding: 0.6rem var(--space-4);
            color: var(--link);
            text-decoration: none;
            font-family: var(--font-mono);
            font-size: 0.85rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            transition: background 0.15s;

            &:hover {
                background: var(--bg-highlight);
            }
        }
    }
}

.history-type {
    display: none;
}

.history-empty {
    padding: var(--space-4);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.history-clear {
    margin: var(--space-2) var(--space-4) var(--space-4);
    padding: 0.4rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;

    &:hover {
        color: var(--error);
        border-color: var(--error);
    }
}

/* ── 16. Loading States ────────────────────────────────────────────────── */

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.15; }
}

.loading-pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.loading-placeholder {
    padding: var(--space-6);
}

.skeleton-row {
    height: var(--space-5);
    background: var(--bg-secondary);
    border-radius: 4px;
    margin-bottom: var(--space-3);
    animation: skeleton-pulse 1.5s ease-in-out infinite;

    &:nth-child(1) { width: 40%; }
    &:nth-child(2) { width: 65%; animation-delay: 0.1s; }
    &:nth-child(3) { width: 50%; animation-delay: 0.2s; }
    &:nth-child(4) { width: 75%; animation-delay: 0.3s; }
    &:nth-child(5) { width: 35%; animation-delay: 0.4s; }
}

/* ── 17. Content Pages ─────────────────────────────────────────────────── */

.content-page {
    max-width: 700px;

    & h1 {
        font-size: 2rem;
        margin-bottom: var(--space-8);
        color: var(--text-primary);
        text-wrap: balance;
    }

    & h2 {
        font-size: var(--text-xl);
        font-weight: 600;
        margin: var(--space-8) 0 var(--space-4);
        color: var(--text-primary);
        text-wrap: balance;
    }

    & p {
        margin-bottom: var(--space-4);
        color: var(--text-secondary);
        line-height: 1.7;
        text-wrap: pretty;
    }

    & ul {
        margin: 0 0 var(--space-6);
        padding-inline-start: var(--space-6);
    }

    & li {
        margin-bottom: var(--space-2);
        color: var(--text-secondary);
        line-height: 1.6;
    }

    & section {
        margin-bottom: var(--space-8);
    }
}

.content-footer {
    margin-top: var(--space-12);
    padding-top: var(--space-8);
    border-top: 1px solid var(--border);
}

.error-page {
    text-align: center;
    padding: var(--space-12) var(--space-4);

    & h2 {
        font-size: 1.5rem;
        color: var(--text-primary);
        margin-bottom: var(--space-3);
    }

    & p {
        color: var(--text-secondary);
        margin-bottom: var(--space-4);
    }

    & a {
        color: var(--link);
    }
}

/* ── 18. Utilities ─────────────────────────────────────────────────────── */

.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-muted);
}

.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;
    z-index: 999;
    padding: var(--space-2) var(--space-4);
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 0 0 var(--radius) 0;

    &:focus-visible {
        left: 0;
    }
}

/* ── 19. Type Badge ────────────────────────────────────────────────────── */

.type-badge {
    position: absolute;
    inset-inline-end: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    pointer-events: none;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;

    &:not(:empty) {
        opacity: 0.85;
    }
}

.type-badge-domain {
    background: var(--type-badge-domain-bg);
    color: var(--type-badge-domain-text);
}

.type-badge-ip {
    background: var(--type-badge-ip-bg);
    color: var(--type-badge-ip-text);
}

.type-badge-asn {
    background: var(--type-badge-asn-bg);
    color: var(--type-badge-asn-text);
}

/* ── 20. Examples ──────────────────────────────────────────────────────── */

.examples {
    text-align: center;
    margin: var(--space-3) 0 0;
    font-size: 0.8125rem;
    color: var(--text-muted);

    & a {
        color: var(--text-muted);
        text-decoration: underline;
        text-decoration-style: dotted;
        text-underline-offset: 2px;

        &:hover {
            color: var(--link);
        }
    }
}

/* ── 21. Responsive ────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .search-box {
        flex-wrap: wrap;

        & input[type="text"] {
            width: 100%;
        }

        & select,
        & button {
            flex: 1;
        }
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .field-table {
        & th {
            width: 110px;
            font-size: 0.8125rem;
        }

        & th,
        & td {
            padding: 0.375rem var(--space-2);
        }

        & td.source-indicator {
            width: 40px;
            padding-inline-end: var(--space-2);
            font-size: var(--text-xs);
        }
    }

    .tabs {
        overflow-x: auto;
    }

    .view-controls {
        width: 100%;
    }

    .view-option {
        flex: 1;
        justify-content: center;
    }

    .compare-scroll {
        overflow-x: visible;
    }

    .compare-table {
        min-width: unset;
        font-size: 0.8125rem;

        & thead {
            display: none;
        }

        & tbody {
            display: flex;
            flex-direction: column;
            gap: var(--space-3);
        }

        & tbody tr {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--space-1) var(--space-3);
            padding: var(--space-3);
            border: 1px solid var(--border);
            border-radius: var(--radius);
        }

        & tbody th {
            grid-column: 1 / -1;
            width: auto;
            padding: 0;
            border-bottom: none;
            font-size: var(--text-sm);
            margin-bottom: var(--space-1);
        }

        & tbody td {
            padding: 0;
            border-bottom: none;

            &::before {
                display: block;
                font-size: var(--text-xs);
                font-weight: 600;
                text-transform: uppercase;
                letter-spacing: 0.05em;
                color: var(--text-muted);
                margin-bottom: 0.125rem;
            }
        }

        & .rdap-value::before {
            content: "RDAP";
        }

        & .whois-value::before {
            content: "WHOIS";
        }

        & tr.differs {
            border-left: none;
            border-top: 3px solid var(--warning);
        }

        & tr.matches td {
            color: var(--text-muted);
        }

        & code {
            font-size: 0.6875rem;
        }
    }

    .related-links ul {
        flex-direction: column;
        gap: var(--space-2);
    }

    .dns-records-table td {
        padding: var(--space-1) var(--space-2);
    }

    .dns-ttl {
        font-size: 0.6875rem;
    }
}

@media (max-width: 400px) {
    .field-table,
    .field-table tbody,
    .field-table tr,
    .field-table th,
    .field-table td {
        display: block;
    }

    .field-table tr {
        padding: var(--space-2) 0;
    }

    .field-table th {
        width: auto;
        white-space: normal;
        padding-bottom: 0.125rem;
        font-size: var(--text-sm);
    }

    .field-table td {
        padding: 0.125rem 0;
    }

    .field-table td.source-indicator {
        text-align: start;
        padding: 0.125rem 0;
        width: auto;
    }

    .dns-record-group {
        padding: var(--space-2) var(--space-3);
    }
}

/* ── 22. Reduced Motion ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .skeleton-row,
    .loading-pulse {
        animation: none;
        opacity: 0.5;
    }
}

/* ── 23. Print ─────────────────────────────────────────────────────────── */

@media print {
    .tabs,
    .view-controls,
    .copy-btn,
    .related-links,
    .suggested-lookups,
    .history-sidebar,
    .modal-overlay {
        display: none;
    }

    .panel.hidden {
        display: block !important;
    }

    .results {
        box-shadow: none;
        border: 1px solid #000;
    }

    .data-card,
    .raw-panel {
        page-break-inside: avoid;
    }
}
