/*
   NZ GeoMuster 2028: the site's one stylesheet (NFR3.4).
   Colours use the Web Awesome palette tokens (design-system-mapping.md) with fallback values, so text, links,
   the menu and the form stay readable and usable if the provider fails to load (NFR9.1).
   Relative units and wrapping boxes keep the pages usable at 200% zoom and 320px wide (NFR1.5).
*/

:root {
    /*    --gm-bg: var(--wa-color-yellow-90, #f8edbf);
    --gm-text: var(--wa-color-green-10, #0f2614);
    --gm-accent: var(--wa-color-green-30, #1f5130);
    --gm-accent-hover: var(--wa-color-green-20, #163b22);
    --gm-on-accent: var(--wa-color-yellow-95, #fdf8de);
    --gm-surface: var(--wa-color-yellow-95, #fdf8de);
    --gm-field: #ffffff;
    --gm-focus: var(--wa-color-blue-40, #1d4fd7);
    --gm-danger: var(--wa-color-red-30, #8f1d1d);
    --gm-success: var(--wa-color-green-30, #1f5130);
*/
    --gm-bg: var(--wa-color-yellow-95, #fdf8de);
    --gm-text: var(--wa-color-cyan-10, #0f2614);
    --gm-accent: var(--wa-color-cyan-30, #1f5130);
    --gm-accent-hover: var(--wa-color-cyan-20, #163b22);
    --gm-on-accent: var(--wa-color-yellow-90, #f8edbf);
    --gm-surface: var(--wa-color-yellow-90, #f8edbf);
    --gm-field: #ffffff;
    --gm-focus: var(--wa-color-blue-40, #1d4fd7);
    --gm-danger: var(--wa-color-red-30, #8f1d1d);
    --gm-success: var(--wa-color-cyan-30, #1f5130);
    --gm-geocaching: #02874D;
    --gm-font: 'Eczar', Georgia, 'Times New Roman', serif;
    --gm-text-size: 1.125rem;
    --gm-line-height: 1.6;
    --gm-target-min: 44px;
    --gm-content-max: 1100px;
    --gm-gutter: 16px;
    /* Updated by site.js from the header's real height (BR1.5). */
    --gm-header-height: 110px;
}

@media (min-width: 768px) {
    :root {
        --gm-gutter: 24px;
    }
}

/* ----- Base ------------------------------------------------------------------------------------------------ */

html {
    scroll-padding-top: calc(var(--gm-header-height) + 0.75rem);
}

body {
    /* A column the height of the window, so the footer rests at the bottom on short pages (.gm-main grows). */
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding-top: var(--gm-header-height);
    background: var(--gm-bg);
    color: var(--gm-text);
    font-family: var(--gm-font);
    font-size: var(--gm-text-size);
    line-height: var(--gm-line-height);
    overflow-wrap: anywhere;
}

h1,
h2,
h3 {
    font-family: var(--gm-font);
    color: var(--gm-text);
    line-height: 1.25;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.375rem;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--gm-accent);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--gm-accent-hover);
    text-decoration-thickness: 2px;
}

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

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ----- Skip link (BR1.4) ------------------------------------------------------------------------------------ */

.gm-skip {
    position: absolute;
    top: -10rem;
    left: 1rem;
    z-index: 1000;
    padding: 0.75rem 1rem;
    background: var(--gm-surface);
    color: var(--gm-text);
    border: 3px solid var(--gm-text);
    font-weight: 700;
}

.gm-skip:focus {
    top: 0.5rem;
}

/* ----- Header and brand ------------------------------------------------------------------------------------- */

.gm-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--gm-accent);
    color: var(--gm-on-accent);
}

.gm-header :focus-visible {
    outline-color: var(--gm-on-accent);
}

/*
    Three columns (logo, title, menu) and two rows. The logo spans both rows; the title and menu share the main
    row; the countdown is the second row, from the title's left edge across to the menu's right edge.
*/
.gm-header-inner {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 1rem;
    row-gap: 0;
    max-width: var(--gm-content-max);
    min-height: 72px;
    margin: 0 auto;
    padding: 0.5rem 24px 0.25rem;
}

.gm-brand-logo {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
    display: block;
}

.gm-brand-logo img {
    display: block;
    width: 60px;
    height: 90px;
    margin: 2px 0;
}

.gm-brand-name {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: start;
    color: var(--gm-on-accent);
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
}

.gm-brand-name:hover {
    color: var(--gm-on-accent);
}

/* From 780px to 999px the title is dropped to leave room for the menu bar; the logo still links home. */
@media (max-width: 999.98px) {
    .gm-brand-name {
        display: none;
    }
}

/* The countdown is the bottom row, in a smaller font, aligned with the title, with a very small gap below. */
.gm-header-countdown {
    grid-column: 2 / -1;
    grid-row: 2;
    align-self: end;
    padding-bottom: 0.1rem;
    font-size: 0.85rem;
    line-height: 1.25;
    text-align: left;
}

.gm-header-countdown[hidden] {
    display: none;
}

/* ----- Menu groups ------------------------------------------------------------------------------------------ */

.gm-menubar,
.gm-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gm-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: var(--gm-target-min);
    min-height: var(--gm-target-min);
    padding: 0.4rem 0.75rem;
    background: transparent;
    color: inherit;
    border: 0;
    border-radius: 4px;
    /* The Web Awesome theme gives every button a hard drop shadow; the menu has none. */
    box-shadow: none;
    font: inherit;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.gm-chevron {
    font-size: 0.8em;
}

.gm-menu-button[aria-expanded="true"] .gm-chevron {
    transform: rotate(180deg);
}

.gm-menu-list {
    display: none;
}

.gm-menu-button[aria-expanded="true"] + .gm-menu-list {
    display: block;
}

.gm-menu-list a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: var(--gm-target-min);
    padding: 0.4rem 1rem;
    box-sizing: border-box;
    color: var(--gm-text);
    text-decoration: none;
}

.gm-menu-list a:hover {
    background: var(--gm-bg);
    color: var(--gm-text);
    text-decoration: underline;
}

.gm-external-icon {
    font-size: 0.8em;
}

/* ----- Menu bar (BR2.2) ------------------------------------------------------------------------------------- */

/* The menu is the right-hand column of the main row. From 780px up it is one line; below that it is the drawer. */
.gm-nav {
    display: block;
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    min-width: 0;
}

.gm-nav .gm-menu-button {
    gap: 0.25rem;
    padding-inline: 0.5rem;
    color: var(--gm-on-accent);
}

.gm-nav .gm-menu-button:hover,
.gm-nav .gm-menu-button[aria-expanded="true"] {
    background: var(--gm-accent-hover);
    text-decoration: underline;
}

/* Tight spacing in the bar, so the five groups fit beside the brand. */
.gm-menubar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0;
}

/* Wide enough for everything on one line: the title and the countdown never wrap from 1000px up. */
@media (min-width: 1000px) {
    .gm-brand-name,
    .gm-header-countdown {
        white-space: nowrap;
    }
}

/* From 780px the five menu groups are one line, always. Narrower than that the menu is the drawer below. */
@media (min-width: 780px) {
    .gm-menubar,
    .gm-menu-button {
        white-space: nowrap;
    }

    .gm-menubar {
        flex-wrap: nowrap;
    }
}

/* The Menu button and the backdrop exist only in the drawer layout. */
.gm-header .gm-nav-toggle,
.gm-nav-backdrop {
    display: none;
}

.gm-header .gm-nav-toggle {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    justify-self: end;
}

.gm-header .gm-nav-toggle:hover {
    background: var(--gm-accent-hover);
    text-decoration: underline;
}

/*
    Below 780px (with the script running) the nav flies out from the left, from the header's bottom edge down, and
    the groups stack vertically, each still a disclosure button. The header stays visible above it, so the Menu
    button also closes it. Without the script the bar above stays and may wrap.
*/
@media (max-width: 779.98px) {
    html.js .gm-header .gm-nav-toggle {
        display: inline-flex;
    }

    /* The Menu button is narrower than the bar, so the title comes back (it is hidden from 780px to 999px). */
    html.js .gm-brand-name {
        display: block;
        /* Wrap between words only; the page default would split "GeoMuster" mid-word. */
        overflow-wrap: normal;
    }

    html.js .gm-nav {
        position: fixed;
        top: var(--gm-header-height);
        left: 0;
        bottom: 0;
        /* The bar centres the nav in its grid cell; here it must fill from the header's edge to the screen's bottom. */
        align-self: stretch;
        z-index: 110;
        box-sizing: border-box;
        width: min(20rem, 85vw);
        overflow-y: auto;
        padding: 0.5rem 0 1.5rem;
        background: var(--gm-accent);
        border-top: 1px solid var(--gm-on-accent);
        box-shadow: 6px 0 18px rgb(0 0 0 / 0.3);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.2s ease, visibility 0s linear 0.2s;
    }

    html.js .gm-nav-open .gm-nav {
        transform: none;
        visibility: visible;
        transition: transform 0.2s ease;
    }

    html.js .gm-nav-backdrop {
        position: fixed;
        inset: var(--gm-header-height) 0 0;
        z-index: 105;
        background: rgb(0 0 0 / 0.5);
    }

    html.js .gm-nav-open .gm-nav-backdrop {
        display: block;
    }

    html.js .gm-menubar {
        display: block;
    }

    html.js .gm-nav .gm-menu-button {
        width: 100%;
        justify-content: space-between;
        padding-inline: 1rem;
        border-radius: 0;
    }

    html.js .gm-nav .gm-menu-list {
        position: static;
        min-width: 0;
        padding: 0 0 0.5rem;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    html.js .gm-nav .gm-menu-list a {
        padding-left: 2rem;
        color: var(--gm-on-accent);
    }

    html.js .gm-nav .gm-menu-list a:hover {
        background: var(--gm-accent-hover);
        color: var(--gm-on-accent);
    }

    html.js .gm-nav .gm-menu-list :focus-visible {
        outline-color: var(--gm-on-accent);
    }
}

@media (max-width: 399.98px) {
    html.js .gm-brand-name {
        font-size: 1rem;
    }
}

@media (max-width: 779.98px) and (prefers-reduced-motion: reduce) {
    html.js .gm-nav,
    html.js .gm-nav-open .gm-nav {
        transition: none;
    }
}

.gm-menu-group {
    position: relative;
}

/* Web Awesome indents list items; the bar's spacing comes only from the buttons' own padding. */
.gm-nav .gm-menu-group {
    margin: 0;
}

.gm-nav .gm-menu-list {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 110;
    min-width: 16rem;
    padding: 0.5rem 0;
    background: var(--gm-surface);
    border: 2px solid var(--gm-accent);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.2);
}

.gm-nav .gm-menu-group:last-child .gm-menu-list {
    left: auto;
    right: 0;
}

.gm-nav .gm-menu-list :focus-visible {
    outline-color: var(--gm-focus);
}

/* Without the site script, a list opens while the group is hovered or holds keyboard focus. */
html:not(.js) .gm-nav .gm-menu-group:hover > .gm-menu-list,
html:not(.js) .gm-nav .gm-menu-group:focus-within > .gm-menu-list {
    display: block;
}

/* ----- Main content and footer ------------------------------------------------------------------------------ */

.gm-main {
    display: block;
    box-sizing: border-box;
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--gm-content-max);
    margin: 0 auto;
    padding: 2rem var(--gm-gutter) 3rem;
}

.gm-main:focus {
    outline: none;
}

.gm-footer {
    flex: none;
    background: var(--gm-accent);
    color: var(--gm-on-accent);
}

.gm-footer a {
    color: var(--gm-on-accent);
}

.gm-footer :focus-visible {
    outline-color: var(--gm-on-accent);
}

.gm-footer-inner {
    box-sizing: border-box;
    max-width: var(--gm-content-max);
    margin: 0 auto;
    padding: 0.75rem 24px;
    /* Two columns: the footer lines on the left, the social icons on the right, centred against all of them. */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.gm-footer-text {
    flex: 1 1 auto;
    min-width: 0;
    /* Only the text; the social icons set their own size in rem below. */
    font-size: 0.875rem;
}

.gm-footer-links {
    margin: 0;
}

.gm-footer-social {
    display: flex;
    flex: 0 0 auto;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    /* The icon is centred in a 44px target; pull the target out part-way so the icon's edge meets the content edge. */
    margin-inline-end: -4px;
}

.gm-footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    font-size: 1.75rem;
}

.gm-footer-links a {
    display: inline-block;
    min-height: 24px;
}

/* ----- Homepage (BR3.2–BR3.6) ------------------------------------------------------------------------------- */

.gm-geocaching {
    color: var(--gm-geocaching);
}
.gm-geocaching a,
.gm-geocaching a:hover {
    color: inherit;
    text-decoration: none;
}
/* The shield sits to the left of the home page hero and spans its height. */
.gm-hero-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.gm-hero-wrap .gm-hero {
    margin-bottom: 0;
}

.gm-hero-shield {
    flex: none;
    width: auto;
    max-width: 100%;
    height: 300px;
    object-fit: contain;
}

.gm-hero {
    margin-bottom: 2rem;
    text-align: center;
}

.gm-hero h1 {
    margin-bottom: 0.5rem;
}

/*
    On every other page the shield sits to the left of the page heading. It is decoration, so it is a
    background image on the heading, not content. The home page hero and the message boxes keep a plain heading.
*/
.gm-main h1 {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.gm-main h1::before {
    content: "";
    flex: none;
    width: 142px;
    height: 150px;
    background: url("/images/shield/shield-400.webp") center / contain no-repeat;
}

.gm-hero h1,
.gm-callout h1 {
    display: block;
}

.gm-hero h1::before,
.gm-callout h1::before {
    content: none;
}

@media (max-width: 767.98px) {
    .gm-hero-wrap {
        flex-direction: column;
    }

    .gm-hero-shield {
        height: 200px;
    }

    .gm-main h1 {
        flex-direction: column;
        align-items: flex-start;
    }
}

.gm-dateline {
    margin: 0;
    font-size: 1.375rem;
}

.gm-tiles,
.gm-buttons {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gm-tiles li,
.gm-buttons li {
    margin: 0;
}

.gm-tiles {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gm-tile {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-sizing: border-box;
    height: 100%;
    min-height: 72px;
    padding: 1rem;
    background: var(--gm-accent);
    color: var(--gm-on-accent);
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.gm-tile:hover {
    background: var(--gm-accent-hover);
    color: var(--gm-on-accent);
}

.gm-tile:active {
    background: var(--gm-text);
}

.gm-tile i {
    font-size: 2rem;
}

.gm-tile-img {
    height: 4.5rem;
    width: auto;
}

/* Mid widths: two columns, with the third tile across the full row, rather than three wide stacked bars. */
@media (min-width: 600px) and (max-width: 899.98px) {
    .gm-tiles {
        grid-template-columns: repeat(2, 1fr);
    }

    .gm-tiles li:last-child {
        grid-column: 1 / -1;
    }
}

@media (min-width: 900px) {
    .gm-tiles {
        grid-template-columns: repeat(3, 1fr);
    }

    .gm-tile {
        min-height: 120px;
    }
}

/* The buttons use the same columns and gap as the tiles above them, so each button is as wide as its tile. */
.gm-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* The Barley button's image sets the height (2.5rem image, the button's vertical padding and border); the other two
   match it, whichever row they land in, and stretch to the grid row's height. */
.gm-buttons .gm-button {
    width: 100%;
    height: 100%;
    min-height: calc(2.5rem + 1.2rem + 4px);
}

@media (min-width: 600px) and (max-width: 899.98px) {
    .gm-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .gm-buttons li:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (min-width: 900px) {
    .gm-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gm-button {
    /* The Web Awesome theme gives <button> a raised shadow and offset margins; these buttons are flat. */
    box-shadow: none;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-sizing: border-box;
    min-width: var(--gm-target-min);
    min-height: var(--gm-target-min);
    padding: 0.6rem 1.25rem;
    background: var(--gm-accent);
    color: var(--gm-on-accent);
    border: 2px solid var(--gm-accent);
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.gm-button-img {
    height: 3.5rem;
    width: auto;
}

.gm-heading-img {
    height: 3.5rem;
    width: auto;
    vertical-align: middle;
    margin-inline-start: 0.5rem;
}

.gm-button:hover {
    background: var(--gm-accent-hover);
    border-color: var(--gm-accent-hover);
    color: var(--gm-on-accent);
}

.gm-button:disabled {
    cursor: progress;
    opacity: 0.85;
}

@media (max-width: 767.98px) {
    .gm-buttons .gm-button,
    .gm-submit {
        width: 100%;
    }
}

/* ----- Panels, messages and the sign-up form (BR5.1, BR5.5, NFR1.6) ---------------------------------------- */

.gm-panel {
    padding: 1.5rem;
    background: var(--gm-surface);
    border: 2px solid var(--gm-accent);
    border-radius: 8px;
}

.gm-panel > :last-child {
    margin-bottom: 0;
}

.gm-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 0 0 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--gm-surface);
    border: 3px solid var(--gm-success);
    border-radius: 8px;
}

.gm-callout--danger {
    border-color: var(--gm-danger);
}

.gm-callout-icon {
    flex: none;
    margin-top: 0.3rem;
    font-size: 1.5rem;
    color: var(--gm-success);
}

.gm-callout--danger .gm-callout-icon {
    color: var(--gm-danger);
}

.gm-callout p:last-child,
.gm-callout h1,
.gm-callout h2 {
    margin-bottom: 0;
}

.gm-callout h1 + p,
.gm-callout h2 + p {
    margin-top: 0.5rem;
}

.gm-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 1rem;
}

@media (min-width: 768px) {
    .gm-form-row {
        grid-template-columns: 1fr 1fr;
    }
}

.gm-form-field {
    margin-bottom: 1rem;
}

.gm-form-field label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.gm-form-field input,
.gm-form-field textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: var(--gm-target-min);
    padding: 0.5rem 0.75rem;
    background: var(--gm-field);
    color: var(--gm-text);
    border: 2px solid var(--gm-text);
    border-radius: 4px;
    font: inherit;
}

.gm-form-field textarea {
    resize: vertical;
}

.gm-form-field input[aria-invalid="true"],
.gm-form-field textarea[aria-invalid="true"] {
    border-color: var(--gm-danger);
    border-width: 3px;
}

.gm-field-error {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: 0.25rem 0 0;
    color: var(--gm-danger);
    font-weight: 600;
}

/* The honeypot: off screen, out of the Tab order and hidden from screen readers (BR6.1, NFR4.8). */
.gm-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ----- Status and text pages -------------------------------------------------------------------------------- */

.gm-status-page {
    max-width: 40rem;
}

.gm-status-icon {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 3rem;
    color: var(--gm-accent);
}

.gm-prose {
    max-width: 70ch;
}

.gm-prose ul {
    padding-left: 1.5rem;
}

.gm-prose h2 {
    margin-top: 2rem;
}

.gm-prose h3 {
    margin-top: 1.5rem;
}

.gm-address {
    margin: 0 0 1rem;
    font-style: normal;
}

/* Links on content pages: each one is a full-height tap target. */
.gm-link-list,
.gm-prose .gm-link-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.gm-link-list li {
    margin: 0;
}

.gm-link-list a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: var(--gm-target-min);
}

/* ----- Calendar page ------------------------------------------------------------------------------------------ */
/* A list of day cards. From 640px two columns; from 1000px a Monday-to-Sunday grid whose first card starts in its
   weekday's column (gm-cal-col-N). Days with nothing on only appear in the grid, as blank cells. */

.gm-cal-page {
    max-width: none;
}

.gm-cal-page > p {
    max-width: 70ch;
}

.gm-cal {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
}

.gm-cal-day {
    margin: 0;
    overflow: hidden;
    /* Break a word only when it cannot fit its cell (the page default would split any word anywhere). */
    overflow-wrap: break-word;
    background: var(--gm-surface);
    border: 2px solid var(--gm-accent);
    border-radius: 6px;
}

.gm-cal-empty {
    display: none;
}

/* Prefixed with .gm-cal-page so they out-rank the generic .gm-prose h2 and .gm-prose ul rules. */
.gm-cal-page .gm-cal-date {
    margin: 0;
    padding: 0.4rem 0.75rem;
    background: var(--gm-accent);
    color: var(--gm-on-accent);
    font-size: 1.05rem;
    line-height: 1.3;
}

.gm-cal-page .gm-cal-events {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gm-cal-event {
    margin: 0;
    padding: 0.6rem 0.75rem;
}

.gm-cal-event + .gm-cal-event {
    border-top: 1px solid var(--gm-accent);
}

.gm-cal-event p {
    margin: 0;
    line-height: 1.35;
}

.gm-cal-time {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gm-accent);
}

.gm-cal-group {
    font-size: 0.9rem;
    font-style: italic;
}

.gm-cal-title {
    font-weight: 700;
}

.gm-cal-where {
    font-size: 0.95rem;
}

@media (min-width: 640px) {
    .gm-cal {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1000px) {
    .gm-cal {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .gm-cal-empty {
        display: block;
        background: transparent;
        border-style: dashed;
        border-color: color-mix(in srgb, var(--gm-accent) 40%, transparent);
    }

    .gm-cal-page .gm-cal-empty .gm-cal-date {
        background: transparent;
        color: var(--gm-text);
        opacity: 0.6;
    }

    .gm-cal-page .gm-cal-date {
        padding: 0.35rem 0.5rem;
        font-size: 0.95rem;
    }

    .gm-cal-event {
        padding: 0.5rem;
    }

    .gm-cal-time,
    .gm-cal-where,
    .gm-cal-group {
        font-size: 0.85rem;
    }

    .gm-cal-title {
        font-size: 0.95rem;
    }

    .gm-cal-col-1 { grid-column-start: 1; }
    .gm-cal-col-2 { grid-column-start: 2; }
    .gm-cal-col-3 { grid-column-start: 3; }
    .gm-cal-col-4 { grid-column-start: 4; }
    .gm-cal-col-5 { grid-column-start: 5; }
    .gm-cal-col-6 { grid-column-start: 6; }
    .gm-cal-col-7 { grid-column-start: 7; }
}

/* ----- Location map ------------------------------------------------------------------------------------------ */

.gm-map {
    margin: 1.5rem 0;
}

.gm-map a {
    display: block;
    max-width: 640px;
}

.gm-map img {
    display: block;
    width: 100%;
    height: auto;
    box-sizing: border-box;
    border: 2px solid var(--gm-accent);
    border-radius: 6px;
}

/* ----- Picture rotator (Barley page) ------------------------------------------------------------------------- */
/* Without the script every picture shows in a wrapped row, loaded lazily. With it (.gm-rotator-on) one shows at a
   time, centred, and the script changes it. */

.gm-rotator {
    margin: 2rem 0;
}

.gm-rotator-slides {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gm-rotator-slide {
    margin: 0;
}

.gm-rotator-slide[hidden] {
    display: none;
}

.gm-rotator-slide img {
    display: block;
    width: auto;
    max-width: 100%;
    height: 14rem;
    /* The pictures have white backgrounds, so they are framed as cards rather than left floating on the page. */
    background: #fff;
    border: 2px solid var(--gm-accent);
    border-radius: 12px;
    box-sizing: border-box;
}

.gm-rotator-on .gm-rotator-slide img {
    height: auto;
    max-height: min(70vh, 40rem);
    margin: 0 auto;
}

/* The description of a picture. Without the script each picture and its text form a narrow column in the row. With
   it the paragraphs inside the slides are hidden and the script shows the current one in the description area under
   the buttons, which keeps room for five lines so the page does not jump between short and long texts. */
.gm-rotator-slide {
    max-width: 22rem;
}

.gm-rotator-on .gm-rotator-slide {
    max-width: none;
}

.gm-rotator-text {
    max-width: 40rem;
    margin: 0.75rem auto 0;
}

.gm-rotator-on .gm-rotator-text {
    display: none;
}

.gm-rotator-description {
    max-width: 40rem;
    min-height: 7.5em; /* five lines at the 1.5 line height below */
    margin: 1rem auto 0;
    line-height: 1.5;
}

.gm-rotator-description[hidden] {
    display: none;
}

.gm-rotator-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.gm-rotator-controls[hidden] {
    display: none;
}

.gm-rotator-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-sizing: border-box;
    min-width: var(--gm-target-min);
    height: auto;
    min-height: var(--gm-target-min);
    margin: 0;
    padding: 0.25rem 0.9rem;
    background: transparent;
    color: var(--gm-accent);
    border: 2px solid var(--gm-accent);
    border-radius: 6px;
    box-shadow: none;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.gm-rotator-button:hover {
    background: var(--gm-accent);
    color: var(--gm-on-accent);
}

.gm-rotator-toggle {
    min-width: 6rem;
}

.gm-rotator-count {
    flex-basis: 100%;
    margin: 0;
    text-align: center;
}

/* ----- Calendar event information --------------------------------------------------------------------------- */
/* Without the script each description shows under its event. With it (.gm-cal-on) the descriptions are hidden, each
   event becomes clickable, and the description opens in a modal dialog the script builds. */

.gm-cal-desc {
    margin-top: 0.4rem;
}

.gm-cal-desc p + p {
    margin-top: 0.4rem;
}

.gm-cal-on .gm-cal-desc {
    display: none;
}

/* The script turns the title into a button; its ::after stretches over the whole event cell, so the cell is the click
   target and the button keeps the keyboard focus and the screen-reader name. */
.gm-cal-on .gm-cal-clickable {
    position: relative;
    cursor: pointer;
}

.gm-cal-on .gm-cal-clickable:hover {
    background: color-mix(in srgb, var(--gm-accent) 12%, transparent);
}

.gm-cal-open {
    all: unset;
    cursor: pointer;
}

.gm-cal-open::after {
    content: "";
    position: absolute;
    inset: 0;
}

.gm-cal-open:hover {
    text-decoration: underline;
}

.gm-cal-open:focus-visible {
    outline: none;
}

.gm-cal-open:focus-visible::after {
    outline: 3px solid var(--gm-focus);
    outline-offset: -3px;
}

.gm-cal-dialog {
    box-sizing: border-box;
    width: min(40rem, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    margin: auto;
    padding: 0;
    overflow: auto;
    background: var(--gm-surface);
    color: var(--gm-text);
    border: 2px solid var(--gm-accent);
    border-radius: 12px;
}

.gm-cal-dialog::backdrop {
    background: rgb(0 0 0 / 55%);
}

/* The page behind does not scroll while the dialog is open. */
:root:has(.gm-cal-dialog[open]) {
    overflow: hidden;
}

.gm-cal-dialog-box {
    padding: 1.25rem 1.5rem 1.5rem;
}

.gm-cal-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.gm-cal-dialog-head h2 {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.25;
}

.gm-cal-dialog-close {
    flex: none;
    box-sizing: border-box;
    min-width: var(--gm-target-min);
    min-height: var(--gm-target-min);
    margin: 0;
    padding: 0.25rem 0.9rem;
    box-shadow: none;
    background: var(--gm-accent);
    color: var(--gm-on-accent);
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.gm-cal-dialog-close:hover {
    background: var(--gm-accent-hover);
}

.gm-cal-dialog-meta {
    margin-top: 0.75rem;
}

.gm-cal-dialog-meta p {
    margin: 0;
}

.gm-cal-dialog-when {
    font-weight: 700;
    color: var(--gm-accent);
}

.gm-cal-dialog-group {
    font-style: italic;
}

.gm-cal-dialog-text {
    margin-top: 1rem;
}

.gm-cal-dialog-text p {
    margin: 0;
}

.gm-cal-dialog-text p + p {
    margin-top: 0.75rem;
}

/* ----- Font Awesome icons ------------------------------------------------------------------------------------ */
/* The kit swaps each <i> for an <svg>, and sizes it with a style block the Content Security Policy blocks, so the
   sizing lives here. */
.svg-inline--fa {
    display: inline-block;
    height: 1em;
    width: 1.25em;
    overflow: visible;
    vertical-align: -0.125em;
    fill: currentColor;
}
