/* Friends of Pitminster — site styles
   Layout: a parish noticeboard. Left-aligned measure, photographs sit in the
   text column at their true size, Ham-stone brass rules carry the structure. */

:root {
  /* color */
  --stone: #EDEBE6;      /* lime-washed stone: the page */
  --stone-2: #E1DED6;    /* deeper stone: bands and panels */
  --paper: #F8F7F3;      /* a lighter sheet for forms and notes */
  --slate: #23292E;      /* ink; the slate roofs */
  --lead: #5C6973;       /* secondary text; the lead spire */
  --line: #CFCAC0;       /* hairlines */
  --ham: #B4862B;        /* Ham stone / engraved brass: the accent */
  --ham-2: #8A661E;      /* brass in shadow: links on light ground */
  --moss: #3F5A3F;       /* the Blackdown green */
  --gules: #8F2A20;      /* the red of the Treat arms, used once */
  /* type */
  --display: "Libre Caslon Display", "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --body: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --measure: 66ch;
  /* the masthead and footer: slate in both themes */
  --night: #1F2529;
  --night-2: #2A3237;
  --night-ink: #ECE8E0;
  --night-mute: #A9B2B8;
  --night-brass: #D2A95B;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
@media (min-width: 48rem) { :root { --gutter: max(32px, env(safe-area-inset-left, 0px)); } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stone: #1B2024; --stone-2: #242B31; --paper: #20262B;
    --slate: #E7E3DB; --lead: #A6AFB6; --line: #3A434A;
    --ham: #D2A95B; --ham-2: #E2BF78; --moss: #93B38F; --gules: #D86A5E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --stone: #1B2024; --stone-2: #242B31; --paper: #20262B;
  --slate: #E7E3DB; --lead: #A6AFB6; --line: #3A434A;
  --ham: #D2A95B; --ham-2: #E2BF78; --moss: #93B38F; --gules: #D86A5E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stone);
  color: var(--slate);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ham-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--slate); }
:focus-visible { outline: 2px solid var(--ham); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.5rem); letter-spacing: -0.005em; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0; }
p + p, p + ul, ul + p { margin-top: 1em; }
ul, ol { margin: 0; padding-left: 1.25em; }
li + li { margin-top: .35em; }
figure { margin: 0; }
figcaption { font-size: .9rem; color: var(--lead); margin-top: .5rem; line-height: 1.45; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
small, .small { font-size: .9rem; }
.muted { color: var(--lead); }
.tnum { font-variant-numeric: tabular-nums; }

/* containers */
.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.6rem; margin-bottom: .9rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.8rem; margin-bottom: .5rem; }
.prose figure { margin: 1.6rem 0; }
.prose ul, .prose ol { margin-top: .75em; }

/* a brass rule above section titles, the way a tablet is ruled */
.rule { border-top: 2px solid var(--ham); width: 3.5rem; margin: 0 0 .9rem; }
.band { background: var(--stone-2); }
.band-dark { background: var(--slate); color: var(--stone); }
.band-dark a { color: var(--ham); }
.band-dark a:hover { color: var(--stone); }
.band-dark .muted { color: #B9C0C6; }

/* masthead: a slate band ruled in brass, like the edge of the 1902 tablet */
.masthead { background: var(--night); color: var(--night-ink); border-bottom: 2px solid var(--night-brass); position: relative; z-index: 5; }
.masthead .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 2rem; padding-block: .7rem; }
.brand { display: flex; align-items: center; gap: .8rem; color: var(--night-ink); text-decoration: none; min-width: 0; }
.brand .mark { width: 2.75rem; height: 2.75rem; flex: none; color: var(--night-brass); }
.brand-name { font-family: var(--display); font-size: 1.5rem; line-height: 1.05; letter-spacing: .005em; }
.brand:hover .brand-name { color: var(--night-brass); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.4rem; }
.nav li { margin: 0; }
.nav a { display: inline-block; padding: .45rem 0; text-decoration: none; color: var(--night-ink); border-bottom: 1px solid transparent; font-size: 1rem; }
.nav a:hover { color: var(--night-brass); }
.nav a[aria-current="page"] { border-bottom-color: var(--night-brass); color: var(--night-brass); }
.menu-toggle { display: none; font: inherit; font-family: var(--display); font-size: 1.05rem; color: var(--night-ink); background: transparent; border: 1px solid var(--night-mute); padding: .35rem .8rem; cursor: pointer; line-height: 1.2; }
.menu-toggle:hover, .menu-toggle[aria-expanded="true"] { border-color: var(--night-brass); color: var(--night-brass); }
@media (max-width: 71.99rem) {
  .js .menu-toggle { display: block; }
  .nav { flex-basis: 100%; }
  .js .nav { display: none; }
  .js .nav.open { display: block; }
  .nav ul { flex-direction: column; gap: 0; padding: .25rem 0 .5rem; }
  .nav a { display: block; padding: .7rem 0; border-bottom: 1px solid var(--night-2); font-size: 1.1rem; }
  .nav li:last-child a { border-bottom: 0; }
  .nav a[aria-current="page"] { border-bottom-color: var(--night-2); }
}
@media (max-width: 47.99rem) {
  .brand .mark { width: 2.4rem; height: 2.4rem; }
  .brand-name { font-size: 1.25rem; }
}

/* hero: the church at dusk, full-bleed; the headline sits over the churchyard */
.hero { position: relative; height: min(78svh, 46rem); min-height: 26rem; background: var(--night); overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 38% 30%; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(17,21,24,.88) 0%, rgba(17,21,24,.55) 32%, rgba(17,21,24,0) 62%); pointer-events: none; }
.hero-copy { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; color: #F3EFE7; }
.hero-copy .wrap { padding-block: 0 1.6rem; }
.hero h1 { font-size: clamp(2.05rem, 1.2rem + 3.9vw, 4.4rem); max-width: 17ch; line-height: 1.06; text-shadow: 0 1px 18px rgba(0,0,0,.35); }
.hero-credit { margin-top: .9rem; font-size: .82rem; color: rgba(243,239,231,.72); }
@media (min-width: 56rem) { .hero { height: min(86vh, 52rem); } .hero-copy .wrap { padding-block: 0 2.6rem; } }
.lede { font-size: 1.2rem; line-height: 1.5; }

/* the standfirst under the hero */
.intro .wrap { display: grid; gap: 1.5rem 4rem; padding-block: 2.25rem 2.5rem; }
@media (min-width: 56rem) { .intro .wrap { grid-template-columns: minmax(0, 1fr) 16rem; padding-block: 3rem; align-items: start; } }
.intro-text { max-width: 62ch; }
.intro .lede { font-size: clamp(1.2rem, 1.05rem + .5vw, 1.4rem); line-height: 1.5; }
.intro-links { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ham); }
.intro-links li { margin: 0; }
.intro-links a { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--slate); font-family: var(--display); font-size: 1.2rem; }
.intro-links a::after { content: ""; flex: none; width: .45rem; height: .45rem; border-top: 1.5px solid var(--ham-2); border-right: 1.5px solid var(--ham-2); transform: rotate(45deg) translateY(-.1rem); }
.intro-links a:hover { color: var(--ham-2); }

/* three equal doors */
.doors { display: grid; gap: 2rem; padding-block: 2.5rem 3rem; }
@media (min-width: 48rem) { .doors { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem; } }
.door { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.door img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.door h2 { font-size: 1.6rem; }
.door p { flex: 1; }
.door a.more { font-family: var(--display); font-size: 1.05rem; text-decoration: none; border-bottom: 1px solid var(--ham); align-self: flex-start; }
.door a.more:hover { color: var(--ham-2); }

/* page header: the photograph leads on a phone; on a laptop it sits beside the title */
.pagehead .wrap { padding-block: 2.25rem 1.5rem; }
.pagehead h1 { max-width: 20ch; margin-bottom: .75rem; }
.pagehead .lede { max-width: 58ch; }
.pagehead figure { margin-top: 1.5rem; max-width: 48rem; }
.pagehead.has-photo .wrap { display: grid; grid-template-columns: minmax(0, 1fr); padding-top: 0; }
.pagehead.has-photo figure { order: -1; margin: 0 calc(-1 * var(--gutter)) 1.6rem; max-width: none; }
.pagehead.has-photo figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.pagehead.has-photo figure.natural img { aspect-ratio: auto; }
.pagehead.has-photo figcaption { padding: 0 var(--gutter); }
@media (min-width: 56rem) {
  .pagehead.has-photo .wrap { grid-template-columns: minmax(0, 6fr) minmax(0, 7fr); grid-template-rows: auto auto 1fr; column-gap: 3.5rem; padding-block: 3rem 1.5rem; }
  .pagehead.has-photo .wrap > :not(figure) { grid-column: 1; }
  .pagehead.has-photo figure { order: 0; grid-column: 2; grid-row: 1 / span 3; margin: 0; }
  .pagehead.has-photo figcaption { padding: 0; }
}

/* generic page body */
.page .wrap { padding-block: 2rem 3.5rem; display: grid; gap: 2.5rem 4rem; }
@media (min-width: 60rem) { .page .wrap { grid-template-columns: minmax(0, 1fr) 18rem; } }
.aside { font-size: .95rem; min-width: 0; }
.aside h3 { font-size: 1.15rem; margin-bottom: .5rem; }
.aside .box { background: var(--paper); border-top: 2px solid var(--ham); padding: 1rem 1.1rem; }
.aside .box + .box { margin-top: 1.25rem; }
.aside dl { margin: 0; }
.aside dt { color: var(--lead); font-size: .85rem; }
.aside dd { margin: 0 0 .7rem; }
.aside dd:last-child { margin-bottom: 0; }

/* two-up figures */
.pair { display: grid; gap: 1.25rem; margin: 1.6rem 0; }
@media (min-width: 40rem) { .pair { grid-template-columns: 1fr 1fr; } }
.pair img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.pair-prog { align-items: start; }
.pair-prog img { aspect-ratio: auto; object-fit: contain; max-width: 14rem; }
@media (min-width: 40rem) { .pair-prog { grid-template-columns: minmax(0, 14rem) 1fr; } }

/* the Atlantic timeline: Somerset above the brass line, New England below */
.tl { overflow-x: auto; padding-block: 1rem .5rem; -webkit-overflow-scrolling: touch; }
.tl-track { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 11.5rem; gap: 0; min-width: max-content; padding: 0 .5rem; }
.tl-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--ham); }
.tl-item { display: grid; grid-template-rows: 1fr 1.6rem 1fr; min-height: 15rem; padding: 0 .9rem 0 0; }
.tl-item .above, .tl-item .below { font-size: .92rem; line-height: 1.4; }
.tl-item .above { align-self: end; padding-bottom: .75rem; }
.tl-item .below { align-self: start; padding-top: .75rem; }
.tl-item .pip { position: relative; }
.tl-item .pip::before { content: ""; position: absolute; left: 0; top: 50%; width: .8rem; height: .8rem; transform: translateY(-50%); background: var(--ham); border-radius: 50%; box-shadow: 0 0 0 3px var(--stone-2); }
.tl-item .pip span { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); font-family: var(--display); font-size: 1.05rem; font-variant-numeric: tabular-nums; background: var(--stone-2); padding: 0 .35rem; }
.tl-item .where { color: var(--lead); font-size: .8rem; display: block; margin-bottom: .15rem; }
.tl-key { display: flex; gap: 1.5rem; font-size: .85rem; color: var(--lead); margin-top: .25rem; }

/* arms */
.arms { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1.25rem; align-items: center; margin: 1.6rem 0; }
.arms svg { width: 100%; height: auto; }

/* the line of descent: a true sequence, so it is numbered */
.line { counter-reset: gen; list-style: none; padding: 0; margin: 1rem 0 0; max-width: var(--measure); }
.line li { counter-increment: gen; position: relative; padding: .55rem 0 .55rem 2.6rem; margin: 0; border-top: 1px solid var(--line); }
.line li::before { content: counter(gen); position: absolute; left: 0; top: .55rem; font-family: var(--display); color: var(--ham-2); font-variant-numeric: tabular-nums; }
.line li:last-child { border-bottom: 1px solid var(--line); }
.line b { font-weight: 400; font-family: var(--display); }

/* games */
.games { display: grid; gap: 2rem; }
@media (min-width: 48rem) { .games { grid-template-columns: 1fr 1fr; } }
.game { background: var(--paper); border-top: 2px solid var(--ham); padding: 1.25rem 1.35rem 1.5rem; display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.game h2 { font-size: 1.5rem; }
.game .status { color: var(--lead); font-size: .9rem; }

/* buttons */
.btn { display: inline-block; font-family: var(--display); font-size: 1.05rem; color: var(--stone); background: var(--slate); text-decoration: none; padding: .6rem 1.1rem; border: 1px solid var(--slate); cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--ham-2); border-color: var(--ham-2); color: #fff; }
.btn-quiet { background: transparent; color: var(--slate); }
.btn-quiet:hover { background: var(--slate); color: var(--stone); }
.band-dark .btn { background: var(--ham); border-color: var(--ham); color: #1B2024; }
.band-dark .btn:hover { background: var(--stone); border-color: var(--stone); color: var(--slate); }

/* forms */
form { max-width: var(--measure); }
.field { display: grid; gap: .3rem; margin-top: 1rem; }
.field label { font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--lead); }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  font: inherit; color: var(--slate); background: var(--paper);
  border: 1px solid var(--line); border-bottom-color: var(--lead); padding: .55rem .7rem; width: 100%; max-width: 100%;
}
textarea { min-height: 8rem; resize: vertical; }
input:focus, textarea:focus { border-color: var(--ham); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ham) 25%, transparent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { background: var(--paper); border-left: 3px solid var(--ham); padding: .8rem 1rem; margin-top: 1rem; }
.notice.ok { border-left-color: var(--moss); }
.notice.err { border-left-color: var(--gules); }

/* the family wall */
.wall { display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.post { background: var(--paper); border-top: 2px solid var(--ham); padding: 1rem 1.15rem 1.1rem; min-width: 0; }
.post header { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; margin-bottom: .5rem; }
.post header b { font-family: var(--display); font-weight: 400; font-size: 1.15rem; }
.post header span { color: var(--lead); font-size: .9rem; }
.post p { white-space: pre-line; overflow-wrap: anywhere; }
.post .ex { color: var(--lead); font-size: .8rem; margin-top: .6rem; }

/* visit strip on the home page */
.strip .wrap { display: grid; gap: 1.5rem 3rem; padding-block: 2.25rem; }
@media (min-width: 56rem) { .strip .wrap { grid-template-columns: 1fr 1fr; } }
.strip h2 { font-size: 1.6rem; margin-bottom: .6rem; }

/* footer: the slate band again, with the lettered seal */
.foot { background: var(--night); color: var(--night-mute); border-top: 2px solid var(--night-brass); margin-top: 1rem; }
.foot .wrap { padding-block: 2.25rem 2.75rem; display: grid; gap: 1.5rem 3rem; font-size: .9rem; align-items: start; }
@media (min-width: 48rem) { .foot .wrap { grid-template-columns: 8.5rem minmax(0, 2fr) minmax(0, 1fr); } }
.foot .foot-seal { display: block; width: 8.5rem; color: var(--night-brass); }
.foot .foot-seal:hover { color: var(--night-ink); }
.foot-seal svg { display: block; width: 100%; height: auto; }
.foot a { color: var(--night-ink); }
.foot a:hover { color: var(--night-brass); }
.foot ul { list-style: none; padding: 0; }

/* admin */
.admin-row { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: start; border-top: 1px solid var(--line); padding: .8rem 0; }
.admin-row .acts { display: flex; gap: .5rem; flex-wrap: wrap; }
.admin-row .acts button { font: inherit; font-size: .9rem; padding: .35rem .7rem; cursor: pointer; background: var(--paper); border: 1px solid var(--line); color: var(--slate); }
.admin-row .acts button:hover { border-color: var(--ham); }
.tabs { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.tabs button { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; padding: .3rem 0; cursor: pointer; color: var(--slate); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--ham); }

@media (prefers-reduced-motion: no-preference) {
  a, .btn, .nav a { transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
}
@media print { .nav, .menu-toggle, .foot, .btn { display: none; } .masthead, .hero { background: none; color: #000; } .hero { height: auto; } .hero-img, .hero::after { display: none; } .hero-copy { position: static; color: #000; } }
