/* Mil-i-pede Tank Parts — modern static redesign, 2026 restoration.
   Layout and typography follow the 776FA tribute rebuild, with a
   steel-and-brass palette for a precision parts catalog. */
:root {
  --ink: #16181c;
  --ink-soft: #3a3d44;
  --muted: #5c6168;
  --paper: #f4f1ea;
  --paper-2: #eae6dc;
  --paper-3: #ddd6c8;
  --cream: #fbf9f4;
  --olive: #1b242c;
  --olive-2: #2a3540;
  --olive-3: #12181d;
  --brass: #b08a4a;
  --brass-2: #c9a56a;
  --rule: #b08a4a;
  --link: #24364a;
  --link-hover: #8b3a2a;
  --danger-soft: #8b3a2a;
  --focus: #1c4d8c;
  --shadow: 0 10px 30px rgba(18, 24, 29, 0.14);
  --serif: "Source Serif 4", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --measure: 68ch;
  --wide: 72rem;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, .nav-btn:focus-visible, .nav-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--olive-3);
  color: var(--cream);
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip:focus { top: 0.6rem; }

/* Header */
.site-header {
  background: var(--olive-3);
  color: var(--cream);
  border-bottom: 3px solid var(--brass);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  color: var(--cream);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.brand:hover { color: var(--brass-2); }
.brand-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-2);
  font-weight: 600;
}
.brand-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--brass);
  color: var(--cream);
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 3px;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  color: var(--brass-2);
  border-bottom-color: var(--brass-2);
}

@media (max-width: 860px) {
  .nav-btn { display: inline-block; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    background: var(--olive);
    border-bottom: 3px solid var(--brass);
    padding: 0.5rem 1.25rem 1rem;
  }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { display: block; padding: 0.7rem 0; border-bottom: 1px solid rgba(196,168,98,0.25); }
}

/* Main layout */
.main { flex: 1; }
.wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
}
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1rem; }
.prose h1, .prose h2, .prose h3,
.page-title, .hero-copy h1, .section-title {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--olive-3);
}
.kicker {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 700;
  margin: 0 0 0.4rem;
}
.lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); }
.gold-rule {
  display: block;
  width: 4.5rem;
  height: 3px;
  background: var(--brass);
  border: 0;
  margin: 0.9rem 0 1.3rem;
}

/* Hero */
.hero {
  background:
    linear-gradient(180deg, rgba(26,33,22,0.2), rgba(26,33,22,0.05)),
    var(--olive-3);
  color: var(--cream);
  padding: 0;
}
.hero-grid {
  max-width: var(--wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  align-items: stretch;
}
.hero-copy {
  padding: 2.75rem 1.5rem 2.75rem 1.5rem;
}
.hero-copy h1 {
  color: var(--cream);
  font-size: clamp(2rem, 4.2vw, 3.15rem);
  margin: 0 0 0.75rem;
}
.hero-copy .gold-rule { background: var(--brass-2); }
.hero-copy p { margin: 0 0 1rem; color: #ebe4d4; }
.hero-copy .lede { color: #f3ecdc; }
.hero-art {
  margin: 0;
  background: #111;
  min-height: 100%;
}
.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}
.hero-art figcaption {
  position: absolute;
  width: 1px; height: 1px; overflow: hidden;
}
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-height: 420px; }
  .hero-art img { max-height: 420px; object-fit: cover; }
  .hero-copy { padding: 2rem 1.25rem; }
}

/* Cards / collections */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.card {
  background: var(--cream);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: 0 1px 0 rgba(28,26,20,0.04);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}
a.card:hover {
  border-color: var(--brass);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}
.card h2, .card h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 0 0 0.45rem;
  color: var(--olive-3);
}
.card p { margin: 0; color: var(--ink-soft); flex: 1; }
.card .more {
  margin-top: 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--olive-2);
  letter-spacing: 0.02em;
}

/* Photo figures */
.photo {
  margin: 0 0 1.5rem;
  background: var(--cream);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  overflow: hidden;
}
.photo img { width: 100%; background: #1a1a16; }
/* Single formal portraits, not gallery tiles */
.photo.portrait {
  max-width: 22rem;
}
.photo.portrait img {
  display: block;
  height: auto;
}

.photo figcaption, .missing figcaption {
  padding: 0.8rem 1rem 1rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.photo figcaption strong, .missing figcaption strong {
  display: block;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}
.gallery .photo, .gallery .missing { margin: 0; height: 100%; display: flex; flex-direction: column; }
.gallery .photo img { aspect-ratio: 4/3; object-fit: contain; background: #222; }

.missing {
  margin: 0;
  background: var(--cream);
  border: 1px solid var(--paper-3);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.missing-frame {
  aspect-ratio: 4/3;
  background:
    repeating-linear-gradient(-45deg, #d9d0bb, #d9d0bb 10px, #e6deca 10px, #e6deca 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.missing-frame span {
  background: rgba(251,248,241,0.88);
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--paper-3);
}
.file-ref {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.note, .gap-note, .warn {
  background: var(--paper-2);
  border-left: 4px solid var(--brass);
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
  color: var(--ink-soft);
}
.warn { border-left-color: var(--danger-soft); }
.gap-note { border-left-color: #6a6248; }

/* People list */
.person-grid, .roster {
  width: 100%;
  border-collapse: collapse;
  background: var(--cream);
  font-size: 0.98rem;
}
.person-grid th, .person-grid td,
.roster th, .roster td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--paper-3);
  vertical-align: top;
}
.person-grid thead th, .roster thead th {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  background: var(--paper-2);
}
.person-grid tr:hover td, .roster tbody tr:hover td { background: #eee9df; }

.pill {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--paper-3);
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  color: var(--muted);
}

/* Memoirs */
.memoir {
  max-width: 42rem;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
}
.memoir h1 { font-size: 2rem; margin-bottom: 0.2rem; }
.memoir .byline { color: var(--muted); margin-bottom: 1.5rem; }
.memoir p { margin: 0 0 1.05rem; }
.memoir-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--paper-3);
  margin-top: 2.5rem;
  padding-top: 1rem;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.chapter-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.chapter-list li {
  border-bottom: 1px solid var(--paper-3);
  padding: 0.55rem 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.chapter-list .missing-ch { color: var(--muted); font-style: italic; }
.index-list {
  columns: 2;
  column-gap: 2rem;
  padding: 0;
  margin: 0.5rem 0 1.5rem;
  list-style: none;
}
@media (max-width: 560px) { .index-list { columns: 1; } }
.index-list li { break-inside: avoid; padding: 0.15rem 0; }

/* Insignia / figures on home */
.feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0 0;
  align-items: start;
}
@media (max-width: 800px) { .feature-row { grid-template-columns: 1fr; } }
.banner-art {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1rem;
}
.banner-art img { width: min(680px, 100%); background: transparent; }
.tank-row { display: flex; justify-content: center; margin: 1.5rem 0; }
.tank-row img { width: min(615px, 100%); }

/* Footer */
.site-footer {
  background: var(--olive-3);
  color: #d9d1be;
  padding: 2rem 1.25rem 2.4rem;
  margin-top: auto;
  border-top: 3px solid var(--brass);
  font-size: 0.92rem;
}
.footer-inner { max-width: var(--wide); margin: 0 auto; }
.site-footer a { color: var(--brass-2); }
.site-footer .tiny { margin-top: 0.8rem; color: #b5ad9a; font-size: 0.82rem; }

/* 404 */
.notfound { text-align: left; padding: 4rem 1.25rem; max-width: 40rem; margin: 0 auto; }

/* Print */
@media print {
  .site-header, .site-footer, .nav-btn, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
  .wrap { padding: 0; }
}

/* Utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.credits dt { font-weight: 700; margin-top: 0.8rem; }
.credits dd { margin: 0.15rem 0 0 0; }

/* Album subsection labels */
.album-leaf {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  font-weight: 700;
  margin: 1.75rem 0 0.35rem;
}

/* Click-to-enlarge photographs */
.photo-link {
  display: block;
  cursor: zoom-in;
  background: #1a1a16;
}
.photo-link:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
body.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 1.5rem;
  background: rgba(10, 14, 18, 0.94);
}
.lightbox.is-open { display: flex; }
.lightbox[hidden] { display: none !important; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}
.lightbox-close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  border: 0;
  background: transparent;
  color: var(--cream);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
}
.lightbox-close:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}
@media print {
  .lightbox { display: none !important; }
}

/* Album covers near the top of the Machado album page */
.cover-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
  margin: 1.25rem 0 2rem;
}
.cover-row .photo { margin: 0; }
.cover-row .cover-shield {
  flex: 1 1 18rem;
  max-width: 26rem;
}
.cover-row .cover-portrait {
  flex: 0 1 14rem;
  max-width: 16rem;
}
.cover-row .photo img,
.cover-row .photo-link img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  background: #1a1a16;
}
@media (max-width: 700px) {
  .cover-row .cover-shield,
  .cover-row .cover-portrait { max-width: 22rem; }
}

/* Parts catalog */
.parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.9rem;
  margin: 1.25rem 0 2rem;
  padding: 0;
  list-style: none;
}
.parts-grid a.card h2 { font-size: 1.15rem; letter-spacing: 0.02em; }
.parts-grid .part-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--brass);
  font-weight: 700;
  margin: 0 0 0.25rem;
}
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}
.subnav a[aria-current="page"] { font-weight: 700; }
.todo-note {
  background: var(--paper-2);
  border-left: 4px solid var(--danger-soft);
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
  color: var(--ink-soft);
}
.logo-hero {
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}
.logo-hero img {
  width: min(320px, 80%);
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}
.brand-lockup img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
}
.coming-soon-list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}
.coming-soon-list li {
  border-bottom: 1px solid var(--paper-3);
  padding: 0.55rem 0;
}
.coming-soon-list .muted { color: var(--muted); font-style: italic; }

.hero-art.logo-hero {
  background: var(--cream);
}
.logo-hero .photo-link,
.logo-hero .photo-link img {
  background: var(--cream);
}
.missing figcaption .file-ref {
  display: block;
  margin-top: 0.45rem;
}

.hero:has(.logo-hero) {
  background: linear-gradient(to right, var(--olive-3) 50%, var(--cream) 50%);
}
@media (max-width: 800px) {
  .hero:has(.logo-hero) {
    background: var(--olive-3);
  }
}
