/* historic-naturalbridge.com -- site styles. Edit here, then run Build-Site.ps1. */

:root {
  --paper: #f6f1e6;
  --paper-2: #ece4d2;
  --card: #fffdf8;
  --ink: #2a2622;
  --ink-soft: #5d554b;
  --green: #2f4a3a;
  --green-2: #3f6450;
  --gold: #b88a3b;
  --line: #d9cfba;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(42, 38, 34, .08), 0 4px 14px rgba(42, 38, 34, .08);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--green-2); }
a:hover { color: var(--green); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.wrap { width: min(1240px, 100% - 2rem); margin-inline: auto; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--green); color: #fff; padding: .5rem 1rem; z-index: 10;
}
.skip:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- masthead ---- */

.masthead {
  background: var(--green);
  color: #f4ecd8;
  border-bottom: 4px solid var(--gold);
}
.masthead-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1.5rem; padding-block: 1rem;
}
.brand { color: inherit; text-decoration: none; display: flex; flex-direction: column; }
.brand-title {
  font: 700 clamp(1.5rem, 1.1rem + 2vw, 2.3rem)/1.1 var(--serif);
  letter-spacing: .02em;
}
.brand-sub { font: italic 1rem/1.4 var(--serif); opacity: .85; }

.sitenav { display: flex; gap: .25rem; }
.sitenav a {
  color: #f4ecd8; text-decoration: none; padding: .45rem .9rem; border-radius: 999px;
  font-weight: 600; font-size: .95rem;
}
.sitenav a:hover { background: rgba(255, 255, 255, .12); }
.sitenav a[aria-current="page"] { background: #f4ecd8; color: var(--green); }

/* ---- intro ---- */

.intro { padding-block: 2rem 1rem; }
.intro h1 {
  font: 600 clamp(1.4rem, 1.1rem + 1.4vw, 2rem)/1.2 var(--serif);
  margin: 0 0 .5rem;
}
.intro p { max-width: 68ch; margin: 0; color: var(--ink-soft); }

/* ---- toolbar ---- */

.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem;
  padding-block: .75rem;
  background: linear-gradient(var(--paper) 80%, rgba(246, 241, 230, 0));
}
.search { flex: 1 1 280px; max-width: 520px; }
.search input {
  width: 100%; font: inherit; padding: .65rem 1rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--ink);
}
.search input:focus { border-color: var(--green-2); outline: none; box-shadow: 0 0 0 3px rgba(63, 100, 80, .25); }
.count { margin: 0; color: var(--ink-soft); font-size: .95rem; }

/* ---- grid ---- */

.gallery-wrap { padding-bottom: 3rem; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 45%), 1fr));
}
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.25rem; }
}

.card { margin: 0; }
.card[hidden] { display: none; }
.card > a {
  display: flex; flex-direction: column; height: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card > a:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(42, 38, 34, .1), 0 10px 24px rgba(42, 38, 34, .14); }

/* A "mat" around each photo so tall postcards and wide street scenes sit together evenly. */
.frame {
  aspect-ratio: 4 / 3; background: var(--paper-2); min-height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: .6rem;
}
.frame picture { display: contents; }
.frame img {
  width: auto; height: auto; max-width: 100%; max-height: 100%; min-height: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.card-title {
  padding: .6rem .8rem .75rem; font: 600 .95rem/1.35 var(--serif);
}

.pswp-caption-content { display: none; }

.empty { text-align: center; color: var(--ink-soft); padding: 2rem 0; }

/* ---- lightbox caption (PhotoSwipe custom element) ---- */

.pswp__custom-caption {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(760px, calc(100% - 32px));
  background: rgba(20, 18, 16, .78); color: #f4ecd8;
  padding: .7rem 1rem; border-radius: 8px;
  font: 1rem/1.45 var(--sans); text-align: center;
}
.pswp__custom-caption strong { display: block; font: 700 1.1rem/1.3 var(--serif); }
.pswp__custom-caption span { display: block; margin-top: .2rem; }
.pswp__custom-caption:empty { display: none; }
.pswp__counter { font-family: var(--sans); }

/* ---- about / prose ---- */

.prose { max-width: 760px; padding-block: 2rem 3rem; }
.prose h1 { font: 600 clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem)/1.2 var(--serif); margin: 0 0 1rem; }
.prose h2 { font: 600 1.4rem/1.3 var(--serif); margin: 2.5rem 0 .5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.portrait { float: right; margin: 0 0 1rem 1.5rem; width: min(220px, 40%); }
.portrait img { border-radius: var(--radius); box-shadow: var(--shadow); }
.portrait figcaption { font: italic .9rem/1.4 var(--serif); color: var(--ink-soft); text-align: center; margin-top: .4rem; }
@media (max-width: 520px) {
  .portrait { float: none; margin: 0 auto 1.5rem; width: 60%; }
}

/* ---- footer ---- */

.sitefoot { border-top: 1px solid var(--line); background: var(--paper-2); color: var(--ink-soft); font-size: .9rem; }
.sitefoot .wrap { padding-block: 1.25rem; }
.sitefoot p { margin: .2rem 0; }

@media (prefers-reduced-motion: reduce) {
  .card > a { transition: none; }
  .card > a:hover { transform: none; }
}
