/* ==========================================================================
   Halshayne Manor Farm — halshayne.com
   Hand-written static CSS. No build step, no external requests.
   ========================================================================== */

:root {
  --paper:      #faf8f3;
  --paper-2:    #f1ece1;
  --paper-3:    #e7e0d1;
  --ink:        #22201c;
  --ink-2:      #57514a;
  --ink-3:      #7d766c;
  --rule:       #ded6c6;
  --accent:     #4b5f3e;
  --accent-ink: #3c4d32;
  --brass:      #8a6a3b;

  --measure: 34rem;
  --wide: 78rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           "Hoefler Text", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --shadow: 0 1px 2px rgba(34,32,28,.05), 0 8px 28px rgba(34,32,28,.07);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #16150f;
    --paper-2:    #1e1c16;
    --paper-3:    #2a2720;
    --ink:        #ece6da;
    --ink-2:      #b3aca0;
    --ink-3:      #8e877c;
    --rule:       #34302a;
    --accent:     #9db98c;
    --accent-ink: #b6cba8;
    --brass:      #c9a76b;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.45);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, .96rem + .2vw, 1.075rem);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--paper); color: var(--ink); padding: .75rem 1rem;
  border: 1px solid var(--rule);
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- typography ------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.008em;
  margin: 0 0 .6em;
  color: var(--ink);
}
h1 { font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.35rem); margin-top: 0; }
h3 { font-size: clamp(1.2rem, 1.1rem + .5vw, 1.45rem); }
p  { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

.lede {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 1.05rem + .7vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink-2);
}

.eyebrow {
  font-family: var(--sans);
  font-size: .75rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1rem;
}

.small { font-size: .875rem; color: var(--ink-2); }
.note {
  font-size: .875rem; color: var(--ink-2);
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
  margin: 2rem 0;
}

/* ---------- layout ----------------------------------------------------- */

.wrap { max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.prose { max-width: var(--measure); }
.prose-wide { max-width: 46rem; }

section { padding-block: clamp(3rem, 7vw, 6rem); }
section + section { padding-top: 0; }

.rule { border: 0; border-top: 1px solid var(--rule); margin-block: clamp(2.5rem, 6vw, 4.5rem); }

/* two-column: text beside image */
.split {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: center;
}
@media (min-width: 56rem) {
  .split { grid-template-columns: 1fr 1fr; }
  .split.text-right > :first-child { order: 2; }
}

/* ---------- header ----------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  -webkit-backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4.25rem;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.1;
}
.wordmark span {
  display: block;
  font-family: var(--sans);
  font-size: .625rem;
  letter-spacing: .18em;
  color: var(--ink-3);
  margin-top: .18rem;
}

.nav-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  background: none; border: 1px solid var(--rule); border-radius: 3px;
  color: var(--ink); font: inherit; font-size: .8rem;
  padding: .45rem .7rem; cursor: pointer;
}
.nav-toggle:hover { border-color: var(--ink-3); }

nav.site-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: clamp(.9rem, 1.6vw, 1.6rem);
}
nav.site-nav a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: .875rem;
  padding-block: .2rem;
  border-bottom: 1px solid transparent;
}
nav.site-nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }
nav.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brass); }

@media (max-width: 74.99rem) {
  nav.site-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 1rem var(--gutter) 1.5rem;
  }
  nav.site-nav.open { display: block; }
  nav.site-nav ul { flex-direction: column; gap: .1rem; }
  nav.site-nav a { display: block; padding: .6rem 0; border-bottom: 1px solid var(--rule); }
}
@media (min-width: 75rem) {
  .nav-toggle { display: none; }
}

/* ---------- hero ------------------------------------------------------- */

.hero { position: relative; background: var(--paper-3); }
.hero img {
  width: 100%;
  height: clamp(20rem, 62vh, 40rem);
  object-fit: cover;
}
.hero.tall img { height: clamp(24rem, 80vh, 48rem); }
.hero-caption {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: clamp(2rem, 6vw, 4rem) var(--gutter);
  background: linear-gradient(to top,
    rgba(18,16,12,.88) 0%,
    rgba(18,16,12,.62) 32%,
    rgba(18,16,12,.24) 68%,
    transparent 100%);
  color: #fff;
}
.hero-caption .inner { max-width: var(--wide); margin-inline: auto; }
.hero-caption h1 {
  color: #fff; margin-bottom: .3rem;
  text-shadow: 0 2px 24px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.35);
}
.hero-caption p {
  color: rgba(255,255,255,.94); margin: 0;
  font-family: var(--sans); font-size: .8rem;
  letter-spacing: .16em; text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0,0,0,.6);
}

/* page intro block under a hero */
.intro { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

/* ---------- figures & galleries ---------------------------------------- */

figure { margin: 0; }
figure img { border-radius: 2px; background: var(--paper-3); }
figcaption {
  font-size: .8125rem; color: var(--ink-3);
  margin-top: .6rem; line-height: 1.5;
}

.grid {
  display: grid;
  gap: clamp(.75rem, 1.6vw, 1.25rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); }

.grid figure img,
.tile img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.grid figure.portrait img { aspect-ratio: 3 / 4; }

/* clickable image that opens the lightbox */
.zoom { display: block; cursor: zoom-in; border: 0; padding: 0; background: none; width: 100%; }
.zoom img { transition: opacity .25s ease; }
.zoom:hover img { opacity: .88; }

/* ---------- facts / data ----------------------------------------------- */

.facts {
  display: grid; gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
}
.facts div { background: var(--paper); padding: 1.1rem 1.25rem; }
.facts dt {
  font-size: .7rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: .3rem;
}
.facts dd {
  margin: 0; font-family: var(--serif); font-size: 1.25rem; line-height: 1.25;
}
.facts dd small { display: block; font-family: var(--sans); font-size: .78rem; color: var(--ink-2); margin-top: .2rem; }

table.spec {
  width: 100%; border-collapse: collapse; font-size: .9375rem;
  margin: 1.5rem 0;
}
table.spec th, table.spec td {
  text-align: left; vertical-align: top;
  padding: .7rem .9rem .7rem 0;
  border-bottom: 1px solid var(--rule);
}
table.spec th {
  font-weight: 600; color: var(--ink-2);
  width: 40%; padding-right: 1.5rem;
}
.scroll-x { overflow-x: auto; }

/* ---------- timeline ---------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  display: grid; gap: .25rem 1.75rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
}
.timeline > li:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 42rem) {
  .timeline > li { grid-template-columns: 8rem 1fr; }
}
.timeline .when {
  font-family: var(--serif); font-size: 1.15rem; color: var(--brass);
  line-height: 1.3;
}
.timeline .what h3 { margin-bottom: .3rem; }
.timeline .what p { margin-bottom: 0; color: var(--ink-2); }

/* ---------- callout cards ---------------------------------------------- */

.cards { display: grid; gap: clamp(1rem, 2.5vw, 1.75rem); }
@media (min-width: 48rem) { .cards.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 48rem) { .cards.two { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.card img { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; }
.card .body { padding: 1.25rem 1.35rem 1.5rem; flex: 1; }
.card h3 { margin-bottom: .4rem; }
.card p { color: var(--ink-2); font-size: .9375rem; margin-bottom: 0; }
a.card { text-decoration: none; color: inherit; transition: border-color .2s ease, transform .2s ease; }
a.card:hover { border-color: var(--ink-3); }
a.card .more {
  display: inline-block; margin-top: .9rem;
  font-size: .8125rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink);
}

/* ---------- document list ---------------------------------------------- */

.docs { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.docs li { border-top: 1px solid var(--rule); }
.docs li:last-child { border-bottom: 1px solid var(--rule); }
.docs a {
  display: flex; align-items: baseline; gap: .9rem;
  padding: .95rem 0; text-decoration: none; color: var(--ink);
}
.docs a:hover .name { text-decoration: underline; }
.docs .name { flex: 1; }
.docs .meta { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- footer ------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding-block: clamp(2.5rem, 5vw, 4rem);
  margin-top: clamp(3rem, 7vw, 6rem);
  font-size: .875rem;
  color: var(--ink-2);
}
.site-footer .cols {
  display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}
.site-footer h4 {
  font-family: var(--sans); font-size: .7rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: .8rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .4rem; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.colophon {
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: .8125rem; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
}

/* ---------- lightbox ---------------------------------------------------- */

dialog.lightbox {
  padding: 0; border: 0; background: transparent;
  max-width: 100vw; max-height: 100vh; width: 100%; height: 100%;
}
dialog.lightbox::backdrop { background: rgba(16,15,12,.93); }
dialog.lightbox .frame {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%; padding: clamp(1rem, 4vw, 3rem); gap: 1rem;
}
dialog.lightbox img {
  max-width: 100%; max-height: calc(100vh - 8rem);
  width: auto; object-fit: contain; border-radius: 2px;
}
dialog.lightbox .cap { color: rgba(255,255,255,.75); font-size: .875rem; text-align: center; max-width: 44rem; }
dialog.lightbox .close {
  position: absolute; top: 1rem; right: 1rem;
  background: rgba(255,255,255,.1); color: #fff;
  border: 1px solid rgba(255,255,255,.25); border-radius: 3px;
  font: inherit; font-size: .8rem; padding: .5rem .8rem; cursor: pointer;
}
dialog.lightbox .close:hover { background: rgba(255,255,255,.2); }

/* ---------- print ------------------------------------------------------- */

@media print {
  .site-header, .site-footer, .nav-toggle, dialog { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .hero img { height: 8cm; }
  a { text-decoration: none; color: #000; }
}

/* ---------- papers: PDF pages rendered as readable sheets ---------------- */

.paper { margin-bottom: clamp(2.5rem, 6vw, 4rem); }

.paper-head {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: .5rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .8rem; margin-bottom: 1.4rem;
}
.paper-head h3 { margin: 0; }
.paper-head .meta {
  font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); white-space: nowrap;
}
.paper > p { max-width: var(--measure); color: var(--ink-2); font-size: .9375rem; }

.pages {
  display: flex; flex-wrap: wrap;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  margin-top: 1.4rem;
}
.pages figure { width: min(100%, 17rem); }
.pages .zoom img {
  width: 100%; height: auto;
  background: #fff;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  border-radius: 1px;
}
.pages figcaption { margin-top: .5rem; }

.paper .source {
  display: inline-block; margin-top: 1.25rem;
  font-size: .8125rem; letter-spacing: .08em; text-transform: uppercase;
}

/* Document pages open large and scrollable rather than fitted to the viewport,
   so a typed sheet or an Ordnance Survey map can actually be read. */
dialog.lightbox.doc .frame {
  justify-content: flex-start;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
dialog.lightbox.doc img {
  max-height: none;
  width: min(94vw, 62rem);
  background: #fff;
}
dialog.lightbox.doc .cap { position: sticky; bottom: 0; padding-block: .5rem; }

/* Album pages are scans of prints in mixed orientations. Laying them out as a
   contact sheet — uniform tiles, each page contained on white — keeps the grid
   tidy without cropping anything. */
.pages.contact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
  gap: clamp(.75rem, 2vw, 1.25rem);
}
.pages.contact figure { width: auto; }
.pages.contact .zoom img {
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #fff;
  padding: .35rem;
}

/* ---------- film ------------------------------------------------------- */

.film { max-width: 46rem; }
.film video {
  width: 100%;
  height: auto;              /* beat the presentational height attribute */
  aspect-ratio: 16 / 9;
  display: block;
  background: #000;
  border-radius: 2px;
}
