/* Homophone Finder — an evidence ledger with hard editorial rules.
   All selectors are feature-scoped. Colour supplements explicit text labels;
   it never carries match or coverage status by itself. */

.hf-page {
    --hf-ink: var(--color-text, #0b1020);
    --hf-muted: var(--color-text-muted, #555a62);
    --hf-line: var(--color-border, #c9c6bd);
    --hf-paper: var(--color-surface, #fffdf7);
    --hf-cobalt: var(--color-accent, #1748ff);
    --hf-acid: #e7ff39;
    max-width: 75rem;
    margin: 0 auto;
    padding: 0 1rem 5rem;
    color: var(--hf-ink);
}

.hf-kicker {
    margin: 0 0 0.45rem;
    color: var(--hf-muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.hf-kicker--light {
    color: var(--hf-acid);
}

.hf-masthead {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(19rem, 0.8fr);
    gap: clamp(1.5rem, 5vw, 5rem);
    margin: 2rem 0 1.4rem;
    align-items: end;
}

.hf-masthead h1 {
    max-width: 12ch;
    margin: 0;
    font-size: clamp(3rem, 8vw, 6.8rem);
    line-height: 0.87;
    letter-spacing: -0.065em;
}

.hf-masthead h1 span {
    display: block;
    white-space: nowrap;
}

.hf-deck {
    margin: 0;
    padding: 0.9rem 0 0.15rem;
    border-top: 5px solid var(--hf-cobalt);
    font-family: var(--font-serif, Georgia, serif);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    line-height: 1.5;
}

.hf-workbench {
    display: grid;
    grid-template-columns: minmax(15rem, 0.72fr) minmax(22rem, 1.28fr);
    margin: 2rem 0 3rem;
    border: 2px solid var(--hf-ink);
    background: var(--hf-ink);
    color: #fff;
}

.hf-workbench__intro,
.hf-form {
    padding: clamp(1.15rem, 3vw, 2rem);
}

.hf-workbench__intro {
    border-right: 1px solid rgba(255, 255, 255, 0.35);
}

.hf-workbench__intro h2 {
    max-width: 12ch;
    margin: 0 0 1rem;
    color: #fff;
    font-size: clamp(1.7rem, 4vw, 3.2rem);
    line-height: 0.98;
    letter-spacing: -0.035em;
}

.hf-workbench__intro p:last-child {
    margin: 0;
    color: #d8dbe4;
    line-height: 1.55;
}

.hf-form {
    background: var(--hf-cobalt);
}

.hf-form > label {
    display: block;
    margin-bottom: 0.55rem;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hf-form__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0;
}

.hf-form__row .input {
    min-width: 0;
    min-height: 3.6rem;
    border: 2px solid #fff;
    border-radius: 0;
    background: #fff;
    color: #0b1020;
    font-size: 1.15rem;
}

.hf-form__row .btn {
    min-height: 3.6rem;
    border: 2px solid var(--hf-acid);
    border-radius: 0;
    background: var(--hf-acid);
    color: #0b1020;
    white-space: nowrap;
}

.hf-form__row .btn:hover {
    border-color: #fff;
    background: #fff;
}

.hf-form__row .input:focus-visible,
.hf-form__row .btn:focus-visible {
    position: relative;
    z-index: 1;
    outline: 3px solid var(--hf-acid);
    outline-offset: 3px;
}

#hf-word-help,
.hf-noscript {
    margin: 0.7rem 0 0;
    color: #eef0ff;
    font-size: 0.86rem;
    line-height: 1.5;
}

.hf-validation {
    margin: 0.7rem 0 0;
    padding: 0.6rem 0.75rem;
    border: 2px solid #fff;
    background: #710018;
    color: #fff;
    font-weight: 700;
}

.hf-privacy {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.7rem clamp(1.15rem, 3vw, 2rem);
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    color: #d8dbe4;
    font-size: 0.83rem;
}

.hf-privacy code {
    color: var(--hf-acid);
}

.hf-report {
    margin: 0 0 3.5rem;
    padding: clamp(1rem, 3vw, 2rem);
    border: 3px solid var(--hf-ink);
    background: var(--hf-paper);
}

.hf-report__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--hf-ink);
    align-items: flex-start;
}

.hf-report__header h2 {
    max-width: 22ch;
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3.35rem);
    line-height: 1;
    letter-spacing: -0.04em;
}

.hf-status {
    flex: 0 0 auto;
    padding: 0.5rem 0.65rem;
    border: 2px solid var(--hf-ink);
    background: var(--hf-acid);
    color: #0b1020;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hf-status--no_matches,
.hf-status--no_pronunciation,
.hf-status--not_in_lexicon,
.hf-status--restricted {
    background: transparent;
    color: var(--hf-ink);
}

.hf-report__summary {
    max-width: 66rem;
    margin: 1rem 0 1.4rem;
    font-family: var(--font-serif, Georgia, serif);
    font-size: 1.1rem;
    line-height: 1.55;
}

.hf-groups {
    display: grid;
    gap: 1rem;
}

.hf-group {
    border: 1px solid var(--hf-ink);
}

.hf-group__sound {
    display: grid;
    grid-template-columns: minmax(11rem, 0.55fr) minmax(18rem, 1.45fr);
    gap: 1rem;
    padding: 1rem;
    background: var(--hf-cobalt);
    color: #fff;
}

.hf-group__label {
    margin: 0 0 0.35rem;
    color: #dfe4ff;
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hf-group__sound h3 {
    margin: 0;
    color: #fff;
    font-family: var(--font-serif, Georgia, serif);
    font-size: clamp(1.75rem, 4vw, 3rem);
    line-height: 1;
}

.hf-sound-facts {
    display: grid;
    grid-template-columns: minmax(12rem, 2fr) repeat(2, minmax(5rem, 0.7fr));
    gap: 0;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.hf-sound-facts div {
    min-width: 0;
    padding: 0.65rem;
    border-right: 1px solid rgba(255, 255, 255, 0.6);
}

.hf-sound-facts div:last-child {
    border-right: 0;
}

.hf-sound-facts dt {
    color: #dfe4ff;
    font-size: 0.67rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hf-sound-facts dd {
    margin: 0.3rem 0 0;
    overflow-wrap: anywhere;
    font-weight: 750;
}

.hf-sound-facts code {
    color: #fff;
}

.hf-match-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.hf-match-list > li {
    display: grid;
    grid-template-columns: minmax(10rem, 0.45fr) minmax(16rem, 1.55fr);
    border-top: 1px solid var(--hf-line);
}

.hf-match-list > li:first-child {
    border-top: 0;
}

.hf-match__word,
.hf-match__evidence {
    padding: 0.9rem 1rem;
}

.hf-match__word {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--hf-line);
}

.hf-match__word > span {
    font-family: var(--font-serif, Georgia, serif);
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    line-height: 1;
}

.hf-match__word small {
    margin-top: 0.4rem;
    color: var(--hf-muted);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hf-match__evidence p {
    margin: 0;
    line-height: 1.5;
}

.hf-match__meaning {
    margin-top: 0.4rem !important;
    color: var(--hf-muted);
    font-family: var(--font-serif, Georgia, serif);
}

.hf-empty-sound,
.hf-negative {
    margin: 0;
    padding: 1rem;
    border-top: 1px solid var(--hf-line);
    line-height: 1.55;
}

.hf-warning,
.hf-gloss-note {
    margin: 1rem 0 0;
    padding: 0.7rem 0.85rem;
    border-left: 4px solid var(--hf-cobalt);
    background: color-mix(in srgb, var(--hf-cobalt) 7%, var(--hf-paper));
    font-size: 0.88rem;
    line-height: 1.5;
}

.hf-source-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--hf-ink);
    color: var(--hf-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.hf-source-strip p {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.hf-source-strip code {
    white-space: normal;
    word-break: break-all;
}

.hf-definition,
.hf-method,
.hf-examples,
.hf-limits,
.hf-faq,
.hf-related {
    margin: 4rem 0 0;
}

.hf-definition > h2,
.hf-section-heading h2,
.hf-examples > h2,
.hf-limits > div:first-child h2,
.hf-faq > h2,
.hf-related > h2 {
    max-width: 20ch;
    margin: 0 0 1rem;
    font-size: clamp(1.9rem, 4vw, 3.7rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.hf-definition > p:not(.hf-kicker) {
    max-width: 58rem;
    font-family: var(--font-serif, Georgia, serif);
    font-size: 1.08rem;
    line-height: 1.6;
}

.hf-table-wrap {
    margin-top: 1.2rem;
    overflow-x: auto;
    border: 2px solid var(--hf-ink);
}

.hf-comparison {
    width: 100%;
    min-width: 47rem;
    border-collapse: collapse;
    background: var(--hf-paper);
}

.hf-comparison th,
.hf-comparison td {
    padding: 0.8rem;
    border-right: 1px solid var(--hf-line);
    border-bottom: 1px solid var(--hf-line);
    text-align: left;
    vertical-align: top;
}

.hf-comparison th:last-child,
.hf-comparison td:last-child {
    border-right: 0;
}

.hf-comparison tr:last-child th,
.hf-comparison tr:last-child td {
    border-bottom: 0;
}

.hf-comparison thead th {
    background: var(--hf-ink);
    color: #fff;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hf-method {
    padding: clamp(1rem, 3vw, 2rem);
    border-top: 10px solid var(--hf-cobalt);
    background: var(--hf-paper);
}

.hf-method-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 1.5rem 0 0;
    padding: 0;
    border-top: 2px solid var(--hf-ink);
    border-left: 2px solid var(--hf-ink);
    list-style: none;
}

.hf-method-list > li {
    display: grid;
    grid-template-columns: 3.2rem 1fr;
    gap: 0.8rem;
    padding: 1rem;
    border-right: 2px solid var(--hf-ink);
    border-bottom: 2px solid var(--hf-ink);
}

.hf-method-list > li > span {
    color: var(--hf-cobalt);
    font-family: var(--font-serif, Georgia, serif);
    font-size: 1.45rem;
    font-weight: 800;
}

.hf-method-list h3 {
    margin: 0 0 0.45rem;
    font-size: 1.05rem;
}

.hf-method-list p {
    margin: 0;
    color: var(--hf-muted);
    line-height: 1.55;
}

.hf-rule {
    display: grid;
    grid-template-columns: 11rem 1fr;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--hf-ink);
    color: #fff;
}

.hf-rule p {
    margin: 0;
}

.hf-rule__label {
    color: var(--hf-acid);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.hf-rule code {
    color: var(--hf-acid);
}

.hf-example-grid,
.hf-limits__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 2px solid var(--hf-ink);
    border-left: 2px solid var(--hf-ink);
}

.hf-example-grid article,
.hf-limits__grid article {
    position: relative;
    padding: 1.2rem;
    border-right: 2px solid var(--hf-ink);
    border-bottom: 2px solid var(--hf-ink);
    background: var(--hf-paper);
}

.hf-example-grid__number {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.35rem 0.5rem;
    background: var(--hf-cobalt);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
}

.hf-example-grid h3,
.hf-limits__grid h3 {
    margin: 0 2rem 0.6rem 0;
    font-family: var(--font-serif, Georgia, serif);
    font-size: 1.35rem;
}

.hf-example-grid p,
.hf-limits__grid p {
    margin: 0;
    color: var(--hf-muted);
    line-height: 1.6;
}

.hf-limits {
    display: grid;
    grid-template-columns: minmax(13rem, 0.45fr) minmax(25rem, 1.55fr);
    gap: 2rem;
}

.hf-faq__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid var(--hf-ink);
}

.hf-faq details {
    border-bottom: 1px solid var(--hf-ink);
}

.hf-faq details:nth-child(odd) {
    border-right: 1px solid var(--hf-ink);
}

.hf-faq summary {
    padding: 1rem 2.5rem 1rem 0;
    cursor: pointer;
    font-weight: 800;
}

.hf-faq details:nth-child(even) summary,
.hf-faq details:nth-child(even) p {
    padding-left: 1rem;
}

.hf-faq summary:focus-visible {
    outline: 3px solid var(--hf-cobalt);
    outline-offset: 3px;
}

.hf-faq details p {
    margin: 0;
    padding: 0 2.5rem 1rem 0;
    color: var(--hf-muted);
    line-height: 1.55;
}

.hf-related {
    padding: 1.4rem;
    border: 2px solid var(--hf-ink);
    background: var(--hf-acid);
    color: #0b1020;
}

.hf-related .hf-kicker {
    color: #30350e;
}

.hf-related > h2 {
    color: #0b1020;
}

.hf-related ul {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin: 0;
    padding: 0;
    border-top: 2px solid #0b1020;
    list-style: none;
}

.hf-related li {
    border-right: 1px solid #0b1020;
}

.hf-related li:last-child {
    border-right: 0;
}

.hf-related a {
    display: flex;
    min-height: 7rem;
    padding: 0.9rem;
    color: #0b1020;
    flex-direction: column;
    justify-content: space-between;
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
}

.hf-related a:hover,
.hf-related a:focus-visible {
    background: #0b1020;
    color: #fff;
}

.hf-related a:focus-visible {
    outline: 3px solid var(--hf-cobalt);
    outline-offset: 3px;
}

.hf-related a span {
    font-size: 0.76rem;
    font-weight: 650;
}

[data-theme="dark"] .hf-page {
    --hf-ink: #f3f1e9;
    --hf-muted: #b9bdc7;
    --hf-line: #5d626d;
    --hf-paper: #151820;
}

[data-theme="dark"] .hf-workbench,
[data-theme="dark"] .hf-rule,
[data-theme="dark"] .hf-comparison thead th {
    background: #080a10;
}

[data-theme="dark"] .hf-status--no_matches,
[data-theme="dark"] .hf-status--no_pronunciation,
[data-theme="dark"] .hf-status--not_in_lexicon,
[data-theme="dark"] .hf-status--restricted {
    color: #f3f1e9;
}

@media (max-width: 760px) {
    /* The shared contextual tool row is wider than small screens by design;
       contain that width as a local scroller rather than widening the page. */
    .tool-header-bar {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
    }

    .tool-header-bar .tool-nav {
        width: max-content;
        min-width: 100%;
    }

    .hf-page {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .hf-masthead,
    .hf-workbench,
    .hf-limits {
        grid-template-columns: 1fr;
    }

    .hf-masthead {
        gap: 1.2rem;
    }

    .hf-masthead h1 {
        max-width: none;
    }

    .hf-workbench__intro {
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    }

    .hf-form__row,
    .hf-group__sound,
    .hf-match-list > li,
    .hf-source-strip,
    .hf-method-list,
    .hf-rule,
    .hf-example-grid,
    .hf-limits__grid,
    .hf-faq__grid,
    .hf-related ul {
        grid-template-columns: 1fr;
    }

    .hf-form__row .btn {
        width: 100%;
    }

    .hf-report__header {
        flex-direction: column;
    }

    .hf-sound-facts {
        grid-template-columns: 1fr;
    }

    .hf-sound-facts div {
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    }

    .hf-sound-facts div:last-child {
        border-bottom: 0;
    }

    .hf-match__word {
        border-right: 0;
        border-bottom: 1px solid var(--hf-line);
    }

    .hf-method-list,
    .hf-example-grid,
    .hf-limits__grid {
        border-left: 0;
    }

    .hf-method-list > li,
    .hf-example-grid article,
    .hf-limits__grid article {
        border-right: 0;
    }

    .hf-faq details:nth-child(odd) {
        border-right: 0;
    }

    .hf-faq details:nth-child(even) summary,
    .hf-faq details:nth-child(even) p {
        padding-left: 0;
    }

    .hf-related li {
        border-right: 0;
        border-bottom: 1px solid #0b1020;
    }

    .hf-related li:last-child {
        border-bottom: 0;
    }

    .hf-related a {
        min-height: 5.5rem;
    }
}

@media print {
    .hf-workbench,
    .hf-related,
    .tool-header-bar {
        display: none !important;
    }

    .hf-page {
        max-width: none;
        padding: 0;
    }

    .hf-report,
    .hf-group,
    .hf-method,
    .hf-example-grid article,
    .hf-limits__grid article {
        break-inside: avoid;
        background: #fff !important;
        color: #000 !important;
        box-shadow: none;
    }
}
