/* Sailing the Black Flag: The Archives - founding design system
   Palette per 10_Design_System: Night #0A0A09, Paper #F1EADC, Gold #B79A57 */

:root {
  --night: #0a0a09;
  --night-soft: #171512;
  --paper: #f1eadc;
  --paper-dim: #e4dac6;
  --gold: #b79a57;
  --gold-deep: #8a7240;
  --ink: #26211a;
  --ink-soft: #4a4234;
  --line: #cdbfa4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  font-size: 1.0625rem;
}

/* Accessibility fundamentals */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--night);
  color: var(--paper);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Header */
.site-header {
  background: var(--night);
  color: var(--paper);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 2rem;
}
.site-mark { margin: 0; font-size: 1.2rem; letter-spacing: 0.04em; }
.site-mark a { color: var(--gold); text-decoration: none; }
.site-mark a:hover { color: var(--paper); }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
.site-nav a {
  color: var(--paper);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--gold); }
.nav-toggle {
  font-family: var(--sans);
  background: none;
  border: 1px solid var(--gold-deep);
  color: var(--paper);
  padding: 0.4rem 0.9rem;
}

/* Main column */
main {
  max-width: 44rem; /* roughly 65-75 characters of body serif */
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; color: var(--ink); }
h1 { font-size: 2.1rem; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.4rem; margin-top: 2.25rem; }
h3 { font-size: 1.15rem; }

a { color: var(--gold-deep); }
a:hover { color: var(--ink); }

.kicker {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}
.kicker a { color: inherit; }

.page-header { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.aliases, .entity-dates { color: var(--ink-soft); font-size: 0.95rem; }
.entity-dates span { margin-right: 1.25rem; }

/* Notices and badges */
.draft-notice {
  font-family: var(--sans);
  font-size: 0.85rem;
  background: var(--paper-dim);
  border-left: 3px solid var(--gold);
  padding: 0.6rem 0.9rem;
  color: var(--ink-soft);
}

.confidence {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--gold-deep);
  color: var(--gold-deep);
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  white-space: nowrap;
}
.confidence--confirmed { border-color: var(--ink-soft); color: var(--ink-soft); }

.reconstruction-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-top: 0.35rem;
}

/* Figures */
figure { margin: 2rem 0; }
figure svg, figure img { max-width: 100%; height: auto; display: block; }
figcaption { font-size: 0.92rem; color: var(--ink-soft); margin-top: 0.5rem; }

/* Cards */
.entity-cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.entity-card a {
  display: block;
  border: 1px solid var(--line);
  background: #f7f2e7;
  padding: 0.9rem 1rem;
  text-decoration: none;
  color: var(--ink);
  height: 100%;
}
.entity-card a:hover { border-color: var(--gold-deep); }
.entity-card__type { font-family: var(--sans); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold-deep); display: block; }
.entity-card__name { font-size: 1.05rem; display: block; margin: 0.15rem 0; }
.entity-card__summary { font-size: 0.9rem; color: var(--ink-soft); display: block; }

/* Rooms */
.room-progress { display: flex; gap: 0.4rem; margin: 0.75rem 0 0; }
.progress-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 1px solid var(--gold-deep); display: inline-block; }
.progress-dot--done { background: var(--gold); border-color: var(--gold); }
.progress-dot--current { background: var(--ink); border-color: var(--ink); }

.room-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 1.25rem; font-family: var(--sans); font-size: 0.9rem; }
.room-nav a { text-decoration: none; }
.room-nav__next { text-align: right; }

.return-path { margin-top: 3rem; font-family: var(--sans); font-size: 0.9rem; }

/* Rooms map on collection entrance */
.room-map { list-style: none; counter-reset: room; padding: 0; margin: 1.5rem 0; }
.room-map li { counter-increment: room; border-bottom: 1px solid var(--line); }
.room-map a {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.85rem 0.25rem;
  text-decoration: none;
  color: var(--ink);
}
.room-map a::before {
  content: counter(room, decimal-leading-zero);
  font-family: var(--sans);
  color: var(--gold-deep);
  font-size: 0.85rem;
  min-width: 2rem;
}
.room-map a:hover .room-title { color: var(--gold-deep); }
.room-title { font-size: 1.1rem; }
.room-purpose { color: var(--ink-soft); font-size: 0.92rem; }

/* Evidence */
.claim-list { list-style: none; padding: 0; }
.claim-list li { border-left: 2px solid var(--line); padding: 0.4rem 0 0.4rem 1rem; margin-bottom: 0.75rem; }
.claim-text { display: block; }
.claim-source { display: block; font-size: 0.85rem; color: var(--ink-soft); font-family: var(--sans); }
.evidence-note { font-size: 0.9rem; color: var(--ink-soft); }

.relationship-list { list-style: none; padding: 0; }
.relationship-list li { padding: 0.3rem 0; border-bottom: 1px dotted var(--line); }
.relationship-list em { color: var(--ink-soft); font-style: italic; }

/* Home */
.hero { background: var(--night); color: var(--paper); margin: -2.5rem -1.25rem 2.5rem; padding: 3.5rem 1.25rem; }
.hero-inner { max-width: 44rem; margin: 0 auto; }
.hero h1 { color: var(--paper); font-size: 2.4rem; margin: 0 0 0.75rem; }
.hero p { color: var(--paper-dim); max-width: 34rem; }
.hero .kicker { color: var(--gold); }
.cta {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  background: var(--gold);
  color: var(--night);
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  margin-top: 1rem;
}
.cta:hover { background: var(--paper); color: var(--night); }

/* Search */
.search-form input[type="search"] {
  font-family: var(--serif);
  font-size: 1.05rem;
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--gold-deep);
  background: #fbf7ee;
  color: var(--ink);
}
.search-results { list-style: none; padding: 0; }
.index-list { list-style: none; padding: 0; }
.index-list li { padding: 0.45rem 0; border-bottom: 1px dotted var(--line); }
.index-list .type-tag { font-family: var(--sans); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold-deep); margin-right: 0.6rem; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--sans); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }

/* Footer */
.site-footer {
  background: var(--night);
  color: var(--paper-dim);
  padding: 2rem 1.25rem 2.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
}
.site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; padding: 0; }
.site-footer a { color: var(--gold); text-decoration: none; }
.site-footer a:hover { color: var(--paper); }
.footer-note { color: #8f887b; max-width: 34rem; }

/* Mobile */
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 1.9rem; }
  /* Without JavaScript the full menu simply wraps; nav.js reveals the toggle
     and collapses the list on small screens. */
  .js .nav-toggle { display: inline-block; }
  .js #site-menu.is-collapsed { display: none; }
  .room-nav { flex-direction: column; }
  .room-nav__next { text-align: left; }
}

/* Curator layer */
.byline { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-soft); margin: 0.25rem 0 0; }
.byline a { color: var(--gold-deep); text-decoration: none; }
.byline a:hover { text-decoration: underline; }

.curator-note {
  border: 1px solid var(--line);
  background: #f7f2e7;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.curator-note__label {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 0.5rem;
}
.curator-note p { margin: 0.4rem 0; }
.curator-note__sig { font-style: italic; }
.curator-note__sig a { color: var(--ink-soft); }

/* Gallery exhibits (EDR-0034/0035): the object first, the label beside it */
.exhibit { margin: 2.25rem 0; }
.exhibit__frame {
  background: var(--night);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
}
.exhibit__frame img {
  max-width: 100%;
  max-height: 42rem;
  width: auto;
  height: auto;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.exhibit__label {
  border: 1px solid var(--line);
  border-top: none;
  background: #f7f2e7;
  padding: 0.9rem 1.1rem;
  font-size: 0.92rem;
}
.exhibit__label-title { font-weight: bold; display: block; }
.exhibit__label-meta {
  display: block;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}
.exhibit__label .confidence { float: right; margin-top: 0.15rem; }

.transcription {
  border-left: 2px solid var(--gold);
  background: #fbf7ee;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
}
.transcription p { margin: 0.4rem 0; }
.transcription footer { font-size: 0.88rem; color: var(--ink-soft); font-family: var(--sans); margin-top: 0.5rem; }

.gallery-route { font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }

/* Examine viewer (deep zoom overlay; exhibit.js) */
.exhibit__frame--interactive { position: relative; }
.exhibit__frame--interactive img { cursor: zoom-in; }
.examine-hint {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(10, 10, 9, 0.7);
  color: var(--gold);
  border: 1px solid var(--gold-deep);
  padding: 0.35rem 0.8rem;
  cursor: zoom-in;
}
.examine-hint:hover { color: var(--paper); border-color: var(--gold); }

.examine-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 10, 9, 0.97);
  display: flex;
  flex-direction: column;
}
.examine-overlay__stage { flex: 1; min-height: 0; }
.examine-overlay__stage--plain { overflow: auto; text-align: center; }
.examine-overlay__stage--plain img { max-width: none; }
.examine-overlay__close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  z-index: 51;
  font-size: 1.6rem;
  line-height: 1;
  background: none;
  border: 1px solid var(--gold-deep);
  color: var(--paper);
  padding: 0.25rem 0.65rem;
  cursor: pointer;
}
.examine-overlay__close:hover { color: var(--gold); border-color: var(--gold); }
.examine-overlay__label {
  margin: 0;
  padding: 0.6rem 3.5rem 0.7rem 1rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--paper-dim);
  text-align: center;
}

/* Gallery walk (scroll reveal; disabled without JS or with reduced motion) */
.walk-enabled .walk {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}
.walk-enabled .walk-in { opacity: 1; transform: none; }

/* Soft transitions between galleries (supported browsers only) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: 0.22s; }
::view-transition-new(root) { animation-duration: 0.22s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}


/* Footer signup (every gallery; same Kit endpoint as the landing band) */
.footer-signup { border-bottom: 1px solid #2a2620; padding-bottom: 1.5rem; margin-bottom: 1.5rem; }
.footer-signup__label {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.6rem;
}
.footer-signup__form { display: flex; gap: 0.5rem; flex-wrap: wrap; max-width: 30rem; }
.footer-signup__form input[type="email"] {
  flex: 1 1 220px;
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--gold-deep);
  background: #14120f;
  color: var(--paper);
}
.footer-signup__form button {
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  background: var(--gold);
  color: var(--night);
  border: none;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
}
.footer-signup__form button:hover { background: var(--paper); }
.footer-signup__fine { font-size: 0.72rem; color: #8f887b; margin-top: 0.5rem; }

/* Three-act arc note on collection entrances */
.arc-note { font-style: italic; color: var(--ink-soft); margin: 1.25rem 0 0.5rem; }


/* Kit newsletter embed in the dark site footer */
.footer-signup .formkit-form { background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; }
.footer-signup .formkit-header, .footer-signup .formkit-subheader, .footer-signup .formkit-guarantee, .footer-signup .formkit-powered-by-convertkit, .footer-signup .formkit-powered-by-convertkit-container { display: none !important; }
.footer-signup .formkit-fields { display: flex; gap: 0.5rem; flex-wrap: wrap; max-width: 30rem; margin: 0 !important; }
.footer-signup .formkit-field { flex: 1 1 220px; margin: 0 !important; }
.footer-signup .formkit-input { width: 100% !important; font-family: var(--sans) !important; font-size: 0.9rem !important; padding: 0.55rem 0.8rem !important; border: 1px solid var(--gold-deep) !important; background: #14120f !important; color: var(--paper) !important; border-radius: 0 !important; }
.footer-signup .formkit-submit { font-family: var(--sans) !important; font-size: 0.85rem !important; background: var(--gold) !important; color: var(--night) !important; border: 0 !important; border-radius: 0 !important; padding: 0.55rem 1.2rem !important; }
.footer-signup .formkit-submit:hover { background: var(--paper) !important; }
.footer-signup .formkit-submit > span { color: var(--night) !important; }
