/*
 * holiday-entitlement.co.uk
 *
 * Loaded after site.css, so it only has to state what changes.
 *
 * The idea: holiday is not a sum of money, it is an allowance you count and
 * then spend down. Five point six weeks, twenty-eight days for most people, and
 * the only question anyone really has is how many are left. So the page is a
 * tally sheet: the entitlement counted out, the days taken struck off, and what
 * remains set larger than anything else on the site. The masthead is printed
 * five-bar gate tally marks.
 *
 * Its neighbours in this family answer money questions and are set in money
 * documents: a payslip, a ledger, a record card, a week scale. This one is the
 * only count, which is why it gets the only warm colour and the only slab.
 *
 * What it replaces: "Holiday Entitlement Calculator" over "Calculate Your UK
 * Statutory Holiday", a section headed "What This Site Does", and a tracker
 * whose four balance cards gave the total, the days taken, the days booked and
 * the days remaining exactly the same weight, when only the last of those is
 * the reason anyone opened it.
 */

/* ------------------------------------------------------------------ type */

:root {
    --step-6: 3rem;
    --step-7: 4.4rem;

    /*
     * Zilla Slab. A slab has the blunt, printed, stock-book quality this wants,
     * and it is the one voice in the family that is not either a grotesque or a
     * text serif.
     */
    --font-display: 'Zilla Slab', Rockwell, Georgia, serif;
    --font-figure: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

    --accent: #8A4A16;
    --accent-deep: #6B3910;
    --accent-tint: #F7EEE5;
    --board: #4E2A0C;
}

.masthead-kicker,
.section-index,
.field-name,
.form-legend,
.result-label,
.balance-label,
.tally-label {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-feature-settings: 'tnum';
}

/* --------------------------------------------------------- the running head */

/* The nav carries the colour on every page, so the site does not go quiet past the tool. */
.site-nav {
    background: var(--board);
    border-bottom: 0;
}

.site-nav .nav-brand,
.site-nav .nav-brand:hover {
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    opacity: 0.88;
    padding-block: 0.2rem;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    opacity: 1;
    border-bottom-color: rgba(255, 255, 255, 0.6);
}

/* Current page marked by a rule and a weight, not by colour alone. */
.nav-links a[aria-current] {
    opacity: 1;
    font-weight: 700;
    border-bottom-color: #fff;
}

.nav-links a:focus-visible,
.site-nav .nav-brand:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

/* ---------------------------------------------------------- the masthead */

/*
 * Full bleed. The tally is multiplied over the accent rather than laid on top,
 * which can only darken the ground: white on this band is never worse than
 * white on the flat accent, which measures 6.8:1.
 */
.masthead {
    background-color: var(--accent);
    background-image: url('/img/tally.webp');
    background-size: 1024px auto;
    background-blend-mode: multiply;
    color: #fff;
    padding-block: clamp(2.5rem, 7vw, 4.5rem) clamp(2rem, 5vw, 3.25rem);
    border-bottom: 5px solid var(--board);
}

.masthead-inner {
    max-width: var(--page);
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2rem);
}

.masthead-kicker {
    display: block;
    color: #fff;
    opacity: 0.85;
    margin-bottom: 1.1rem;
}

.masthead h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 6.4vw, var(--step-6));
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.02em;
    max-width: 18ch;
    color: #fff;
    text-wrap: balance;
}

.masthead-standfirst {
    margin-top: 1.1rem;
    font-size: var(--step-1);
    line-height: 1.5;
    max-width: 50ch;
    color: #fff;
    opacity: 0.94;
}

/* --------------------------------------------------------------- the grid */

.doc {
    padding-block: clamp(2rem, 5vw, 3.5rem) 3rem;
}

.doc-grid {
    display: grid;
    gap: clamp(0.75rem, 3vw, 2.5rem);
}

@media (min-width: 60rem) {
    .doc-grid {
        grid-template-columns: 9rem minmax(0, 1fr);
        align-items: start;
    }
}

.doc-grid + .doc-grid {
    margin-top: clamp(2.25rem, 5vw, 3.5rem);
    padding-top: clamp(2.25rem, 5vw, 3.5rem);
    border-top: 1px solid var(--rule);
}

.section-index {
    color: var(--accent);
    padding-top: 0.4rem;
}

@media (min-width: 60rem) {
    .section-index {
        text-align: right;
        border-top: 2px solid var(--accent);
    }
}

/* --------------------------------------------------------------- the form */

.calculator-card {
    background: var(--card);
    border: 1px solid var(--rule-strong);
    border-top: 5px solid var(--accent);
    border-radius: 0;
    box-shadow: none;
    padding: clamp(1.25rem, 4vw, 2.25rem);
}

.calculator-card .form-legend {
    color: var(--accent);
    margin-bottom: 1.5rem !important;
}

.fields {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.75rem;
}

@media (min-width: 46rem) {
    .fields {
        grid-template-columns: 1fr 1fr;
    }
}

.fields > li {
    display: grid;
    grid-template-columns: 1.7rem minmax(0, 1fr);
    column-gap: 0.6rem;
    align-items: baseline;
    margin: 0;
}

.field-num {
    font-family: var(--font-figure);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.field-name {
    display: block;
    color: var(--ink-soft);
    margin-bottom: 0.4rem;
}

/*
 * Ruled baselines rather than boxes. The rule takes the accent on focus and the
 * outline is kept as well, because a colour change alone is not a focus
 * indicator for anyone who cannot see the colour.
 */
.calculator-card input[type='number'],
.calculator-card input[type='date'],
.calculator-card input[type='text'],
.calculator-card select {
    width: 100%;
    border: 0 !important;
    border-bottom: 2px solid var(--rule-strong) !important;
    border-radius: 0;
    background: transparent;
    padding: 0.35rem 0 0.45rem;
    font-family: var(--font-figure);
    font-size: 1.05rem;
    color: var(--ink);
    box-shadow: none;
}

.calculator-card select,
.calculator-card input[type='text'] {
    font-family: var(--font-body);
    font-size: 0.98rem;
}

.calculator-card input:hover,
.calculator-card select:hover {
    border-bottom-color: var(--ink-soft) !important;
}

.calculator-card input:focus-visible,
.calculator-card select:focus-visible {
    border-bottom-color: var(--accent) !important;
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.calculator-card input::placeholder {
    /* #6B747E on white is 4.75:1, so the hint is readable rather than a ghost. */
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 0.92rem;
}

.field-hint,
.help-text {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.prorata-section {
    border-top: 1px solid var(--rule);
    padding-top: 1.25rem;
    margin-top: 1.75rem;
}

.prorata-section h3 {
    font-family: var(--font-display);
    font-size: var(--step-1);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

#proRataResult {
    background: none !important;
    border: 0;
    border-left: 4px solid var(--accent);
    border-radius: 0;
    box-shadow: none;
    padding: 0.35rem 0 0.35rem 1rem !important;
    margin-top: 1rem;
    color: var(--ink-soft);
}

.calculate-btn,
.prorata-section button,
.add-holiday-btn {
    background: var(--accent) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 0;
    padding: 0.9rem 1.5rem !important;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
}

.calculate-btn {
    margin-top: 2rem;
    width: 100%;
}

@media (min-width: 46rem) {
    .calculate-btn {
        width: auto;
        min-width: 17rem;
    }
}

.calculate-btn:hover,
.prorata-section button:hover,
.add-holiday-btn:hover {
    background: var(--accent-deep) !important;
}

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

/* ------------------------------------------------------------- the answer */

.results {
    border-top: 0;
    padding-top: 0;
    margin-top: clamp(1.75rem, 4vw, 2.5rem);
}

/*
 * The count. It was set at the size of a section heading, inside a bordered box
 * that looked exactly like every other bordered box on the page.
 */
.result-box {
    background-color: var(--accent);
    background-image: url('/img/tally.webp');
    background-size: 1024px auto;
    background-blend-mode: multiply;
    color: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: clamp(1.5rem, 4vw, 2.25rem);
}

.result-box .result-label {
    display: block;
    color: #fff;
    opacity: 0.85;
}

.result-value {
    display: block;
    margin-top: 0.3rem;
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 11vw, var(--step-7));
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.result-subtext {
    display: block;
    margin-top: 0.6rem;
    color: #fff;
    opacity: 0.85;
    font-size: var(--step-0);
}

.breakdown {
    margin-top: 1.75rem;
}

.breakdown h3 {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.breakdown-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
    padding: 0.55rem 0;
}

.breakdown-label {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.breakdown-value {
    font-family: var(--font-figure);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#additionalInfo > div,
.info-box {
    background: none !important;
    border: 0;
    border-left: 4px solid var(--accent);
    border-radius: 0;
    box-shadow: none;
    padding: 0.2rem 0 0.2rem 1rem !important;
    margin-block: 1.25rem;
    color: var(--ink-soft);
}

/* ------------------------------------------------------------ the tracker */

.tracker-section {
    border-top: 3px solid var(--accent);
    padding-top: 1.5rem;
    margin-top: clamp(2rem, 5vw, 3rem);
}

.tracker-section h3 {
    font-family: var(--font-display);
    font-size: var(--step-2);
    font-weight: 700;
    margin-bottom: 0.35rem;
}

/*
 * Four balance cards of identical weight told you the entitlement, the days
 * taken, the days booked and the days left in the same breath. Only the last of
 * those is why anyone opens a holiday tracker, so the first three become a
 * ruled tally across the top and what is left is set large underneath it.
 */
.balance-display {
    display: grid;
    gap: 0;
    margin-top: 1.25rem;
}

@media (min-width: 40rem) {
    .balance-display {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 1.5rem;
    }

    .balance-card.primary {
        grid-column: 1 / -1;
    }
}

.balance-card {
    background: none;
    border: 0;
    border-top: 1px solid var(--rule-strong);
    border-radius: 0;
    box-shadow: none;
    padding: 0.75rem 0 0.9rem;
}

.balance-label {
    display: block;
    color: var(--muted);
}

.balance-value {
    display: block;
    margin-top: 0.2rem;
    font-family: var(--font-display);
    font-size: var(--step-3);
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.balance-card.primary {
    border-top: 3px solid var(--accent);
    margin-top: 0.75rem;
    padding-top: 1rem;
}

.balance-card.primary .balance-label {
    color: var(--accent);
}

.balance-card.primary .balance-value {
    font-size: clamp(2.6rem, 9vw, var(--step-6));
    line-height: 0.98;
    color: var(--accent);
}

.holiday-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
    gap: 1.25rem;
    align-items: end;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule);
}

.add-holiday-btn {
    margin-top: 0;
}

.holiday-list {
    margin-top: 1.25rem;
}

/* ------------------------------------------------- retiring the box rule */

.info-section,
.content-card,
.info-card,
.faq-card,
.card,
.email-box,
.contact-box,
.faq-section {
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.article-card,
.blog-card,
.history-item,
.holiday-list > div {
    background: none;
    border: 0;
    border-top: 1px solid var(--rule-strong);
    border-radius: 0;
    box-shadow: none;
    padding: 0.9rem 0 1.1rem;
}

.article-card:hover,
.blog-card:hover {
    border-top-color: var(--accent);
    box-shadow: none;
}

.blog-grid,
.related-grid,
.card-grid {
    gap: 0 2rem;
}

/* --------------------------------------------------- reference typography */

.reference h2,
.info-section h2 {
    font-family: var(--font-display);
    font-size: var(--step-4);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem !important;
    max-width: 28ch;
}

.reference h3,
.info-section h3 {
    font-family: var(--font-display);
    font-size: var(--step-2);
    font-weight: 700;
    margin-top: 1.6rem;
    margin-bottom: 0.3rem;
}

.reference p,
.reference li,
.info-section p,
.info-section li {
    max-width: 66ch;
    font-size: var(--step-0) !important;
}

/* ------------------------------------------------ the interior page heads */

.page-header,
.header-section,
.container > header {
    padding-block: clamp(2rem, 5vw, 3rem) 0;
    border-top: 5px solid var(--accent);
    margin-top: clamp(1.5rem, 4vw, 2.5rem);
}

.page-header h1,
.header-section h1,
.container > header h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5.5vw, var(--step-6));
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -0.02em;
    max-width: 22ch;
    margin-top: 0.75rem;
}

.page-header p,
.header-section p,
.container > header p {
    font-size: var(--step-1);
    max-width: 54ch;
    color: var(--ink-soft);
}

/* ------------------------------------------------------------- dark mode */

/*
 * The ochre is dark enough to carry white but sits too close to a dark ground
 * for anything that has to read as text, so it lifts to a paler tan on dark.
 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --accent-tint: #2A1F14;
        --board: #331906;
    }

    :root:not([data-theme='light']) .section-index,
    :root:not([data-theme='light']) .field-num,
    :root:not([data-theme='light']) .breakdown h3,
    :root:not([data-theme='light']) .calculator-card .form-legend,
    :root:not([data-theme='light']) .balance-card.primary .balance-label,
    :root:not([data-theme='light']) .balance-card.primary .balance-value {
        /* #D69B62 on #1B1F24 is 8.2:1. */
        color: #D69B62;
    }

    :root:not([data-theme='light']) .calculator-card,
    :root:not([data-theme='light']) .tracker-section,
    :root:not([data-theme='light']) .balance-card.primary {
        border-top-color: #D69B62;
    }
}

:root[data-theme='dark'] .section-index,
:root[data-theme='dark'] .field-num,
:root[data-theme='dark'] .breakdown h3,
:root[data-theme='dark'] .calculator-card .form-legend,
:root[data-theme='dark'] .balance-card.primary .balance-label,
:root[data-theme='dark'] .balance-card.primary .balance-value {
    color: #D69B62;
}

/* ------------------------------------------------------ restoring focus */

/*
 * site.css removes the outline from the inputs and from the button that gives
 * the answer, and in two of the three places it puts nothing back at all, so
 * those controls have no visible focus for anyone using a keyboard. The
 * selectors below match its specificity exactly and load after it, which is
 * what makes the outline come back. This lives here rather than in site.css
 * because that file is generated boilerplate shared across the estate.
 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="number"]:focus-visible,
.calculate-btn:focus-visible,
.add-holiday-btn:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* ----------------------------------------------------------------- print */

@media print {
    .site-nav,
    .editorial-footer,
    .book-plug,
    .calculate-btn,
    .add-holiday-btn,
    .prorata-section button {
        display: none !important;
    }

    .masthead,
    .result-box {
        background: none;
        color: #000;
        border-bottom: 2px solid #000;
    }

    .masthead h1,
    .masthead-standfirst,
    .masthead-kicker,
    .result-box .result-label,
    .result-value,
    .result-subtext {
        color: #000;
        opacity: 1;
    }
}

/*
 * A placeholder is a hint, not a value.
 *
 * The fields on these pages were enlarged so the figure people type is legible
 * at the scale of the answer. At that size a placeholder set in the input's own
 * colour and weight reads as a filled field, and somebody arrives at a form that
 * looks already answered. Every field here carries a visible label, so the
 * placeholder is free to recede.
 */
input::placeholder,
textarea::placeholder {
    color: color-mix(in srgb, currentColor 38%, transparent);
    font-size: 0.66em;
    font-weight: 400;
    letter-spacing: 0.04em;
    opacity: 1;
}

/* placeholder specificity */
.calculator-card input::placeholder,
.calculator-card textarea::placeholder,
input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder {
    color: color-mix(in srgb, currentColor 38%, transparent);
    font-size: 0.66em;
    font-weight: 400;
    letter-spacing: 0.04em;
    opacity: 1;
}

/* --------------------------------------------------- validation messages */

/*
 * These replaced alert(). A modal stops the page, loses your place on a
 * phone, and never says which field it is about. role="alert" on the slot
 * gets the message announced where it sits.
 */
.field-error {
    display: none;
    margin-top: 0.45rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.35;
    color: #A8251B;
}

.field-error.show {
    display: block;
}

input[aria-invalid='true'],
select[aria-invalid='true'] {
    border-color: #A8251B;
}

@media (prefers-color-scheme: dark) {
    .field-error {
        color: #F2A9A2;
    }
}

body.dark-mode .field-error {
    color: #F2A9A2;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}
