:root {
  --cream: #F5F3EC;
  --ink: #1B1917;
  --red: #D84A2E;
  --orange: #F26D21;
  --line: #D0C7B5;
  --muted: #7A7066;
  --dark: #2C2925;
  --bone: #E7DFD3;
  --highlight: #F7C548;
  --steel: #355C7D;
  --font-head: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    linear-gradient(to right, rgba(53, 92, 125, .06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(53, 92, 125, .06) 1px, transparent 1px);
  background-size: 32px 32px;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding-left: 1.25rem; }

a { color: var(--red); }
a:hover { color: var(--orange); }

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

.shell { max-width: 1220px; margin-inline: auto; padding-inline: 1.25rem; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -6rem;
  background: var(--ink);
  color: var(--cream);
  padding: 0.6rem 1.2rem;
  z-index: 1000;
  transition: top .18s ease;
  text-decoration: none;
}

.skip-link:focus { top: 0.8rem; }

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 1001;
  pointer-events: none;
  background: transparent;
}

.scroll-progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--highlight));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cream);
  border-bottom: 3px solid var(--ink);
  margin-top: 4px;
  box-shadow: 0 2px 0 rgba(208, 199, 181, .7);
}

.header-masthead {
  max-width: 1220px;
  margin-inline: auto;
  padding: 0.85rem 1.25rem 0.4rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.header-aside {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 130px;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--ink);
  color: var(--cream);
  border: 1px solid var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.nav-toggle:hover { background: var(--red); border-color: var(--red); }

.nav-toggle-box { display: flex; flex-direction: column; gap: 3px; width: 16px; }
.nav-toggle-box span { height: 2px; background: currentColor; display: block; }

.nav-toggle-text { font-family: var(--font-head); font-weight: 900; }

.status-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bone);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.2rem 0.5rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.brand-block { text-align: center; line-height: 1.15; }

.masthead-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.brand {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand:hover { color: var(--red); }

.masthead-sub {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  margin-top: 0.2rem;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border: none;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: background .2s ease, transform .15s ease;
}

.quick-btn:hover { background: var(--orange); color: #fff; transform: translateY(-2px); }

.site-nav { background: var(--ink); color: var(--cream); }
.site-nav .shell { padding-block: 0; }

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.nav-links a {
  display: block;
  color: var(--cream);
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  padding: 0.65rem 1.2rem;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  transition: background .16s ease, color .16s ease;
}

.nav-links a:hover { background: var(--red); color: #fff; }
.nav-links a[aria-current="page"] { background: var(--cream); color: var(--ink); }

.site-footer {
  background: var(--dark);
  color: var(--cream);
  border-top: 5px solid var(--red);
  margin-top: 4rem;
}

.site-footer a {
  color: var(--cream);
  text-decoration: none;
  border-bottom: 1px solid rgba(245, 243, 236, 0.25);
}

.site-footer a:hover { color: var(--highlight); border-bottom-color: var(--highlight); }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.6fr;
  gap: 2rem;
  padding: 3rem 1.25rem 2rem;
  max-width: 1220px;
  margin-inline: auto;
}

.footer-column { min-width: 0; }

.footer-brand .brand { font-size: 2rem; border-bottom: none; }
.footer-brand .brand:hover { color: var(--highlight); }
.footer-brand p { color: rgba(245, 243, 236, 0.7); font-size: 0.85rem; max-width: 30ch; }

.footer-kicker {
  font-family: var(--font-mono);
  color: var(--orange);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--highlight);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 0.4rem;
  margin-bottom: 0.9rem;
}

.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 0.4rem; }
.footer-links a { font-size: 0.85rem; }

.footer-contact { font-size: 0.85rem; }
.footer-contact p { margin-bottom: 0.45rem; font-family: var(--font-mono); font-size: 0.82rem; opacity: 0.85; }

.footer-note {
  opacity: 0.65;
  font-size: 0.75rem;
  line-height: 1.6;
  margin-top: 0.6rem;
  font-family: var(--font-body);
}

.footer-subline {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 1.2rem 1.25rem;
  max-width: 1220px;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(245, 243, 236, 0.6);
}

.footer-subline p { margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  border: none;
  padding: 0.7rem 1.4rem;
  font-family: var(--font-head);
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: background .2s;
}

.btn:hover { background: var(--orange); color: #fff; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}

.btn--ghost:hover { background: var(--ink); color: var(--cream); }

.breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin: 1.5rem 0;
}

.breadcrumbs a { color: var(--steel); text-decoration: none; }
.breadcrumbs a:hover { color: var(--red); }
.breadcrumbs span { color: var(--muted); }

.prose { max-width: 72ch; }
.prose p + p { margin-top: 1.2em; }
.prose h2 { margin-top: 2em; }

.section-title {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  letter-spacing: -0.01em;
}

.section-title::before {
  content: attr(data-index);
  font-family: var(--font-mono);
  font-size: 0.8em;
  color: var(--red);
  border: 2px solid var(--red);
  padding: 0.1rem 0.45rem;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}

.lead {
  font-size: 1.2rem;
  line-height: 1.9;
  color: var(--muted);
  max-width: 65ch;
}

.img-frame {
  position: relative;
  background: var(--bone);
  border: 1px solid var(--line);
  overflow: hidden;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.img-frame::before {
  content: attr(data-label);
  position: relative;
  z-index: 1;
  background: var(--cream);
  border-left: 3px solid var(--steel);
  padding: 0.2rem 0.6rem;
}

.img-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(53, 92, 125, .12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(53, 92, 125, .12) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.7;
}

.data-section { scroll-margin-top: 120px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .quick-btn, .nav-links a, .site-footer a, .skip-link { transition: none; }
  .scroll-progress span { transition: none; }
}

@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

@media (max-width: 767px) {
  .header-masthead {
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
  }

  .header-aside { min-width: 0; }
  .nav-toggle { display: flex; }
  .status-chip { display: none; }

  .brand-block { grid-column: 2; grid-row: 1; text-align: right; }
  .brand { font-size: 2rem; }
  .masthead-kicker { font-size: 0.6rem; }

  .quick-btn {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
    width: auto;
  }

  .site-nav { display: none; }
  .site-nav[data-open="true"] { display: block; }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links a {
    border-left: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding: 1rem 1.5rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    padding-top: 2rem;
    gap: 1.6rem;
  }

  .footer-subline {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .brand { font-size: 1.7rem; }
  .masthead-sub { font-size: 0.68rem; }
}
