/* Machair - an image-led Ghost theme for photographic travel and nature writing */

/* ------------------------------------------------------------ tokens --- */

:root {
    --paper: #f2f3f0;
    --ink: #1c2320;
    --slate: #5b6661;
    --mist: #d7dcd7;
    --accent: var(--ghost-accent-color, #2e5c6b);
    --lichen: #c4a93f;

    --font-display: var(--gh-font-heading, "Archivo", "Helvetica Neue", Arial, sans-serif);
    --font-text: var(--gh-font-body, "Source Serif 4", Georgia, "Times New Roman", serif);

    --gutter: max(4vw, 20px);
    --measure: 38rem;
    --wide-extra: 16rem;
    --max-width: 1440px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #151a18;
        --ink: #e3e6e2;
        --slate: #9aa49f;
        --mist: #2b322f;
        --accent: #93bccb;
    }
}

/* Photo essay template: dark gallery ground whatever the system setting */
body:has(.essay) {
    --paper: #131715;
    --ink: #e6e8e4;
    --slate: #99a39e;
    --mist: #29302d;
    --accent: #93bccb;
}

/* -------------------------------------------------------------- base --- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: clamp(1.0625rem, 0.95rem + 0.35vw, 1.1875rem);
    line-height: 1.7;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-stretch: 82%;
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.01em;
    margin: 0;
}

:focus-visible { outline: 2px solid var(--lichen); outline-offset: 3px; }
::selection { background: var(--lichen); color: #1c2320; }

.visually-hidden {
    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: var(--gutter); top: -3rem;
    padding: 0.5rem 0.9rem; background: var(--ink); color: var(--paper);
    font-family: var(--font-display); font-size: 0.9rem; text-decoration: none; z-index: 10;
}
.skip-link:focus { top: 0.75rem; }

.gh-outer {
    width: 100%;
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.meta {
    margin: 0;
    font-family: var(--font-display);
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--slate);
}
.meta a { color: var(--ink); text-decoration: none; }
.meta a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

.button {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--ink);
    border-radius: 2px;
    background: var(--ink);
    color: var(--paper);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { background: transparent; color: var(--ink); }

/* ------------------------------------------------------------ header --- */

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding-block: 1.25rem;
}

.site-title {
    font-family: var(--font-display);
    font-stretch: 82%;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
}
.site-title__logo { max-height: 2.5rem; width: auto; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    font-family: var(--font-display);
    font-size: 0.9375rem;
}
.site-nav .nav { display: flex; gap: 1.75rem; margin: 0; padding: 0; list-style: none; }
.site-nav .nav a { color: var(--slate); text-decoration: none; }
.site-nav .nav a:hover, .site-nav .nav-current a { color: var(--ink); }
.site-nav .nav-current a { text-decoration: underline; text-decoration-color: var(--lichen); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }

.site-nav__actions { display: flex; align-items: center; gap: 1.25rem; }
.site-nav__actions > a:not(.button) { color: var(--slate); text-decoration: none; }
.site-nav__actions > a:not(.button):hover { color: var(--ink); }

.nav-toggle {
    display: none;
    padding: 0.4rem 0;
    border: 0;
    background: none;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    cursor: pointer;
}

@media (max-width: 799px) {
    .site-header__inner { flex-wrap: wrap; }
    .nav-toggle { display: block; }
    .site-nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
        padding: 0.5rem 0 1rem;
    }
    .site-header.is-open .site-nav { display: flex; }
    .site-nav .nav { flex-direction: column; gap: 0.9rem; font-size: 1.125rem; }
}

/* ------------------------------------------------------------ plate ---- */
/* The paper plate that sits over the lower edge of a lead photograph */

.plate {
    position: relative;
    max-width: calc(var(--measure) + 4rem);
    /* line the plate's text up with the page gutter, even on very wide screens */
    margin-left: calc(max(var(--gutter), (100% - var(--max-width)) / 2 + var(--gutter)) - 2rem);
    padding: 2rem 2rem 0;
    background: var(--paper);
}

/* ------------------------------------------------------- lead story ---- */

.lead { margin-bottom: clamp(4rem, 9vw, 7rem); }

.lead__image img {
    width: 100%;
    height: min(84vh, 60vw);
    min-height: 22rem;
    object-fit: cover;
}

.lead .plate { margin-top: -8rem; }
.lead--no-image .plate { margin-top: clamp(2rem, 6vw, 5rem); }

.lead__title {
    font-size: clamp(2.5rem, 1.5rem + 3.6vw, 4.5rem);
    line-height: 1.02;
}
.lead__title a { text-decoration: none; }
.lead__title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }

.lead__excerpt {
    margin: 1.25rem 0 1rem;
    font-size: 1.2em;
    line-height: 1.55;
}

@media (max-width: 719px) {
    .plate { margin-left: 0; padding-inline: var(--gutter); }
    .lead .plate { margin-top: 0; padding-top: 1.5rem; }
}

/* ---------------------------------------------------- contact sheet ---- */

.sheet {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(2.75rem, 5vw, 4.5rem) clamp(1.25rem, 2.5vw, 2.5rem);
}

.frame { grid-column: span 6; }

@media (min-width: 720px) {
    .frame { grid-column: span 3; }
}

@media (min-width: 1080px) {
    .frame { grid-column: span 2; }
    .sheet:not(.sheet--even) > .frame:nth-child(-n+2) { grid-column: span 3; }
    .sheet:not(.sheet--even) > .frame:nth-child(-n+2) .frame__title { font-size: 1.875rem; }
}

.frame__link { display: block; text-decoration: none; }

.frame__image {
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--mist);
}
.frame__image img { width: 100%; height: 100%; object-fit: cover; }

.frame__title {
    margin: 1rem 0 0.4rem;
    font-size: 1.4rem;
    line-height: 1.12;
}
.frame__link:hover .frame__title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

/* ---------------------------------------------------------- archive ---- */

.archive { margin: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(3rem, 6vw, 5rem); }
.archive .plate { padding-top: 0; }

.archive--image { margin-top: 0; }
.archive--image .archive__image {
    width: 100%;
    height: min(56vh, 44vw);
    min-height: 16rem;
    object-fit: cover;
}
.archive--image .plate { margin-top: -6rem; padding-top: 2rem; }

.archive__title { font-size: clamp(2.5rem, 1.6rem + 3vw, 4rem); }
.archive__description { margin: 1rem 0 0; font-size: 1.15em; line-height: 1.55; color: var(--slate); }
.archive__avatar { width: 5rem; height: 5rem; border-radius: 50%; object-fit: cover; margin-bottom: 1.25rem; }
.archive .meta { margin-top: 0.75rem; }

@media (max-width: 719px) {
    .archive--image .plate { margin-top: 0; padding-top: 1.5rem; }
}

/* ---------------------------------------------------------- article ---- */

.gh-canvas {
    display: grid;
    grid-template-columns:
        [full-start] minmax(var(--gutter), auto)
        [wide-start] minmax(auto, var(--wide-extra))
        [main-start] min(var(--measure), calc(100% - var(--gutter) * 2))
        [main-end] minmax(auto, var(--wide-extra))
        [wide-end] minmax(var(--gutter), auto) [full-end];
}
.gh-canvas > * { grid-column: main; }
.kg-width-wide { grid-column: wide; }
.kg-width-full { grid-column: full; }
.kg-width-full img { width: 100%; }

.hero { margin: 0; }
.hero img {
    width: 100%;
    max-height: 88vh;
    object-fit: cover;
}
.hero--contained img { max-height: 80vh; }
.hero figcaption {
    padding: 0.75rem var(--gutter) 0;
    font-family: var(--font-display);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--slate);
}
.hero--contained figcaption { padding-inline: 0; }

.article__header { margin: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem); }
.article__title { font-size: clamp(2.4rem, 1.4rem + 3.4vw, 4.25rem); line-height: 1.02; }
.article__standfirst {
    margin: 1.25rem 0 0;
    font-size: 1.3em;
    line-height: 1.5;
}
.article__header .meta { margin-top: 1.25rem; }

.article__comments { margin-top: 4rem; }

/* ---- post content ---- */

.gh-content { overflow-wrap: break-word; }
.gh-content > * { margin-block: 0; }
.gh-content > * + * { margin-top: 1.5em; }

.gh-content > h2 { margin-top: 2.2em; font-size: 1.95rem; }
.gh-content > h3 { margin-top: 2em; font-size: 1.5rem; }
.gh-content > h2 + *, .gh-content > h3 + * { margin-top: 0.75em; }

.gh-content a {
    color: var(--ink);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}
.gh-content a:hover { color: var(--accent); }

.gh-content blockquote:not([class]) {
    margin-inline: 0;
    padding-left: 1.5rem;
    border-left: 2px solid var(--lichen);
    font-size: 1.2em;
    font-style: italic;
    line-height: 1.55;
}

.gh-content hr {
    width: 3rem;
    margin-block: 3em;
    border: 0;
    border-top: 2px solid var(--lichen);
}

.gh-content ul, .gh-content ol { padding-left: 1.25em; }
.gh-content li + li { margin-top: 0.4em; }

.gh-content figure { margin-inline: 0; }
.gh-content > .kg-card + *, .gh-content > * + .kg-card { margin-top: 2.25em; }
.gh-content figcaption {
    margin-top: 0.7rem;
    font-family: var(--font-display);
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--slate);
    text-align: left;
}
.gh-content .kg-width-full figcaption { padding-inline: var(--gutter); }

.gh-content pre {
    overflow-x: auto;
    padding: 1rem 1.25rem;
    background: var(--mist);
    font-size: 0.875rem;
    line-height: 1.55;
}
.gh-content :not(pre) > code {
    padding: 0.1em 0.3em;
    background: var(--mist);
    font-size: 0.875em;
}

/* Photo essay: photographs step out to the wide column by default */
.essay .gh-content > .kg-image-card:not(.kg-width-full),
.essay .gh-content > .kg-gallery-card,
.essay .gh-content > .kg-video-card {
    grid-column: wide;
}
.essay .gh-content > .kg-card + *,
.essay .gh-content > * + .kg-card { margin-top: 3em; }

/* ----------------------------------------------------------- signup ---- */

.signup { margin-top: clamp(5rem, 10vw, 8rem); }
.signup__inner {
    display: grid;
    gap: 1.5rem 3rem;
    align-items: end;
    padding-top: 2.5rem;
    border-top: 2px solid var(--ink);
}
.signup__title { font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.4rem); }
.signup__text p { margin: 0.6rem 0 0; color: var(--slate); }

.signup__row { display: flex; gap: 0.6rem; }
.signup__row input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--slate);
    border-radius: 2px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}
.signup__row input::placeholder { color: var(--slate); }

.signup__message { display: none; margin: 0.75rem 0 0; font-family: var(--font-display); font-size: 0.9375rem; }
.signup__form.loading .button { opacity: 0.6; cursor: progress; }
.signup__form.success .signup__message--success,
.signup__form.error .signup__message--error { display: block; }
.signup__form.success .signup__row { display: none; }

@media (min-width: 880px) {
    .signup__inner { grid-template-columns: 1fr minmax(0, 28rem); }
}

/* ---------------------------------------------------------- related ---- */

.related { margin-top: clamp(4rem, 8vw, 6rem); }
.related__title { margin-bottom: 2rem; font-size: 1.5rem; }

/* ------------------------------------------------------- pagination ---- */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    max-width: var(--max-width);
    margin: clamp(4rem, 8vw, 6rem) auto 0;
    padding-inline: var(--gutter);
    font-family: var(--font-display);
    font-size: 0.9375rem;
    color: var(--slate);
}
.pagination a { color: var(--ink); text-underline-offset: 0.25em; }

/* ----------------------------------------------------------- footer ---- */

.site-footer { margin-top: clamp(5rem, 10vw, 8rem); }
.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem 2rem;
    padding-block: 2rem 2.5rem;
    border-top: 1px solid var(--mist);
    font-family: var(--font-display);
    font-size: 0.875rem;
    color: var(--slate);
}
.site-footer__title { margin: 0; }
.site-footer .nav { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
.site-footer a { color: var(--slate); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
