/* ===== Reset & tokens ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-black: #0A0A0A;
  --panel-gray: #161616;
  --rust: #A33B2E;
  --gold: #C9A063;
  --cyan: #00D4FF;
  --text-white: #F5F5F5;
  --text-gray: #A0A0A0;
  --border-rust: #5C2A2A;
  --glitch-cyan: #70EFFF;
  --font-heading: Impact, "Arial Black", sans-serif;
  --font-body: "Roboto Mono", "Courier New", monospace;
  --header-h: 72px;
  --container-w: 1200px;
  --radius: 2px;
  --transition-fast: 150ms ease;
  --transition-base: 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-black);
  color: var(--text-white);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: var(--text-white);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--rust);
}

ul {
  list-style: none;
}

button {
  font-family: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}

input {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

::selection {
  background: var(--rust);
  color: #fff;
}

/* ===== Skip link ===== */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10000;
  background: var(--bg-black);
  color: var(--text-white);
  border: 1px solid var(--cyan);
  padding: 8px 18px;
  font-size: 14px;
  transform: translateY(-120%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ===== Scroll progress ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--rust), var(--gold), var(--cyan));
  z-index: 1000;
  pointer-events: none;
}

/* ===== Site header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 900;
  background: transparent;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.site-header[data-scrolled="true"] {
  background: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--border-rust);
}

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 28px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  margin-right: auto;
  border-left: 4px solid var(--rust);
  padding-left: 14px;
  line-height: 1.2;
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 28px;
  letter-spacing: 0.02em;
  color: #fff;
}

.brand-tagline {
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ===== Search ===== */
.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(10, 10, 10, 0.5);
  padding: 8px 14px;
  width: 260px;
  transition: border-color var(--transition-fast);
}

.header-search:focus-within {
  border-color: var(--cyan);
}

.search-icon {
  position: relative;
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-gray);
  border-radius: 50%;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  position: absolute;
  bottom: -4px;
  right: -5px;
  width: 6px;
  height: 2px;
  background: var(--text-gray);
  transform: rotate(45deg);
}

.search-input {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text-white);
  font-size: 13px;
  padding: 2px 0;
}

.search-input::placeholder {
  color: var(--text-gray);
}

.search-input:focus {
  outline: none;
}

/* ===== Nav toggle ===== */
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  background: transparent;
}

.toggle-line {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-white);
  margin: 2px 0;
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.toggle-label {
  font-size: 12px;
  color: var(--text-gray);
  letter-spacing: 0.08em;
}

.nav-toggle[aria-expanded="true"] .toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .toggle-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .toggle-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-toggle[aria-expanded="true"] .toggle-label {
  color: var(--cyan);
}

/* ===== Nav panel ===== */
.nav-panel {
  flex-basis: 100%;
  display: none;
  border-top: 1px solid var(--border-rust);
  background: var(--bg-black);
  padding: 8px 0 16px;
}

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

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.site-nav a {
  display: block;
  padding: 12px 16px;
  border-left: 3px solid transparent;
  font-size: 16px;
  color: var(--text-white);
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.site-nav a:hover {
  background: rgba(163, 59, 46, 0.14);
  border-left-color: var(--rust);
  color: #fff;
}

.site-nav a[aria-current="page"] {
  border-left-color: var(--rust);
  background: linear-gradient(90deg, rgba(163, 59, 46, 0.18), transparent);
  color: var(--rust);
  font-weight: 700;
}

/* ===== Footer ===== */
.page-foot {
  position: relative;
  margin-top: 80px;
  background: var(--panel-gray);
  border-top: 1px solid var(--border-rust);
}

.page-foot::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--rust) 0%, var(--rust) 30%, var(--gold) 30%, var(--gold) 60%, var(--cyan) 60%, var(--cyan) 100%);
  opacity: 0.8;
}

.footer-inner {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 48px 28px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

.footer-brand .brand {
  margin-bottom: 12px;
}

.footer-brand .brand-name {
  color: #fff;
  font-size: 24px;
}

.footer-brand .brand-tagline {
  font-size: 11px;
}

.footer-trust {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-gray);
  max-width: 360px;
  border-left: 2px solid var(--gold);
  padding-left: 12px;
}

.footer-col-title {
  font-family: var(--font-heading);
  font-size: 16px;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.footer-list li {
  padding: 5px 0;
  font-size: 14px;
  color: var(--text-gray);
}

.footer-list a {
  color: var(--text-gray);
  border-bottom: 1px dotted rgba(255, 255, 255, 0.25);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.footer-list a:hover {
  color: var(--cyan);
  border-color: var(--cyan);
}

.footer-icp {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border-rust);
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-gray);
}

/* ===== Layout system ===== */
.main-content {
  padding-top: var(--header-h);
}

.container {
  max-width: var(--container-w);
  margin: 0 auto;
  padding: 0 28px;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-gray);
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-rust);
  margin-bottom: 36px;
  background: var(--panel-gray);
}

.breadcrumb a {
  color: var(--text-gray);
}

.breadcrumb a:hover {
  color: var(--cyan);
}

.breadcrumb span + span::before {
  content: "/";
  margin-right: 6px;
  color: var(--rust);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all var(--transition-base);
}

.btn--primary {
  background: var(--rust);
  color: #fff;
  border-color: var(--rust);
}

.btn--primary:hover {
  background: transparent;
  color: var(--rust);
  border-color: var(--rust);
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--text-gray);
  color: var(--text-white);
}

.btn--ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ===== Section tag ===== */
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid transparent;
  margin-bottom: 18px;
}

.section-tag--rust {
  background: rgba(163, 59, 46, 0.12);
  color: var(--rust);
  border-color: rgba(163, 59, 46, 0.4);
}

.section-tag--gold {
  background: rgba(201, 160, 99, 0.1);
  color: var(--gold);
  border-color: rgba(201, 160, 99, 0.4);
}

/* ===== Glitch line ===== */
.glitch-line {
  position: relative;
  height: 1px;
  background: var(--border-rust);
  margin: 28px 0;
  overflow: hidden;
}

.glitch-line::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 3px;
  background: var(--rust);
}

.glitch-line::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 160px;
  width: 30px;
  height: 1px;
  background: var(--cyan);
  filter: blur(1px);
}

/* ===== Index list ===== */
.index-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.index-list li {
  border-bottom: 1px solid var(--border-rust);
  transition: padding-left var(--transition-base), background var(--transition-base);
}

.index-list a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  font-size: 15px;
  border-left: 2px solid transparent;
  transition: all var(--transition-base);
}

.index-list a:hover {
  border-left-color: var(--rust);
  padding-left: 24px;
  background: rgba(163, 59, 46, 0.06);
}

.index-list .list-num {
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--rust);
}

.index-list .list-date {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-gray);
}

/* ===== Aside note ===== */
.aside-note {
  border-left: 3px solid var(--gold);
  background: var(--panel-gray);
  padding: 16px 20px;
  font-size: 13px;
  color: var(--text-gray);
  margin: 20px 0;
}

.aside-note strong {
  color: var(--gold);
  font-weight: 700;
}

/* ===== Image frame ===== */
.image-frame {
  position: relative;
  overflow: hidden;
  background: var(--panel-gray);
  border: 1px solid var(--border-rust);
  min-height: 120px;
}

.image-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.image-frame::after {
  content: "IMG";
  position: absolute;
  right: 10px;
  top: 8px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--rust);
  opacity: 0.6;
}

.image-frame[data-ratio="16/9"] {
  aspect-ratio: 16 / 9;
}

.image-frame[data-ratio="4/3"] {
  aspect-ratio: 4 / 3;
}

.image-frame[data-ratio="1/1"] {
  aspect-ratio: 1 / 1;
}

/* ===== Filter bar ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 32px;
}

.filter-bar button {
  padding: 6px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text-gray);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.filter-bar button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.filter-bar button.active {
  background: var(--rust);
  border-color: var(--rust);
  color: #fff;
}

/* ===== Responsive ===== */
@media (min-width: 640px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .footer-icp {
    grid-column: 1 / -1;
  }
}

@media (min-width: 900px) {
  .nav-toggle {
    display: none;
  }

  .nav-panel {
    display: block !important;
    flex-basis: auto;
    border-top: 0;
    background: transparent;
    padding: 0;
    margin-left: auto;
  }

  .site-nav {
    flex-direction: row;
    gap: 2px;
  }

  .site-nav a {
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    font-size: 14px;
  }

  .site-nav a:hover {
    border-left: 0;
    border-bottom-color: var(--rust);
    background: transparent;
    color: #fff;
  }

  .site-nav a[aria-current="page"] {
    border-left: 0;
    border-bottom-color: var(--rust);
    background: transparent;
    color: var(--rust);
  }

  .footer-inner {
    grid-template-columns: 1.2fr 0.8fr 1fr;
  }

  .footer-icp {
    grid-column: 1 / -1;
  }

  .footer-brand {
    padding-right: 24px;
  }
}

@media (min-width: 1100px) {
  .header-search {
    display: flex;
  }
}

@media (max-width: 1099px) {
  .header-search {
    display: none;
  }

  .header-inner {
    gap: 12px;
    padding: 0 20px;
  }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
