/* Glasgow's Secret Geometry: shared foundations, used by the map (index.html,
   edit.html) and by every page of the Astro site (src/layouts/Base.astro).
   After the cover of Harry Bell's book and his hand-drawn sightline maps:
   marker capitals, ochre, pen-and-ink lines and old serif labels.
   Tokens, type, the masthead and the drawer live here; map-only styles are in
   style.css, article styles in src/styles/site.css. See /styleguide/. */
/* IM Fell English, self-hosted (SIL OFL, see fonts/OFL.txt) */
@font-face { font-family: "IM Fell English"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/im-fell-english.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/im-fell-english-italic.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English SC"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/im-fell-english-sc.woff2") format("woff2"); }

:root {
  --paper: #fcfaf5;
  --ink: #1a1816;
  --ink-soft: #625d55;
  --rule-soft: #e8e2d6;
  --red: #9e3a26;
  --teal: #3d6670;
  --blue: #2f5d8a;
  --ochre: #d98a1c;
  --ochre-soft: #f6e6c8;
  --focus: #d98a1c;
  --line: 1.5px solid var(--ink);

  --font-hand: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --font-label: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --font-fell: "IM Fell English", Georgia, serif;
  --font-sans: "IM Fell English", Georgia, serif;
  --mast-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-sans); font-weight: 400; font-size: 17px; line-height: 1.5; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ochre); }
button { font: inherit; color: inherit; }
strong, b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.button-reset, .link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-align: left; }
.link:hover { color: var(--ochre); }

/* ---------- masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 1100;
  display: grid; grid-template-columns: minmax(40px, 1fr) auto minmax(40px, 1fr); align-items: center; gap: 16px;
  padding: 12px 24px;
  background: var(--paper); border-bottom: 3px solid var(--ochre);
}
.title .mark { display: inline-block; width: .95em; height: .95em; margin-right: .3em; vertical-align: -.1em; color: var(--ochre); }
.title .mark svg { display: block; width: 100%; height: 100%; }
.menu-btn { justify-self: start; display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 0; cursor: pointer; font-family: var(--font-label); font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.menu-btn:hover { color: var(--ochre); }
.burger { display: grid; gap: 4px; width: 22px; }
.burger span { height: 2px; background: currentColor; }
.menu-btn[aria-expanded="true"] { color: var(--ochre); }
.title { margin: 0; text-align: center; font-family: var(--font-hand); font-weight: 400; text-transform: uppercase; font-size: clamp(12px, 3.9vw, 2.3rem); line-height: 1; letter-spacing: .01em; white-space: nowrap; }
.title a { text-decoration: none; }
.title a:hover { color: inherit; }
/* the button on the right: the map's drawer on the map, a link to the map on the site */
.mast-icon { justify-self: end; display: grid; place-items: center; width: 40px; height: 40px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); }
.mast-icon svg { width: 24px; height: 24px; }
.mast-icon:hover, .mast-icon[aria-expanded="true"], .mast-icon[aria-current="page"] { color: var(--ochre); }
.menu-btn.end { justify-self: end; }

/* the site's menu as a row of links, on wide screens only (narrow ones use the
   drawer). On the map it is filled from nav.json, which Astro builds. */
.site-nav { display: none; }
.site-nav ul { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
.site-nav a { font-family: var(--font-label); font-size: 1.05rem; text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; padding: 2px 0; }
.site-nav a:hover { color: var(--ochre); }
.site-nav a[aria-current] { border-bottom-color: var(--ochre); }
@media (min-width: 1180px) {
  .masthead { grid-template-columns: auto minmax(0, 1fr) auto; }
  .masthead > .menu-btn:not(.end) { display: none; }
  .title { text-align: left; font-size: clamp(1.4rem, 1.9vw, 2rem); }
  .site-nav { display: block; }
}

/* ---------- drawer (the side menu) ---------- */
.scrim { position: fixed; inset: var(--mast-h) 0 0 0; z-index: 1150; background: rgba(26, 24, 22, .28); }
.drawer {
  position: fixed; top: var(--mast-h); left: 0; bottom: 0; z-index: 1200;
  width: min(420px, 92vw); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 26px 32px; background: var(--paper); border-right: 3px solid var(--ochre);
  transform: translateX(-102%); transition: transform .28s ease; visibility: hidden;
}
.drawer.is-open { transform: none; visibility: visible; }
/* the map's own drawer opens from the right; the site menu from the left */
.drawer.right { left: auto; right: 0; border-right: 0; border-left: 3px solid var(--ochre); transform: translateX(102%); }
.drawer.right.is-open { transform: none; }
.drawer-close.left { float: left; margin: 0 0 0 -12px; }
.drawer-close { position: relative; float: right; margin-right: -12px; background: var(--paper); border: 0; font-size: 1.8rem; line-height: 1; padding: 4px 8px; cursor: pointer; color: var(--ink); }
.drawer-close:hover { color: var(--ochre); }
.drawer-head { margin: 20px 0 8px; padding-top: 10px; border-top: var(--line); font-family: var(--font-hand); font-weight: 400; font-size: 1.25rem; }
.drawer-head.first { border-top: 0; padding-top: 4px; }
.drawer p { margin: 0 0 .7em; }
/* the site menu, in the drawer */
.menu, .menu ul { list-style: none; margin: 0; padding: 0; }
.menu a { display: block; padding: 8px 4px; border-bottom: 1px solid var(--rule-soft); text-decoration: none; font-size: 1.1rem; }
.menu a:hover { background: var(--ochre-soft); color: inherit; }
.menu ul a { padding-left: 26px; font-size: 1rem; font-style: italic; }
.menu [aria-current="page"] { color: var(--red); background: var(--ochre-soft); }
.drawer-sub { font-style: italic; color: var(--ink-soft); }

/* ---------- shared prose pieces ---------- */
.epigraph { margin: 0 0 16px; padding: 4px 0 4px 16px; border-left: 3px solid var(--ochre); font-family: var(--font-fell); font-style: italic; color: var(--ink); }
.epigraph cite { display: block; margin-top: 4px; font-style: normal; font-family: var(--font-label); font-size: .85rem; color: var(--ochre); }
.rule-head { margin: 22px 0 8px; padding-top: 10px; border-top: var(--line); font-family: var(--font-hand); font-weight: 400; font-size: 1.15rem; letter-spacing: .02em; }
.rule-head small { font-family: var(--font-sans); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-soft); font-size: .8rem; margin-left: 6px; }
.rule-head.first { margin-top: 14px; padding-top: 0; border-top: 0; }
.note { margin: 14px 0 0; padding: 8px 12px; background: var(--ochre-soft); border-left: 3px solid var(--ochre); font-size: .95rem; }
.note b { font-family: var(--font-label); font-weight: 400; font-size: .95rem; display: block; color: var(--red); }
.swatch { width: 22px; height: 0; border-top: 3px solid var(--c); flex: none; }
.swatch.dash { border-top-style: dashed; }

.footer { padding: 16px 24px; font-size: .78rem; color: var(--ink-soft); }
.footer p { margin: 0; max-width: 72em; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .title .mark { display: none; }
}
@media (max-width: 620px) {
  /* one-line title between the menu and icon buttons; the title is about
     16.8em wide, so fit it to what the two icons leave */
  .masthead { padding: 8px 12px; gap: 10px; grid-template-columns: 32px minmax(0, 1fr) 32px; }
  .menu-label { display: none; }
  .title { font-size: clamp(11px, calc((100vw - 110px) / 16.8), 1.6rem); letter-spacing: 0; }
  .mast-icon { width: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
