/*
 * notice-period-calculator.co.uk
 *
 * Loaded after site.css, so it only states what changes.
 *
 * The idea: this site answers with a date, not with money, and the document a
 * notice period lives in is a letter. So the page is set as one: a typed
 * letter on white, the masthead papered with blank month grids because a
 * notice period is days counted off a calendar, and the answer printed as a
 * date the size of a headline with the day of the week under it. The key
 * dates are a ruled schedule of the kind that gets enclosed with the letter,
 * set in a typewriter face.
 *
 * It is the only one of these sites set entirely in a serif, which is
 * deliberate: everything else here is a calculator, and this one is
 * correspondence.
 *
 * What it replaces: a centred white card, three identical stat tiles, a
 * bulleted timeline, and an end date set at roughly the size of a subheading.
 */

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

:root {
    /* The house scale stops at 2.488rem, which is not big enough for a date. */
    --step-6: 3rem;
    --step-7: 3.9rem;

    --font-display: 'Spectral', Georgia, 'Times New Roman', serif;
    --font-body: 'Spectral', Georgia, 'Times New Roman', serif;
    --font-figure: 'Courier Prime', ui-monospace, 'Courier New', monospace;

    /* Ink for the letter, and the red of a counter date stamp for its marks. */
    --accent: #2A2F36;
    --accent-deep: #14171C;
    --stamp: #A3302A;
}

body {
    font-family: var(--font-body);
}

/*
 * Field names, section marks and column heads, set in the typewriter face
 * rather than in small bold sans. One mannerism, used everywhere it applies.
 */
.field-name,
.masthead-kicker,
.section-index {
    font-family: var(--font-figure);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

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

/*
 * Full bleed, papered with blank month grids. The texture is multiplied over
 * the ink rather than laid on top, so it can only darken the ground: white on
 * this band is never worse than the 13.5:1 it measures on the flat colour.
 */
.masthead {
    background-color: var(--accent);
    background-image: url('/img/calendar-grid.webp');
    background-size: 480px 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(--stamp);
}

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

.masthead-kicker {
    color: #fff;
    opacity: 0.8;
    margin: 0 0 1.25rem;
}

.masthead h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5.4vw, var(--step-6));
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -0.015em;
    max-width: 19ch;
    color: #fff;
    margin: 0;
    text-wrap: balance;
}

.masthead-standfirst {
    margin: 1.15rem 0 0;
    font-size: var(--step-1);
    line-height: 1.55;
    max-width: 54ch;
    color: #fff;
    opacity: 0.9;
}

/* ------------------------------------------------------------- the sheet */

.container {
    counter-reset: reference;
    max-width: var(--page);
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 2rem);
    padding-block: clamp(2rem, 5vw, 3.25rem) 4rem;
}

/*
 * A margin column for section marks, prose in a real measure beside it. Below
 * 60rem the margin closes and the mark sits above its section.
 */
.doc-grid {
    display: grid;
    gap: clamp(0.85rem, 3vw, 2.5rem);
}

@media (min-width: 60rem) {
    .doc-grid {
        grid-template-columns: 10rem 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(--stamp);
    margin: 0;
    padding-top: 0.45rem;
    line-height: 1.4;
}

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

.doc-prose > * + * {
    margin-top: 1rem;
}

.doc-prose p,
.doc-prose li {
    max-width: 64ch;
}

.doc-prose .lede {
    font-size: var(--step-1);
    line-height: 1.55;
    color: var(--ink);
}

.notes {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
}

.notes li {
    border-top: 1px solid var(--rule);
    padding-block: 0.7rem;
}

.notes li:last-child {
    border-bottom: 1px solid var(--rule);
}

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

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

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

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

.fields > li {
    display: grid;
    grid-template-columns: 1.9rem 1fr;
    column-gap: 0.6rem;
    align-items: baseline;
}

/* A field the script reveals sits full width, so it never leaves a gap. */
.fields > li.field-conditional {
    grid-column: 1 / -1;
}

.field-num {
    font-family: var(--font-figure);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--stamp);
}

.field-body {
    min-width: 0;
}

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

/*
 * Ruled lines rather than boxes, for inputs and for selects alike. The rule
 * thickens and takes the stamp colour on focus, and the outline is kept as
 * well: a colour change on its own is not a focus indicator for anyone who
 * cannot see the colour.
 */
.doc-form input[type='date'],
.doc-form input[type='number'],
.doc-form select {
    width: 100%;
    border: 0;
    border-bottom: 2px solid var(--rule-strong);
    border-radius: 0;
    background: transparent;
    padding: 0.3rem 0 0.4rem;
    font-family: var(--font-figure);
    font-size: 1.02rem;
    color: var(--ink);
    box-shadow: none;
    appearance: none;
}

/* The native arrow goes with the native chrome, so one is drawn back on. */
.doc-form select {
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
        linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
    background-position: right 0.75rem center, right 0.4rem center;
    background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
    background-repeat: no-repeat;
    padding-right: 1.6rem;
}

.doc-form input:hover,
.doc-form select:hover {
    border-bottom-color: var(--ink-soft);
}

.doc-form input:focus-visible,
.doc-form select:focus-visible {
    border-bottom-color: var(--stamp);
    outline: 3px solid var(--stamp);
    outline-offset: 3px;
}

.field-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    color: var(--muted);
    max-width: 40ch;
}

.doc-form button {
    display: block;
    margin-top: 2rem;
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 0;
    padding: 0.95rem 1.5rem;
    font-family: var(--font-figure);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: none;
}

@media (min-width: 46rem) {
    .doc-form button {
        width: auto;
        min-width: 20rem;
    }
}

.doc-form button:hover {
    background: var(--stamp);
}

.doc-form button:focus-visible {
    outline: 3px solid var(--stamp);
    outline-offset: 3px;
}

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

.results {
    display: none;
    margin-top: 2.5rem;
}

.results.show {
    display: block;
}

/*
 * The last day, which is the only thing anybody came for and was previously
 * set at about the size of a subheading. It is now the largest thing on the
 * page, stamped on the ink ground with the weekday under it, because "the
 * fourteenth" and "a Friday" are two different pieces of news.
 */
.result-header {
    background: var(--accent);
    color: #fff;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    text-align: left;
    border: 0;
    border-radius: 0;
}

.result-header h3 {
    font-family: var(--font-figure);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0.72;
    margin: 0 0 0.6rem;
}

.end-date-display {
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 8.5vw, var(--step-7));
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.025em;
    color: #fff;
    text-wrap: balance;
}

.day-name {
    margin-top: 0.7rem;
    font-family: var(--font-figure);
    font-size: 0.95rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #fff;
    opacity: 0.82;
}

/*
 * Three counts that used to be three identical tiles. They are now one ruled
 * row of figures, which is what a summary line at the foot of a letter looks
 * like, and the numbers are in the typewriter face so the columns line up.
 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--rule-strong);
    border-top: 0;
    background: var(--card);
}

.stat-card {
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: clamp(0.9rem, 3vw, 1.4rem);
}

.stat-card + .stat-card {
    border-left: 1px solid var(--rule);
}

.stat-label {
    display: block;
    font-family: var(--font-figure);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.stat-value {
    font-family: var(--font-figure);
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: 700;
    line-height: 1;
    color: var(--ink);
}

/*
 * The schedule. Dates hang in a left column in the typewriter face and the
 * events sit against them, ruled off, which is how an enclosure to a letter
 * sets out dates. Previously a bulleted list of pill-shaped items.
 */
.timeline {
    border: 1px solid var(--rule-strong);
    border-top: 0;
    background: var(--card);
    padding: clamp(1.25rem, 4vw, 2rem);
    border-radius: 0;
    box-shadow: none;
}

.timeline h3 {
    font-family: var(--font-figure);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.9rem;
}

.timeline-item {
    display: grid;
    grid-template-columns: minmax(8.5rem, max-content) 1fr;
    gap: 0.4rem 1.25rem;
    align-items: baseline;
    padding: 0.6rem 0;
    border-top: 1px solid var(--rule);
    background: none;
    border-radius: 0;
}

.timeline-item:last-child {
    border-bottom: 1px solid var(--rule);
}

.timeline-date {
    font-family: var(--font-figure);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--stamp);
    white-space: nowrap;
}

.timeline-text {
    color: var(--ink-soft);
    font-size: 0.95rem;
}

@media (max-width: 30rem) {
    .timeline-item {
        grid-template-columns: 1fr;
    }
}

/*
 * The note under the answer. An indented remark against a rule, not another
 * box shouting at the same volume as the date above it.
 */
.success,
.info-box {
    background: none;
    border: 0;
    border-left: 3px solid var(--stamp);
    border-radius: 0;
    box-shadow: none;
    padding: 0.2rem 0 0.2rem 1.25rem;
    margin: 1.5rem 0 0;
    font-size: 0.94rem;
    line-height: 1.6;
    color: var(--ink-soft);
}

.info-box {
    border-left-color: var(--rule-strong);
    margin: 1.25rem 0;
}

.success strong,
.info-box strong {
    color: var(--ink);
}

/* ----------------------------------------------------------- the reference */

/*
 * Reference material set as reference material: one measure, rules between
 * sections, clauses numbered down a hanging margin by a counter so nothing has
 * to be renumbered by hand. The old page put each section in its own white
 * box, which gave a note about garden leave the same weight as the answer.
 */
.info-section {
    counter-increment: reference;
    position: relative;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

@media (min-width: 60rem) {
    .info-section {
        padding-left: 11rem;
    }
}

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

.info-section h2 {
    font-family: var(--font-display);
    font-size: var(--step-3);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.01em;
    margin-bottom: 0.7rem;
    max-width: 30ch;
}

.info-section h2::before {
    content: counter(reference, decimal-leading-zero);
    display: block;
    margin-bottom: 0.5rem;
    font-family: var(--font-figure);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--stamp);
}

@media (min-width: 60rem) {
    .info-section h2::before {
        position: absolute;
        left: 0;
        width: 9rem;
        margin: 0;
        padding-top: 0.5rem;
        text-align: right;
        border-top: 2px solid var(--stamp);
    }
}

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

.info-section p,
.info-section li {
    max-width: 64ch;
}

/* --------------------------------------------------------- inside pages */

/*
 * The interior pages had no identity at all. They now open on the same band
 * as the calculator, quieter, so the guide and the tool read as one document.
 */
.masthead--page {
    padding-block: clamp(1.75rem, 4.5vw, 2.75rem) clamp(1.5rem, 3.5vw, 2rem);
    border-bottom-width: 4px;
}

.masthead--page h1 {
    font-size: clamp(1.7rem, 4.2vw, var(--step-5));
    max-width: 26ch;
}

.article,
.content-card {
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

.article h2,
.content-card h2 {
    font-family: var(--font-display);
    font-size: var(--step-3);
    font-weight: 700;
    line-height: 1.18;
    max-width: 30ch;
}

.article h3,
.content-card h3 {
    font-family: var(--font-display);
    font-size: var(--step-1);
    font-weight: 700;
    margin-top: 1.6rem;
    margin-bottom: 0.3rem;
}

.article p,
.article li,
.content-card p,
.content-card li {
    max-width: 64ch;
}

.article-card {
    background: none;
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
    padding: 1.4rem 0 1.5rem;
    margin: 0;
}

.article-card:last-of-type {
    border-bottom: 1px solid var(--rule);
}

.article-card h2,
.article-card h3 {
    font-family: var(--font-display);
    font-size: var(--step-2);
    font-weight: 700;
    line-height: 1.22;
    margin: 0.2rem 0 0.4rem;
    max-width: 38ch;
}

.article-date,
.read-more {
    font-family: var(--font-figure);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--stamp);
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
}

.faq-item {
    background: none;
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
    padding: 1.1rem 0;
    margin: 0;
}

.faq-item:last-of-type {
    border-bottom: 1px solid var(--rule);
}

.faq-item > h2,
.faq-item > h3 {
    font-family: var(--font-display);
    font-size: var(--step-0);
    font-weight: 700;
    margin: 0 0 0.3rem;
}

.faq-item p,
.faq-item li {
    color: var(--ink-soft);
    max-width: 64ch;
}

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

/*
 * The stamp red is dark enough to read on white but sits too close to a dark
 * ground, so on dark it lifts. #E4756B on #14161A is 6.1:1.
 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --accent: #3A414A;
    }

    :root:not([data-theme='light']) .section-index,
    :root:not([data-theme='light']) .field-num,
    :root:not([data-theme='light']) .timeline-date,
    :root:not([data-theme='light']) .article-card-tag,
    :root:not([data-theme='light']) .article-date,
    :root:not([data-theme='light']) .read-more,
    :root:not([data-theme='light']) .info-section h2::before {
        color: #E4756B;
    }

    :root:not([data-theme='light']) .masthead,
    :root:not([data-theme='light']) .info-section h2::before,
    :root:not([data-theme='light']) .section-index {
        border-color: #E4756B;
    }
}

:root[data-theme='dark'] {
    --accent: #3A414A;
}

:root[data-theme='dark'] .section-index,
:root[data-theme='dark'] .field-num,
:root[data-theme='dark'] .timeline-date,
:root[data-theme='dark'] .info-section h2::before {
    color: #E4756B;
}

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

/*
 * People print this and put it with the resignation letter, so the date and
 * the schedule print and the furniture does not.
 */
@media print {
    .site-nav,
    .breadcrumb-nav,
    .editorial-footer,
    .book-plug,
    ins.adsbygoogle {
        display: none !important;
    }

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

    .masthead h1,
    .masthead-standfirst,
    .masthead-kicker {
        color: #000;
        opacity: 1;
    }

    .result-header {
        background: none;
        border: 2px solid #000;
    }

    .result-header h3,
    .end-date-display,
    .day-name {
        color: #000;
        opacity: 1;
    }
}

/* ------------------------------------------------------------ focus ring */

/*
 * site.css removes the outline on :focus for inputs, selects, textareas and
 * buttons. For anyone navigating by keyboard that is a 2.4.7 failure, and the
 * rules above only put it back on the controls this restyle touched: the
 * textarea on the contact form was left with no indicator at all. This is the
 * backstop for everything focusable, and it is last in the file so it wins on
 * order against the equal-specificity rules in site.css.
 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/*
 * 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 */
.doc-form input::placeholder,
.doc-form textarea::placeholder,
.field-body input::placeholder,
.field-body 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;
}

/* ------------------------------------------------- the statutory minimum */

.statutory-result {
    margin-top: 1.5rem;
    padding: 1.2rem 1.4rem;
    border-left: 4px solid var(--accent);
    background: var(--accent-tint, rgba(0, 0, 0, 0.04));
}

.statutory-result p {
    margin: 0 0 0.7rem;
}

.statutory-result p:last-child {
    margin-bottom: 0;
}
