/* Page layout for wdhw.net. Colours, type and components come from /wdhw/ (the design system); only tokens here. */

:root {
    --column: 1040px;          /* widest the content column gets */
    --gutter: var(--space-4);  /* phone gutters */
}

@media (min-width: 768px) {
    :root {
        --gutter: var(--space-6); /* desktop gutters */
    }
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    font: var(--text-body);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* One centred column: the header, hero, links and footer all share its edges. */
.wd-header,
.wd-hero,
.elsewhere,
.page,
.site-footer {
    width: min(var(--column), 100% - 2 * var(--gutter));
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Header */
.wd-header {
    padding-left: 0;
    padding-right: 0;
}

.wd-header__home {
    display: inline-flex;
    border-radius: var(--radius-sm);
}

.wd-header__home:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 4px;
}

/* Wordmark, nav and theme switch are centred on one line; the header wraps on phones. */
.wd-header {
    align-items: center;
    flex-wrap: wrap;
    row-gap: var(--space-2);
}

.wd-header .wd-header__nav {
    margin-left: auto;
}

.wd-header .wd-toggle {
    margin-left: var(--space-5);
}

.wd-header__link[aria-current="page"] {
    border-bottom-color: var(--accent);
}

/* Phones: logo and switch on the first row, nav on its own row below. */
@media (max-width: 520px) {
    .wd-header .wd-toggle {
        margin-left: auto;
    }

    .wd-header .wd-header__nav {
        display: flex;
        order: 3;
        width: 100%;
        margin-left: 0;
    }
}

/* Label sits left of the switch and keeps one width, so the switch never moves when the text changes. */
.theme-label {
    display: inline-block;
    min-width: 6.6em;
    text-align: right;
}

/* Buttons used as links. */
a.wd-btn {
    display: inline-block;
    text-decoration: none;
}

a.wd-btn:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

/* Hero: a rounded panel inside the column, not a full-bleed banner. */
.wd-hero {
    margin-top: var(--space-5);
    border-radius: var(--radius-lg);
}

/* Backdrop images, by key. A key without an image here paints its CSS stand-in from bundle.css. */
[data-backdrop="duotone-moss"] {
    --wd-img: url(/wdhw/backdrops/duotone-moss.jpg);
}

/* Links out to our other sites and projects. */
.elsewhere {
    padding: var(--space-7) 0 var(--space-5);
}

.elsewhere__eyebrow {
    color: var(--earth-text);
    text-transform: uppercase;
    margin: 0 0 var(--space-2);
}

.elsewhere .headline {
    margin: 0 0 var(--space-5);
}

.link-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-5);
}

.link-card {
    display: block;
    max-width: none;
    height: 100%;
    color: var(--ink);
    text-decoration: none;
    border: var(--border-chunky) solid var(--line);
    transition: transform .12s ease, border-color .12s ease;
}

.link-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
}

.link-card:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.link-card p {
    margin: 0;
}

.link-card .wd-card__title {
    margin: var(--space-1) 0 var(--space-2);
}

/* About, Contact and other content pages */
.page {
    padding: var(--space-8) 0 var(--space-5);
}

.page__eyebrow {
    color: var(--earth-text);
    text-transform: uppercase;
    margin: 0 0 var(--space-2);
}

.page__title {
    margin: 0 0 var(--space-5);
    font-size: clamp(40px, 8vw, 56px);
}

.page__body {
    max-width: 36em;
    margin-bottom: var(--space-5);
}

.page__body .read {
    margin: 0 0 var(--space-4);
}

.page .wd-btn {
    align-self: flex-start;
}

/* Contact form */
.contact-form {
    display: grid;
    gap: var(--space-4);
    max-width: 36em;
    margin-bottom: var(--space-7);
}

.contact-form .wd-field {
    max-width: none;
}

.contact-form textarea.wd-input {
    resize: vertical;
    min-height: 9em;
    font-family: var(--font-sans);
}

.contact-form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
}

.contact-form__actions .wd-btn:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.contact-form__actions .wd-btn[disabled] {
    opacity: .6;
    cursor: progress;
}

.contact-form__status {
    margin: 0;
    color: var(--ink-muted);
}

.contact-form__status[data-state="error"] {
    color: var(--earth-text);
}

.contact-form__trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-elsewhere {
    margin: 0 0 var(--space-4);
}

/* Footer */
.site-footer {
    padding: var(--space-5) 0 var(--space-6);
    text-align: center;
    color: var(--ink-muted);
}

.site-footer .wd-divider {
    padding-left: 0;
    padding-right: 0;
}

.site-footer .small {
    margin: 0;
}

/* The name stays lowercase, even inside uppercase labels. */
.site-name {
    text-transform: none;
}

/* 404 */
.lost {
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--space-4);
    padding: var(--space-8) var(--gutter);
}

.lost__eyebrow {
    color: var(--earth-text);
    text-transform: uppercase;
    margin: 0;
}

.lost .display-l {
    margin: 0;
    font-size: clamp(40px, 9vw, 56px);
}

.lost__sub {
    font: var(--text-quote);
    font-size: clamp(19px, 3vw, 24px);
    line-height: 1.4;
    color: var(--ink-muted);
    margin: 0 0 var(--space-3);
}

/* Login page for private sections (reuses the contact form's actions and status styles). */
.login-form {
    display: grid;
    gap: var(--space-4);
    max-width: 24em;
    margin-bottom: var(--space-7);
}

.login-form .wd-field {
    max-width: none;
}

.login-form .contact-form__actions .wd-btn[disabled] {
    opacity: .6;
    cursor: progress;
}
