/* ---------------------------------------------------------------------------
   The South Downs and Beyond
   Ink on paper, after Tove Jansson: the sea, the woods, lamplight.
   Everything visual comes from the tokens below.
   --------------------------------------------------------------------------- */
:root {
    /* Canvas: unprimed cotton duck, warm and slightly uneven. */
    --paper:        #faf7f0;
    --paper-2:      #fffdf8;
    --paper-sunk:   #eee9dc;

    /* Ink — a soft brown-black, as if drawn with a dip pen. */
    --ink:          #2b3330;
    --ink-soft:     #56635c;
    --ink-faint:    #8b958c;
    --rule:         #ddd6c6;
    --frame:        #a3a096;   /* photograph edge: grey, warm, quiet */
    --rule-soft:    #eae4d6;

    /* The Downs */
    --sky:          #6fa3c4;   /* summer sky over the ridge */
    --sky-pale:     #dcebf2;
    --sea:          #3d7f9c;   /* the Channel from the top */
    --hill:         #5e8a52;   /* turf */
    --hill-pale:    #d3e2c2;   /* sunlit grass */
    --wood:         #3f6b47;   /* beech hanger */
    --chalk:        #f0ece0;   /* the white cliff */
    --lamp:         #c07f33;   /* bracken, brick, late light */
    --berry:        #9c4f4a;   /* rosehip */

    --accent:       var(--sea);

    --measure:      66ch;
    --radius:       2px;
    --shadow:       0 1px 1px rgba(43,51,48,.05), 0 12px 30px -20px rgba(43,51,48,.3);

    --step--1: clamp(.8rem, .78rem + .1vw, .86rem);
    --step-0:  clamp(1.02rem, .99rem + .16vw, 1.1rem);
    --step-1:  clamp(1.22rem, 1.14rem + .34vw, 1.45rem);
    --step-2:  clamp(1.5rem, 1.34rem + .68vw, 2.05rem);
    --step-3:  clamp(2rem, 1.66rem + 1.45vw, 3.15rem);

    --font-display: "Fraunces", Georgia, serif;
    --font-body:    "Petrona", Georgia, serif;
    --font-ui:      "Petrona", Georgia, serif;
    --font-mono:    ui-monospace, Menlo, monospace;
}


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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .site-title {
    font-family: var(--font-display);
    font-variation-settings: "SOFT" 60, "WONK" 1;
    font-weight: 600;
    letter-spacing: -.01em;
    text-wrap: balance;
    margin: 0;
}
h1 { font-size: var(--step-3); line-height: 1.03; }
h2 { font-size: var(--step-2); line-height: 1.15; }
h3 { font-size: var(--step-1); line-height: 1.25; }

p { margin: 0 0 1em; }
a { color: var(--sea); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--berry); }
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--sea);
    outline-offset: 3px;
}
img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: 1080px; margin-inline: auto; padding-inline: clamp(1rem, .5rem + 2vw, 2.5rem); }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---- Masthead ---- */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead__inner {
    display: flex; flex-wrap: wrap; align-items: baseline;
    gap: .5rem 2rem; padding-block: 1.4rem 1.1rem;
}
.site-title {
    font-size: var(--step-1);
    font-variation-settings: "SOFT" 100, "WONK" 1;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}
.site-nav {
    display: flex; flex-wrap: wrap; gap: .2rem 1.2rem;
    font-size: var(--step--1); margin-left: auto;
    letter-spacing: .02em;
}
.site-nav a { color: var(--ink-soft); text-decoration: none; padding-block: .15rem; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--lamp); text-decoration-thickness: 2px; }

main { padding-block: clamp(1.75rem, 1rem + 3vw, 3rem) 5rem; }

/* ---- Page head ---- */
.page-head { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.5rem; }
.eyebrow {
    font-size: var(--step--1);
    letter-spacing: .04em;
    color: var(--ink-faint);
    font-style: italic;
    margin: 0;
}

/* ---- The line of figures under a title ---- */
.tally {
    display: flex; flex-wrap: wrap; gap: .3rem 1.6rem;
    font-size: var(--step-0); color: var(--ink-soft);
    margin: 0 0 1.75rem;
    font-style: italic;
}
.tally b { font-style: normal; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }


/* ---- Walk cards ---- */
.walk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 2rem 1.75rem; }
.walk-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.walk-card__media {
    aspect-ratio: 4 / 3; background: var(--paper-sunk);
    border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
}
.walk-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.walk-card:hover .walk-card__media img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .walk-card__media img { transition: none; } }
.walk-card__body { display: flex; flex-direction: column; gap: .15rem; padding-top: .7rem; }
.walk-card__title { font-size: var(--step-1); }
.walk-card:hover .walk-card__title { text-decoration: underline; text-decoration-color: var(--lamp); }
.walk-card__meta { font-size: var(--step--1); color: var(--ink-faint); font-style: italic; margin: 0; }
.walk-card__meta span + span::before { content: " · "; }

/* ---- Map ---- */
.walk-map-wrap { margin-block: 2.5rem; }

/* Both views stand in the same box, so switching between them does not move
   the rest of the page. The box is the patch's shape — the drawing is the one
   with proportions of its own, so the map is brought to it rather than the
   patch being letterboxed into a map-shaped hole. */
.walk-view {
    aspect-ratio: 520 / 420;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-sunk);
    overflow: hidden;
}
.walk-view[hidden] { display: none; }
.walk-view--drawn .tile { display: block; width: 100%; height: 100%; }
.walk-view--drawn .tile__svg { display: block; width: 100%; height: 100%; }
/* The page has already said which walk this is. */
.walk-view--drawn .tile__caption { display: none; }

.walk-view__switch { display: flex; gap: .35rem; margin: .6rem 0 0; }
.walk-view__btn {
    font: inherit;
    font-size: var(--step--1);
    padding: .25rem .8rem;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 999px;
    cursor: pointer;
}
.walk-view__btn:hover { color: var(--ink); }
.walk-view__btn.is-on {
    color: var(--ink);
    background: var(--paper-sunk);
    border-color: var(--ink-faint);
}

.walk-map {
    height: 100%;
    z-index: 0;
}
.walk-map[data-failed] { display: grid; place-items: center; }
.walk-map[data-failed]::after {
    content: "The map could not be loaded."; font-style: italic;
    font-size: var(--step--1); color: var(--ink-faint);
}
.leaflet-container { border-radius: var(--radius); font: inherit; background: var(--paper-sunk); }

/* ---- Gallery ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); gap: 1rem; }
.gallery figure { margin: 0; }
.gallery img {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-sunk);
}
.gallery a:hover img { border-color: var(--lamp); }

/* ---- Prose ---- */
.prose { max-width: var(--measure); }
.prose img { border-radius: var(--radius); margin-block: 1rem; }
main h2 { margin-block: 2.5rem 1rem; }

/* ---- Chips ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.5rem; }
.chip {
    font-size: var(--step--1); font-style: italic;
    padding: .15em .75em; border: 1px solid var(--rule); border-radius: 999px;
    text-decoration: none; color: var(--ink-soft);
}
.chip:hover { border-color: var(--lamp); color: var(--ink); }

/* ---- Single photograph ---- */
.photo-figure { margin: 0 0 1.25rem; }
.photo-figure img { width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-sunk); }
.photo-figure figcaption { margin-top: .6rem; color: var(--ink-soft); max-width: var(--measure); font-style: italic; }
.photo-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.photo-count { font-size: var(--step--1); color: var(--ink-faint); font-style: italic; }

/* ---- Meditation slides ---- */
.slides { display: flex; flex-direction: column; gap: 3.5rem; margin-top: 2rem; }
.slide { margin: 0; display: flex; flex-direction: column; gap: 1rem; }
.slide img { width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-sunk); }
.slide figcaption {
    max-width: var(--measure); margin-inline: auto;
    font-size: var(--step-1); line-height: 1.6; color: var(--ink-soft);
    text-align: center; font-style: italic;
}

/* ---- Quotes ---- */
blockquote {
    margin: 0 0 1.5rem; padding-left: 1.2rem;
    border-left: 2px solid var(--lamp);
    max-width: var(--measure); font-style: italic; color: var(--ink-soft);
}

.site-foot {
    border-top: 1px solid var(--rule); padding-block: 2rem 3rem;
    font-size: var(--step--1); color: var(--ink-faint); font-style: italic;
}


/* ---- Trips: one per row, each with its own combined landscape ---- */
.trip-list { display: flex; flex-direction: column; gap: 3.5rem; }
.trip { display: flex; flex-direction: column; gap: .75rem; }
.trip__head { display: flex; flex-direction: column; gap: .1rem; }
.trip__head h2 { font-size: var(--step-2); }
.trip__head h2 a { color: inherit; text-decoration: none; }
.trip__head h2 a:hover { text-decoration: underline; text-decoration-color: var(--lamp); }
.trip__head .tally { margin: 0; }
.trip__drawing { display: block; text-decoration: none; }
.trip__drawing .landscape { margin: 0; }
.trip__drawing:hover .landscape__svg { border-color: var(--lamp); }
.trip__blurb { max-width: var(--measure); color: var(--ink-soft); margin: .25rem 0 0; }

/* ---- Card landscape on the walks index ---- */
.card-landscape {
    display: block;
    width: 100%;
    height: 4.5rem;
    border: 1px solid var(--rule);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--paper-sunk);
}
.walk-card__media { border-radius: 0 0 var(--radius) var(--radius); }
.walk-card:hover .card-landscape { border-color: var(--lamp); }

/* ---- Index cards ---------------------------------------------------------
   On the walks index the drawing sits on the page rather than in a window:
   bare paper above the hill line. At card size a sky, sun and clouds are just
   noise competing with the photograph beneath.
   ------------------------------------------------------------------------- */
.card-landscape--plain { background: transparent; border: none; border-radius: 0; }

/* ---- Walks index card: drawing sitting directly on the photograph -------- */
.walk-card__media {
    border: 1px solid var(--frame);
    border-radius: 0;
    margin: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--paper-sunk);
}
.card-landscape {
    display: block;
    width: 100%;
    height: 4.5rem;
    margin: 0 0 -1px;          /* sit flush on the photograph's top edge */
    background: transparent;
    border: none;
    border-radius: 0;
}
.walk-card:hover .walk-card__media { border-color: var(--lamp); }

/* ---- Walks index: a plate of photographs -------------------------------
   One picture leads and four sit beside it, rather than six identical tiles.
   The gaps show the paper through, so it reads as prints laid on the page.
   ------------------------------------------------------------------------- */
.walk-card__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 5px;
    padding: 5px;
    /* The turf from the drawing above carries on behind the photographs, so
       they read as prints mounted on the hillside rather than a bare grid. */
    background: var(--turf-lo);
    border: none;
    margin: 0;
}
/* The first photograph leads, at twice the size. */
.walk-card__grid img:first-child { grid-column: span 2; grid-row: span 2; }

.walk-card__grid img {
    width: 100%;
    height: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    display: block;
    background: var(--paper-sunk);
    outline: 1px solid rgba(43, 51, 48, .22);
    outline-offset: -1px;
    transition: filter .3s ease;
}
.walk-card:hover .walk-card__grid img   { filter: saturate(1.06); }
@media (prefers-reduced-motion: reduce) { .walk-card__grid img { transition: none; } }

/* Narrow cards: the lead photograph alone reads better than five specks. */
@media (max-width: 30rem) {
    .walk-card__grid { grid-template-columns: 1fr; grid-template-rows: auto; }
    .walk-card__grid img:first-child { grid-column: auto; grid-row: auto; }
    .walk-card__grid img:not(:first-child) { display: none; }
}

/* The drawing sits flush on top of the plate. */
.card-landscape {
    display: block;
    width: 100%;
    height: 4.5rem;
    margin: 0 0 -1px;
    background: transparent;
    border: none;
    border-radius: 0;
}

/* ---- Notices ---- */
.notice--error {
    border-color: #a03729;
    background: #f7e5e2;
    color: #6d2a20;
}

/* ---- Sign in -------------------------------------------------------------
   The only form on the site, and the one page a stranger might land on by
   accident, so it should look like somewhere rather than like a login box.
   ------------------------------------------------------------------------- */

.signin {
    max-width: 25rem;
    margin: clamp(1.5rem, 6vh, 4rem) auto clamp(3rem, 10vh, 6rem);
}

.signin__card {
    overflow: hidden;
    background: var(--paper-2);
    border: 1px solid var(--frame);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* A scrap of the country the site is about, rather than a blank header. */
.signin__scene { display: block; width: 100%; height: auto; }

.signin__body { padding: clamp(1.4rem, 1rem + 2vw, 2.1rem); }

.signin__head { margin-bottom: 1.4rem; }
.signin__head .eyebrow { margin: 0 0 .15rem; }
.signin__head h1 { margin: 0; font-size: var(--step-2); line-height: 1.05; }

.field { display: grid; gap: .3rem; margin-bottom: 1rem; }

.field > label {
    font-family: var(--font-ui);
    font-size: var(--step--1);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.field > input {
    font: inherit;
    font-size: var(--step-0);
    width: 100%;
    padding: .6rem .7rem;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.field > input:hover { border-color: var(--frame); }

.field > input:focus-visible {
    outline: none;
    background: var(--paper-2);
    border-color: var(--sea);
    box-shadow: 0 0 0 3px rgba(61, 127, 156, .18);
}

/* Checkboxes read as a sentence, so the label is not shouted like the others. */
.field--check {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.5rem;
}
.field--check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--sea); }
.field--check label {
    font-family: var(--font-body);
    font-size: var(--step-0);
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
}

.button {
    font-family: var(--font-ui);
    font-size: var(--step-0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: .65rem 1.2rem;
    color: var(--paper-2);
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.button:hover  { background: var(--sea); border-color: var(--sea); }
.button:active { transform: translateY(1px); }
.button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(61, 127, 156, .3);
}

.notice {
    margin: 0 0 1.1rem;
    padding: .65rem .8rem;
    font-size: var(--step--1);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper-sunk);
}

.signin__foot {
    margin: 1.2rem 0 0;
    font-size: var(--step--1);
    color: var(--ink-faint);
    text-align: center;
}

/* ---- The front page, band by band -----------------------------------------
   Each band is one section from the admin. They are spaced rather than ruled:
   the drawings are busy enough without lines drawn between them. */
.band { margin: 0 0 clamp(2.5rem, 1.5rem + 3vw, 4.5rem); }
.band:last-child { margin-bottom: 0; }
.band__head { margin-bottom: 1rem; }
.band__head h2 { margin: 0; }

/* The opening words, set larger than the page's body: a lede, not a caption. */
.band__lede {
    max-width: 46ch;
    font-size: var(--step-1);
    line-height: 1.5;
    color: var(--ink-soft);
}
.band__blurb { max-width: var(--measure); color: var(--ink-soft); margin: 0 0 1.5rem; }
.band__more { margin: 1.25rem 0 0; font-size: var(--step--1); }

/* One walk shown large. The quilt's grid would give a lone patch a third of
   the page and leave the rest empty, so a hero is capped and centred instead. */
.band__hero .quilt__grid { grid-template-columns: minmax(0, 1fr); max-width: 46rem; }
.band--hero .quilt { margin-top: 0; }

/* Quotes on the front page: the words, then where they came from. */
.quote-set { display: grid; gap: 2rem; }
.quote-set--columns { grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); }
.quote { margin: 0; }
.quote blockquote { margin: 0; }
.quote figcaption {
    margin-top: .5rem;
    font-size: var(--step--1);
    font-style: italic;
    color: var(--ink-faint);
}
