:root {
  --navy: #163a7a;
  --navy-deep: #0e2758;
  --navy-mid: #1f4a96;
  --crimson: #c0172b;
  --paper: #f3f1ec;
  --paper-2: #e8e4da;
  --ink: #2a2a2a;
  --muted: #5c5a55;
  --line: #d4cfc4;
  --card: #fffcf7;
  --shadow-frame: 0 24px 64px rgb(18 24 38 / 0.38), 0 2px 8px rgb(18 24 38 / 0.18);
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Figtree", "Segoe UI", system-ui, sans-serif;
  --radius: 12px;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100dvh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-wrap: balance;
  margin: 0;
}

p { text-wrap: pretty; }

a { color: var(--navy); }
a:hover { color: var(--crimson); }

button, [role="button"] { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.5; }

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

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hero {
  position: relative;
  height: 11rem;
  overflow: hidden;
}
@media (min-width: 640px) { .hero { height: 14rem; } }
@media (min-width: 768px) { .hero { height: 16rem; } }

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(14 39 88 / 0.55), rgb(14 39 88 / 0.1), transparent);
}

.hero-copy {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  color: var(--paper);
}
@media (min-width: 640px) { .hero-copy { left: 2rem; } }

.hero-copy h1 {
  font-size: 1.875rem;
  font-weight: 600;
}
@media (min-width: 640px) { .hero-copy h1 { font-size: 2.25rem; } }

.hero-copy p {
  margin: 0.25rem 0 0;
  max-width: 36rem;
  font-size: 0.875rem;
  color: rgb(243 241 236 / 0.85);
}

.nav {
  position: relative;
  background: var(--navy);
  color: var(--paper);
}

.nav-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
}
@media (min-width: 640px) { .nav-inner { padding: 0 1.5rem; } }

.nav-toggle {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  color: inherit;
}
@media (min-width: 768px) { .nav-toggle { display: none; } }

.nav-links {
  display: none;
  flex-direction: column;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  background: var(--navy);
  border-top: 1px solid rgb(243 241 236 / 0.15);
}
.nav-links.open { display: flex; }
@media (min-width: 768px) {
  .nav-links {
    display: flex;
    position: static;
    flex: 1;
    flex-direction: row;
    border: 0;
  }
}

.nav-links a {
  min-height: 3.25rem;
  padding: 0.75rem 1.15rem;
  text-align: center;
  color: var(--paper);
  text-decoration: none;
  font-size: 22.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.nav-links a:hover {
  background: var(--paper);
  color: var(--navy);
}
.nav-links a.active {
  background: var(--crimson);
  color: var(--paper);
}
.nav-links a.active:hover {
  background: var(--crimson);
  color: var(--paper);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}
@media (min-width: 640px) {
  .main { padding: 2.5rem 1.5rem; }
}

.footer {
  margin-top: 2rem;
  border-top: 2px double rgb(22 58 122 / 0.3);
  background: rgb(232 228 218 / 0.6);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.875rem; }
.page-head p {
  margin: 0.25rem 0 0;
  max-width: 42rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.home-grid {
  display: grid;
  gap: 2.5rem;
}
@media (min-width: 768px) {
  .home-grid {
    grid-template-columns: minmax(0, 1.8fr) minmax(16rem, 0.7fr);
    align-items: start;
  }
}

.house-btn {
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  padding: 0;
  text-align: left;
  box-shadow: var(--shadow-frame);
}
.house-btn img {
  width: 100%;
  min-height: 22rem;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}
.house-btn:hover img { transform: scale(1.02); }

.jump-list { display: grid; gap: 0.5rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.jump-list a {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  text-decoration: none;
  color: inherit;
}
.jump-list a:hover { border-color: rgb(22 58 122 / 0.4); }
.jump-list strong { display: block; }
.jump-list span { display: block; font-size: 0.875rem; color: var(--muted); }

.grid-thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) { .grid-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) { .grid-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.thumb {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  text-align: left;
  padding: 0;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.thumb:hover {
  transform: translateY(-2px);
  border-color: rgb(22 58 122 / 0.4);
  box-shadow: 0 10px 24px rgb(18 24 38 / 0.08);
}
.thumb .frame {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-2);
}
.thumb .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.thumb:hover .frame img { transform: scale(1.04); }
.thumb.thumb-flash {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.catalog-layout {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 900px) {
  .catalog-layout {
    grid-template-columns: 15.5rem minmax(0, 1fr);
    align-items: start;
  }
}

.name-index {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 0.65rem 0.5rem;
  max-height: 12rem;
  overflow: auto;
}
@media (min-width: 900px) {
  .name-index {
    position: sticky;
    top: 0.75rem;
    max-height: calc(100dvh - 1.5rem);
  }
}
.name-index p {
  margin: 0 0.5rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.name-index a {
  display: block;
  padding: 0.3rem 0.5rem;
  color: var(--ink);
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.8125rem;
  line-height: 1.3;
}
.name-index a:hover,
.name-index a:focus {
  background: var(--paper-2);
  color: var(--navy);
}
.thumb .meta { padding: 0.75rem; }
.thumb .meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
}
.thumb .meta small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.search {
  position: relative;
  margin-bottom: 1.5rem;
}
.search input {
  width: 100%;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  padding: 0 0.75rem 0 2.5rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
}
.search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1rem;
  height: 1rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.bm-layout {
  display: grid;
  gap: 2rem;
}
@media (min-width: 1024px) {
  .bm-layout { grid-template-columns: 13rem minmax(0, 1fr); }
}

.bm-nav {
  display: none;
  position: sticky;
  top: 1rem;
  max-height: 70dvh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  padding: 0.75rem;
  font-size: 0.875rem;
}
@media (min-width: 1024px) { .bm-nav { display: block; } }
.bm-nav a {
  display: block;
  padding: 0.35rem 0.5rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
}
.bm-nav a:hover { background: var(--paper-2); color: var(--navy); }

.bm-cols {
  columns: 1;
  gap: 2rem;
}
@media (min-width: 640px) { .bm-cols { columns: 2; } }

.bm-group {
  break-inside: avoid;
  margin-bottom: 2rem;
}
.bm-group h2 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25rem;
  font-size: 1.25rem;
  color: var(--navy);
}
.bm-group h3 {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.875rem;
  color: var(--crimson);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0;
}
.bm-group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.25rem; }
.bm-group a { text-underline-offset: 2px; }
.bm-group a:hover { text-decoration: underline; }

.editor {
  margin-bottom: 2rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  padding: 1.25rem;
}
.editor h2 { font-size: 1.25rem; }
.editor p { margin: 0.25rem 0 1rem; font-size: 0.875rem; color: var(--muted); }
.form-grid {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-grid label { display: grid; gap: 0.35rem; font-size: 0.875rem; font-weight: 500; }
.form-grid input {
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
  padding: 0 0.75rem;
  font: inherit;
  font-size: 0.875rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 4px;
  background: var(--navy);
  color: var(--paper);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
}
.btn:hover { background: var(--navy-mid); }
.btn.secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(42 42 42 / 0.78);
  padding: 0.75rem;
}
@media (min-width: 640px) { .overlay { padding: 1.5rem; } }

.overlay .close,
.overlay .arrow {
  position: absolute;
  z-index: 20;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: rgb(42 42 42 / 0.55);
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.overlay .close { top: 0.75rem; right: 0.75rem; }
.overlay .arrow { top: 50%; transform: translateY(-50%); }
.overlay .arrow.prev { left: 0.5rem; }
.overlay .arrow.next { right: 0.5rem; }
@media (max-width: 639px) {
  .overlay .arrow { display: none; }
}

.frame-box {
  overflow: hidden;
  border-radius: 8px;
  background: #111;
  box-shadow: var(--shadow-frame);
  display: flex;
  align-items: center;
  justify-content: center;
}
.frame-box img, .frame-box video {
  display: block;
  max-width: 96vw;
  max-height: 90dvh;
  object-fit: contain;
  background: #111;
}
.caption {
  margin-top: 0.75rem;
  text-align: center;
  color: var(--paper);
}
.caption .count {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: rgb(243 241 236 / 0.7);
}
.caption .title {
  margin-top: 0.25rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
}
.mobile-arrows {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
@media (min-width: 640px) { .mobile-arrows { display: none; } }
.mobile-arrows button {
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: rgb(243 241 236 / 0.15);
  color: var(--paper);
}

.iframe-shell {
  display: flex;
  flex-direction: column;
  width: min(94vw, 1280px);
  height: min(82dvh, 820px);
  overflow: hidden;
  border-radius: 8px;
  background: #111;
  box-shadow: var(--shadow-frame);
}
.iframe-shell iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: #111;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

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

.bm-group li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
}
.bm-actions { display: inline-flex; gap: 0.35rem; }
.bm-actions button {
  border: 0;
  background: none;
  color: var(--navy);
  font: inherit;
  font-size: 0.75rem;
  padding: 0;
}
.bm-actions button:hover { color: var(--crimson); }
