
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Source+Sans+3:wght@300;400;600&display=swap');

:root {
    --ink: #1a1a18;
    --parchment: #f5f0e8;
    --warm-mid: #8b7355;
    --accent: #5c3d1e;
    --accent-light: #c4a882;
    --border: #d4c9b5;
    --bg: #faf7f2;
    --seal-red: #8b2c2c;
    --white: #ffffff;
    --shadow: 0 2px 12px rgba(26,26,24,0.08);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.7;
    min-height: 100vh;
}

/* ── Header ── */
.site-header {
    background: var(--accent);
    color: var(--parchment);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(26,26,24,0.2);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    flex-wrap: wrap;
}

/* The brand is one link: the title, with the subtitle set beneath it and
   justified to exactly the title's width, so the two read as a single
   wordmark without needing an image. The width:0 / min-width:100% pair
   stops the subtitle from widening the block beyond the title. */
.site-brand {
    display: inline-flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-width: 0;
    text-decoration: none;
    color: var(--parchment);
}

.site-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--parchment);
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

.site-title span {
    color: var(--accent-light);
    font-style: italic;
}

.site-subtitle {
    width: 0;
    min-width: 100%;
    margin-top: 0.2rem;
    font-size: 0.62rem;
    line-height: 1.4;
    color: var(--accent-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: justify;
    text-align-last: justify;
}

/* Shrinks before it wraps: the box gives up width down to 200px so the
   brand and the search stay on one line until the phone breakpoint. */
.header-search {
    flex: 1 1 200px;
    min-width: 200px;
    max-width: 400px;
    margin-left: auto;
}

.header-search input {
    width: 100%;
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 2rem;
    color: var(--parchment);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.875rem;
}

.header-search input::placeholder { color: var(--accent-light); }
.header-search input:focus {
    outline: none;
    background: rgba(255,255,255,0.2);
    border-color: var(--accent-light);
}

/* ── Nav ── */
.site-nav {
    background: var(--ink);
    padding: 0;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

/* Labels never break mid-word; when the row runs out of width, whole items
   move to a second line instead. */
.nav-inner a {
    position: relative;
    white-space: nowrap;
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.6rem 1.2rem;
    transition: background 0.2s, color 0.2s;
}

/* Hovering shows the same rule as the current page, without the block. */
.nav-inner a:hover { color: var(--parchment); }

/* The current page is marked by a short rule under its label, in the
   same gold as "Identification Guide", on the header's brown. */
.nav-inner a.active {
    background: var(--accent);
    color: var(--parchment);
}

.nav-inner a:hover::before,
.nav-inner a.active::before {
    content: "";
    position: absolute;
    bottom: 0.3rem;
    left: 1.2rem;
    right: 1.2rem;
    height: 2px;
    background: var(--accent-light);
}
/* ── Main layout ── */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ── Seal record page ── */
.seal-page { display: grid; grid-template-columns: 1fr 340px; gap: 3rem; }
@media (max-width: 768px) { .seal-page { grid-template-columns: 1fr; } }

.seal-main {}

.seal-bsg-id {
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--warm-mid);
    margin-bottom: 0.5rem;
}

.seal-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.seal-summary {
    font-size: 0.95rem;
    color: var(--warm-mid);
    margin-bottom: 1.5rem;
    font-style: italic;
    border-left: 3px solid var(--accent-light);
    padding-left: 1rem;
}

.seal-description {
    font-size: 0.95rem;
    line-height: 1.8;
}

.seal-description p { margin-bottom: 1rem; }

.seal-description a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-light);
}

.seal-description a:hover { color: var(--seal-red); }

/* ── Sidebar ── */
.seal-sidebar {}

.seal-image-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.seal-image-container img {
    width: 100%;
    height: auto;
    display: block;
}

.seal-meta {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.seal-meta h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--warm-mid);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.meta-row {
    display: flex;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--parchment);
}

.meta-label {
    font-weight: 600;
    color: var(--warm-mid);
    min-width: 80px;
    flex-shrink: 0;
}

.meta-value { color: var(--ink); }

.category-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--parchment);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
}

/* ── Search results ── */
.search-results-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.search-results-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    color: var(--ink);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.result-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.result-card:hover {
    box-shadow: 0 4px 24px rgba(26,26,24,0.14);
    transform: translateY(-2px);
}

.result-card-image {
    aspect-ratio: 2/1;
    overflow: hidden;
    background: var(--parchment);
}

.result-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-card-body {
    padding: 1rem;
    flex: 1;
}

.result-bsg {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--warm-mid);
    margin-bottom: 0.25rem;
}

.result-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.result-date {
    font-size: 0.75rem;
    color: var(--warm-mid);
}

/* ── Category page ── */
.category-header {
    margin-bottom: 2rem;
}

.category-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.category-count {
    color: var(--warm-mid);
    font-size: 0.9rem;
}

/* ── Home page ── */
.home-hero {
    background: linear-gradient(135deg, var(--accent) 0%, #3d2010 100%);
    color: var(--parchment);
    padding: 4rem 2rem;
    text-align: center;
    margin: -2rem -2rem 3rem -2rem;
}

.home-hero h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.home-hero p {
    font-size: 1.1rem;
    color: var(--accent-light);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-search {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    gap: 0;
}

.hero-search input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--accent-light);
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
    font-family: 'Source Sans 3', sans-serif;
    background: rgba(255,255,255,0.1);
    color: var(--parchment);
}

.hero-search input::placeholder { color: var(--accent-light); }
.hero-search input:focus { outline: none; background: rgba(255,255,255,0.2); }

.hero-search button {
    padding: 0.875rem 1.5rem;
    background: var(--accent-light);
    color: var(--accent);
    border: 2px solid var(--accent-light);
    border-radius: 0 4px 4px 0;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    letter-spacing: 0.05em;
    transition: background 0.2s;
}

.hero-search button:hover { background: var(--parchment); }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: 0 4px 24px rgba(26,26,24,0.14); }

.stat-number {
    font-family: 'Cormorant Garamond', serif;
    font-size: 3rem;
    font-weight: 600;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--warm-mid);
}

.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--ink);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* The "About" text with the call-to-submit photograph beside it (the
   picture from BSG.II.00002). Side by side where there is room; on a
   phone the photograph drops below the text, smaller, rather than
   squeezing the words. */
.home-about {
    display: flex;
    align-items: flex-start;
    gap: 2.5rem;
    margin-bottom: 1.5rem;
}

.home-about-text { flex: 1 1 0; min-width: 0; }
.home-about-text p:last-child { margin-bottom: 0; }

.home-about-figure {
    flex: 0 0 auto;
    width: 240px;
    text-align: center;
}

.home-about-figure a { text-decoration: none; color: inherit; }
.home-about-figure a:hover figcaption { text-decoration: underline; }

.home-about-figure img {
    width: 100%;
    height: auto;
    display: block;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow);
}

.home-about-figure figcaption {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
}

@media (max-width: 768px) {
    .home-about        { flex-direction: column; gap: 1.5rem; }
    .home-about-figure { width: 180px; align-self: center; }
}

/* ── Pagefind UI customisation ── */
#search { max-width: 800px; }
.pagefind-ui__search-input {
    border-radius: 4px !important;
    border-color: var(--border) !important;
    font-family: 'Source Sans 3', sans-serif !important;
}

/* ── Footer ── */
.site-footer {
    background: var(--ink);
    color: var(--accent-light);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    font-size: 0.8rem;
    line-height: 1.8;
}

.site-footer a { color: var(--accent-light); }

/* ── Breadcrumb ── */
.breadcrumb {
    font-size: 0.8rem;
    color: var(--warm-mid);
    margin-bottom: 2rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.breadcrumb a { color: var(--warm-mid); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--border); }

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--ink);
    background: var(--white);
}

.pagination a:hover { background: var(--parchment); border-color: var(--accent); }
.pagination .current { background: var(--accent); color: var(--parchment); border-color: var(--accent); }

/* ── Utility ── */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
/* Image lightbox */
.seal-image-container img {
  cursor: zoom-in;
}

.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  cursor: zoom-out;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-overlay img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
.lightbox-hint {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--accent-light, #888);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border, #ddd);
}
/* ── Phones ──────────────────────────────────────────────────────────
   Added 2026-08-23 (T49). Seals are found in a field, so a phone on a
   poor signal is a primary way this site gets used, not an afterthought.

   Before this the page scrolled sideways on a phone. Three things caused
   it: the header's title and subtitle were flex-shrink:0 and wider than a
   390px screen between them; the search box had min-width:200px so it
   could not give way either; and the seven-item nav was a nowrap row
   roughly twice the width of the screen.

   The nav wraps rather than scrolling sideways, deliberately — every
   category stays visible instead of hiding off the edge, which matters
   more than tidiness when someone is standing in a field trying to
   identify a find.
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
    main                { padding: 1.25rem 1rem; }

    .header-inner       { padding: 0.6rem 1rem; gap: 0.4rem 1rem; }
    .site-brand         { max-width: 100%; }
    .site-title         { font-size: 1.15rem; }
    .site-subtitle      { font-size: 0.5rem; letter-spacing: 0.05em; }
    .header-search      { flex-basis: 100%; min-width: 0; max-width: none; width: 100%; margin-left: 0; }

    .nav-inner          { padding: 0 0.5rem; flex-wrap: wrap; justify-content: center; }
    .nav-inner a        { padding: 0.55rem 0.7rem; font-size: 0.72rem; letter-spacing: 0.05em; }
    .nav-inner a:hover::before,
    .nav-inner a.active::before { bottom: 0.25rem; left: 0.7rem; right: 0.7rem; }

    .stats-row          { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 2rem; }
    .stat-card          { padding: 1rem; }

    .seal-page          { gap: 1.5rem; }
}

/* Long unbroken strings — the archive.org and PAS citations in some
   descriptions run to 90 characters — will push a phone screen sideways
   on their own unless they are allowed to break. */
.seal-description,
.seal-summary,
.seal-description a { overflow-wrap: break-word; word-break: break-word; }

/* A last resort so nothing else can force sideways scrolling: no image or
   table may exceed the width of what contains it. */
img, table, pre { max-width: 100%; }

/* And a genuine backstop, added 2026-08-24 after the search page was found
   to scroll sideways on a phone. It matters more than it looks: a browser
   that has zoomed out to fit an over-wide page KEEPS that zoom for the whole
   site, so one bad page makes every page look wrong until a reload. Better
   to clip one runaway element than to distort the site. */
html, body { overflow-x: hidden; }

/* A supporting picture inside a description, written as
   [img=file.jpg]caption[/img] — see format_description(). Added 2026-09-08 for
   the 1928 advert that identifies BSG.OS.00035 and BSG.OS.00036.

   Capped rather than full width: it is evidence beside the prose, not the
   record's own photograph, and the seal itself should stay the largest thing
   on the page. Clicking opens it full size in the same lightbox. */
.seal-description .desc-figure {
    margin: 1.25rem 0;
    max-width: 420px;
}
.seal-description .desc-figure img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: zoom-in;
}
.seal-description .desc-figure figcaption {
    margin-top: 0.4rem;
    font-size: 0.82rem;
    font-style: italic;
    color: var(--warm);
}
