:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6874;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #d8d6cf;
  --accent: #2f6f8f;
  --accent-dark: #214f65;
  --gold: #a5762a;
  --soft: #eef3f4;
  --header-bg: rgba(251, 250, 247, 0.96);
  --shadow: rgba(23, 32, 42, 0.12);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4f7;
  --muted: #aab8c0;
  --paper: #10171b;
  --panel: #172126;
  --line: #314149;
  --accent: #6fb3ce;
  --accent-dark: #9fd2e4;
  --gold: #e1b866;
  --soft: #1f2b31;
  --header-bg: rgba(16, 23, 27, 0.96);
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
}

a {
  color: var(--accent-dark);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 48px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: grid;
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
}

.brand-call {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-name {
  color: var(--muted);
  font-size: 0.88rem;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  font-weight: 650;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: var(--soft);
  color: var(--accent-dark);
}

:root[data-theme="dark"] .brand {
  color: #ffffff;
}

:root[data-theme="dark"] .brand-name {
  color: #c5d0d6;
}

:root[data-theme="dark"] .site-nav a {
  color: #f4f8fa !important;
}

:root[data-theme="dark"] .site-nav a:hover,
:root[data-theme="dark"] .site-nav a:focus-visible {
  background: #26363d;
  color: #ffffff !important;
}

.nav-toggle {
  display: none;
}

.hero {
  min-height: 72vh;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  align-items: end;
  gap: clamp(24px, 5vw, 64px);
  padding: clamp(64px, 10vw, 120px) clamp(18px, 5vw, 64px) 56px;
  background:
    linear-gradient(110deg, rgba(23, 32, 42, 0.88), rgba(23, 32, 42, 0.48)),
    url("../legacy/images/k5qetopbanner.gif");
  background-color: #24333a;
  background-size: cover;
  background-position: center;
  color: #fff;
}

.hero h1,
.page-title h1,
.post-detail h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5rem);
  line-height: 1;
  letter-spacing: 0;
}

.lede {
  max-width: 760px;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

.hero .eyebrow {
  color: #f3c76b;
}

.hero-location {
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  letter-spacing: 0.06em;
}

.hero-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button,
button,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button.primary,
input[type="submit"].primary {
  background: var(--accent);
  color: #fff;
}

.hero .button {
  border-color: #fff;
  color: #fff;
}

.hero .button.primary {
  background: #fff;
  color: #17202a;
}

:root[data-theme="dark"] .hero .button.primary {
  background: #ffffff;
  color: #17202a;
}

.theme-toggle {
  min-height: 40px;
  padding: 8px 12px;
  border-color: var(--line);
  color: var(--ink);
  background: var(--panel);
  line-height: 1;
}

:root[data-theme="dark"] .theme-toggle {
  border-color: #8fc8dc !important;
  background: #22343c !important;
  color: #ffffff !important;
}

:root[data-theme="dark"] .theme-toggle:hover,
:root[data-theme="dark"] .theme-toggle:focus-visible {
  background: #2f4b56 !important;
  color: #ffffff !important;
}

.hero-panel {
  padding: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
}

.panel-label {
  font-weight: 800;
}

.panel-note {
  margin-bottom: 0;
  color: #f7dfaa;
  font-weight: 700;
}

.content-band,
.page-title,
.post-detail,
.admin-shell,
.form-page {
  padding: clamp(40px, 7vw, 80px) clamp(18px, 5vw, 64px);
}

.muted {
  background: var(--soft);
}

.continuity-band {
  padding-top: 34px;
  padding-bottom: 34px;
  background: var(--panel);
}

.continuity-note {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px;
  border-left: 5px solid var(--gold);
  background: var(--soft);
  border-radius: 8px;
}

.continuity-note h2 {
  margin: 0 0 10px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.15;
}

.continuity-note p:last-child {
  margin-bottom: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: clamp(28px, 5vw, 72px);
  max-width: 1180px;
  margin: 0 auto;
}

.prose {
  font-size: 1.03rem;
}

.prose.narrow,
.post-detail header {
  max-width: 860px;
  margin: 0 auto;
}

.prose h2,
.section-heading h2,
.admin-heading h1 {
  margin-top: 0;
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  line-height: 1.15;
}

.side-list {
  align-self: start;
  display: grid;
  gap: 10px;
  padding: 20px;
  border-left: 4px solid var(--gold);
  background: var(--panel);
}

.side-list a {
  font-weight: 700;
  text-decoration: none;
}

.section-heading {
  max-width: 1180px;
  margin: 0 auto 24px;
}

.video-wrap {
  max-width: 980px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: #111820;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.video-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-link {
  max-width: 980px;
  margin: 14px auto 0;
}

.card-grid {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card,
.empty-state,
.form-card,
.post-preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  min-height: 150px;
  padding: 18px;
  color: var(--ink);
  text-decoration: none;
}

.card h3 {
  margin-top: 0;
}

.empty-state {
  padding: 22px;
}

.page-title {
  background: var(--soft);
}

.page-title p {
  max-width: 760px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.gallery-grid figure {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.gallery-grid img,
.featured-image,
.post-preview img,
.prose img {
  display: block;
  width: 100%;
  height: auto;
}

.prose figure {
  margin: 1.5rem 0;
}

.prose figcaption {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
}

.gallery-grid figcaption {
  padding: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.post-list {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.archive-list {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.archive-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.archive-row h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.archive-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-link {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.captured-text p {
  margin: 0 0 0.65rem;
}

.post-preview {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
}

.post-date {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-detail header {
  margin-bottom: 24px;
}

.featured-image {
  max-width: 960px;
  margin: 0 auto 28px;
  border-radius: 8px;
}

.form-page {
  display: grid;
  place-items: start center;
}

.form-card,
.editor-form {
  width: min(100%, 980px);
  padding: 24px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto 24px;
}

.admin-heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-wrap,
.editor-form {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.actions {
  justify-content: flex-end;
}

.actions form,
.order-controls form {
  margin: 0;
}

.actions button,
.order-controls button {
  min-height: 0;
  padding: 0;
  border: 0;
  color: #9b2f24;
  background: transparent;
}

.order-controls {
  min-width: 132px;
  white-space: nowrap;
}

.order-controls form {
  display: inline-flex;
  margin-right: 4px;
}

.order-controls .mini-button {
  min-height: 36px;
  min-width: 56px;
  padding: 7px 9px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
  color: var(--accent-dark);
  font-weight: 750;
}

.order-controls .mini-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: default;
  opacity: 0.45;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.flash-wrap {
  padding: 12px clamp(18px, 5vw, 64px) 0;
}

.flash {
  max-width: 1180px;
  margin: 0 auto 8px;
  padding: 10px 14px;
  border-radius: 6px;
  background: #e7f3ea;
  border: 1px solid #b9dec1;
}

.flash.error {
  background: #f8e7e3;
  border-color: #e2b6ad;
}

:root[data-theme="dark"] .flash {
  background: #173223;
  border-color: #2f6745;
}

:root[data-theme="dark"] .flash.error,
:root[data-theme="dark"] .form-errors {
  background: #3a1f1b;
  border-color: #7c3d34;
}

.form-errors {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #e2b6ad;
  border-radius: 6px;
  background: #f8e7e3;
}

.form-errors p {
  margin: 4px 0 0;
}

.field-error {
  color: #9b2f24;
  font-size: 0.9rem;
  font-weight: 650;
}

.site-footer {
  padding: 28px clamp(18px, 5vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 1040px) {
  .site-header {
    align-items: center;
  }

  .nav-toggle {
    display: inline-flex;
    width: auto;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 72px;
    right: 18px;
    width: min(320px, calc(100vw - 36px));
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    box-shadow: 0 18px 36px var(--shadow);
  }

  .site-nav a {
    justify-content: flex-start;
    min-height: 44px;
    padding: 10px 12px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .hero,
  .content-grid,
  .post-preview,
  .archive-row,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 76vh;
  }

  .admin-heading {
    align-items: stretch;
    flex-direction: column;
  }
}
