@import url("fonts.css");

:root {
  color-scheme: dark;
  --bg: #071018;
  --bg-soft: #0d1823;
  --panel: rgba(7, 14, 22, 0.9);
  --panel-strong: rgba(10, 18, 28, 0.96);
  --line: rgba(118, 164, 208, 0.24);
  --line-strong: rgba(118, 164, 208, 0.45);
  --text: rgba(255, 255, 255, 0.92);
  --text-strong: #ffffff;
  --text-muted: rgba(214, 226, 238, 0.72);
  --accent: #7dc0ff;
  --accent-strong: #bfe0ff;
  --accent-soft: rgba(125, 192, 255, 0.18);
  --warm: #d8a14e;
  --warm-soft: rgba(216, 161, 78, 0.16);
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
  --page-glow-1: rgba(89, 145, 198, 0.12);
  --page-glow-2: rgba(216, 161, 78, 0.08);
  --page-bg: linear-gradient(180deg, #08121b 0%, #050b11 100%);
  --rail-bg: linear-gradient(180deg, rgba(7, 14, 22, 0.92), rgba(7, 14, 22, 0.84)),
    linear-gradient(180deg, rgba(125, 192, 255, 0.08), transparent 30%);
  --frame-bg: linear-gradient(180deg, rgba(10, 18, 28, 0.95), rgba(7, 14, 22, 0.92));
  --surface: rgba(255, 255, 255, 0.03);
  --surface-strong: rgba(255, 255, 255, 0.04);
  --surface-accent: rgba(125, 192, 255, 0.08);
  --surface-accent-hover: rgba(125, 192, 255, 0.16);
  --eyebrow: rgba(223, 233, 242, 0.62);
  --minor: rgba(223, 233, 242, 0.65);
  --tone-mid: rgba(255, 255, 255, 0.95);
  --side-note-border: rgba(255, 255, 255, 0.18);
  --side-note-bg: rgba(255, 255, 255, 0.04);
  --side-note-text: rgba(255, 255, 255, 0.82);
  --scroll-thumb: rgba(255, 255, 255, 0.14);
  --gallery-overlay: rgba(4, 8, 13, 0.7);
  --shadow-soft: rgba(0, 0, 0, 0.25);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f7;
  --bg-soft: #dfe7ef;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(44, 78, 112, 0.16);
  --line-strong: rgba(44, 78, 112, 0.3);
  --text: rgba(18, 33, 48, 0.92);
  --text-strong: #102235;
  --text-muted: rgba(43, 68, 92, 0.72);
  --accent: #1e6fb3;
  --accent-strong: #15568d;
  --accent-soft: rgba(30, 111, 179, 0.14);
  --warm: #b5782c;
  --warm-soft: rgba(181, 120, 44, 0.14);
  --shadow: 0 28px 64px rgba(30, 52, 78, 0.12);
  --page-glow-1: rgba(108, 163, 214, 0.18);
  --page-glow-2: rgba(219, 177, 112, 0.14);
  --page-bg: linear-gradient(180deg, #f9fbfd 0%, #edf3f8 100%);
  --rail-bg: linear-gradient(180deg, rgba(249, 251, 253, 0.96), rgba(238, 244, 249, 0.92)),
    linear-gradient(180deg, rgba(30, 111, 179, 0.08), transparent 32%);
  --frame-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 252, 0.96));
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(245, 249, 252, 0.98);
  --surface-accent: rgba(30, 111, 179, 0.08);
  --surface-accent-hover: rgba(30, 111, 179, 0.14);
  --eyebrow: rgba(55, 83, 110, 0.72);
  --minor: rgba(55, 83, 110, 0.76);
  --tone-mid: rgba(23, 41, 59, 0.9);
  --side-note-border: rgba(44, 78, 112, 0.18);
  --side-note-bg: rgba(30, 111, 179, 0.06);
  --side-note-text: rgba(29, 47, 64, 0.86);
  --scroll-thumb: rgba(44, 78, 112, 0.22);
  --gallery-overlay: rgba(223, 232, 241, 0.82);
  --shadow-soft: rgba(30, 52, 78, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Lab Grotesque", sans-serif;
  font-weight: 300;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--page-glow-1), transparent 32%),
    radial-gradient(circle at bottom right, var(--page-glow-2), transparent 28%),
    var(--page-bg);
  line-height: 1.5;
  overflow: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  background-image: linear-gradient(to right, rgba(125, 192, 255, 0.2), rgba(125, 192, 255, 0.08));
  background-repeat: no-repeat;
  background-size: 0 100%;
  transition: color 0.2s ease, background-size 0.2s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent-strong);
  background-size: 100% 100%;
}

button {
  font: inherit;
}

p,
li {
  font-size: 1.05rem;
}

.page_shell {
  min-height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  overflow: hidden;
}

.site_rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 2rem 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background: var(--rail-bg);
  border-right: 1px solid var(--line);
}

.brand_block {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1rem;
  align-items: start;
}

.brand_mark,
.mobile_mark {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px var(--shadow-soft));
}

.brand_copy h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  line-height: 1.1;
  font-weight: 400;
  color: var(--text-strong);
}

.rail_intro,
.frame_note,
.rail_meta p:last-child {
  color: var(--text-muted);
}

.eyebrow {
  margin: 0 0 0.65rem;
  font-family: "Lab Grotesque Mono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eyebrow);
}

.primary_nav,
.mobile_nav {
  display: grid;
  gap: 0.5rem;
}

.nav_link {
  display: block;
  padding: 0.95rem 1rem;
  border: 1px solid transparent;
  color: var(--text);
  background: linear-gradient(90deg, var(--surface-strong), transparent);
  font-weight: 600;
  background-size: 0 100%;
}

.nav_link:hover,
.nav_link:focus-visible {
  border-color: var(--line);
}

.nav_link.is_active {
  color: var(--text-strong);
  border-color: var(--line-strong);
  background:
    linear-gradient(90deg, var(--accent-soft), transparent 70%),
    linear-gradient(90deg, var(--surface-strong), transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.theme_toggle {
  width: fit-content;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--line-strong);
  background: var(--surface-accent);
  color: var(--text-strong);
  font-family: "Lab Grotesque Mono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.theme_toggle:hover,
.theme_toggle:focus-visible {
  border-color: var(--accent);
  background: var(--surface-accent-hover);
  transform: translateY(-1px);
}

.rail_meta {
  margin-top: auto;
  position: relative;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
  height: clamp(130px, 10vw, 180px);
  width: min(100%, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rail_meta::before {
  content: "\270E";
  position: absolute;
  right: -4.75rem;
  bottom: 4.85rem;
  transform: scaleX(-1) rotate(0deg);
  transform-origin: center;
  font-size: clamp(7.8rem, 7vw, 10.5rem);
  line-height: 1;
  color: color-mix(in srgb, var(--text-strong) 6%, transparent);
  pointer-events: none;
  filter: blur(0.4px);
}

.rail_meta p {
  margin: 0;
}

.rail_meta p:last-child {
  position: relative;
  z-index: 1;
  max-width: 19ch;
  text-align: center;
  font-size: clamp(0.95rem, 0.85vw, 1.04rem);
  line-height: 1.45;
  transform: translateY(-2px);
}

.content_stage {
  min-width: 0;
  padding: 2rem;
  height: 100%;
  overflow: hidden;
}

.mobile_bar,
.mobile_nav {
  display: none;
}

.content_frame {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--frame-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.frame_header {
  padding: 1.5rem 1.75rem;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.frame_header h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.6rem);
  font-weight: 700;
  color: var(--text-strong);
}

.frame_note {
  max-width: 26rem;
  margin: 0;
  text-align: right;
}

.content_mount {
  min-height: 0;
  overflow: auto;
  padding: 1.75rem;
}

.content_mount::-webkit-scrollbar {
  width: 8px;
}

.content_mount::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
}

.content_mount::-webkit-scrollbar-track {
  background: transparent;
}

.section_intro,
.story_grid,
.principles_grid,
.pilot_grid,
.domain_grid {
  display: grid;
  gap: 1rem;
}

.section_intro {
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.85fr);
  margin-bottom: 1.5rem;
}

.story_grid,
.pilot_grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1.5rem;
}

.principles_grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.domain_grid {
  margin-top: 1.5rem;
}

.section_block,
.note_block,
.metric_card,
.principle_card,
.project_card,
.cluster_nav,
.featured_strip {
  border: 1px solid var(--line);
  background: var(--surface);
}

.section_block,
.note_block,
.principle_card,
.project_card {
  padding: 1.2rem 1.25rem;
}

.project_card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.metric_card {
  padding: 1.1rem 1.2rem;
  background: linear-gradient(180deg, var(--surface-accent), var(--surface));
}

.metric_card strong,
.principle_card h3,
.project_card h3,
.section_block h3,
.cluster_block h3 {
  color: var(--text-strong);
}

.metric_value {
  display: block;
  margin-bottom: 0.4rem;
  font-family: "Lab Grotesque Mono", monospace;
  font-size: 0.95rem;
  color: var(--accent);
}

.tone_mid {
  font-weight: 500;
  color: var(--tone-mid);
}

.tone_strong {
  font-weight: 700;
  color: var(--text-strong);
}

blockquote,
.highlighted_text,
.side_note {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
}

blockquote {
  border-left: 2px solid var(--accent);
  background: var(--surface);
  font-style: italic;
  font-weight: 500;
}

.highlighted_text {
  border-left: 3px solid var(--warm);
  background: var(--warm-soft);
}

.side_note {
  border-left: 3px solid var(--side-note-border);
  background: var(--side-note-bg);
  color: var(--side-note-text);
}

.list_clean,
.cluster_list,
.detail_list {
  margin: 0;
  padding-left: 1.1rem;
}

.list_clean li,
.cluster_list li,
.detail_list li {
  margin-bottom: 0.55rem;
}

.cta_row,
.cluster_actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.cta_button,
.tag_link,
.gallery_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line-strong);
  color: var(--text-strong);
  background: var(--surface-accent);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.cta_button:hover,
.cta_button:focus-visible,
.tag_link:hover,
.tag_link:focus-visible,
.gallery_button:hover,
.gallery_button:focus-visible {
  border-color: var(--accent);
  background: var(--surface-accent-hover);
  transform: translateY(-1px);
}

.gallery_button:disabled,
.tag_link:disabled,
.cta_button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.cluster_nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem;
  margin: 1.25rem 0 1.5rem;
}

.project_card .cluster_actions {
  margin-top: auto;
  padding-top: 1.5rem;
}

.tag_link {
  padding: 0.55rem 0.8rem;
  font-family: "Lab Grotesque Mono", monospace;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.featured_strip {
  padding: 1rem;
  margin-top: 1.5rem;
}

.featured_grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.project_card {
  scroll-margin-top: 1rem;
}

.project_card h3,
.principle_card h3,
.section_block h3,
.cluster_block h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
}

.project_meta,
.cluster_label,
.minor_meta {
  margin: 0 0 0.7rem;
  font-family: "Lab Grotesque Mono", monospace;
  font-size: 0.82rem;
  text-transform: uppercase;
  color: var(--minor);
}

.cluster_block {
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 1rem;
}

.cluster_header {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.cluster_projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.loading_state,
.error_state {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
}

.route_flash {
  animation: routeFlash 1.4s ease;
}

@keyframes routeFlash {
  0% {
    box-shadow: inset 0 0 0 999px rgba(125, 192, 255, 0.12);
  }
  100% {
    box-shadow: inset 0 0 0 999px rgba(125, 192, 255, 0);
  }
}

.gallery_modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--gallery-overlay);
  backdrop-filter: blur(8px);
}

.gallery_dialog {
  width: min(1100px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.gallery_header,
.gallery_footer {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.gallery_footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.gallery_view {
  min-height: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.gallery_media {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.gallery_media img {
  max-width: 100%;
  max-height: calc(100vh - 14rem);
  object-fit: contain;
}

.gallery_caption {
  margin: 0;
  font-family: "Lab Grotesque Mono", monospace;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .page_shell {
    grid-template-columns: 300px 1fr;
  }

  .section_intro,
  .cluster_header,
  .story_grid,
  .principles_grid,
  .pilot_grid,
  .cluster_projects,
  .featured_grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .page_shell {
    grid-template-columns: 1fr;
  }

  .site_rail {
    display: none;
  }

  .content_stage {
    padding: 0;
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
  }

  .mobile_bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--frame-bg);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
  }

  .mobile_actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }

  .mobile_brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-strong);
    background: none;
  }

  .mobile_mark {
    width: 40px;
    height: 40px;
  }

  .menu_toggle {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text-strong);
    padding: 0.7rem 0.95rem;
  }

  .mobile_nav {
    display: grid;
    padding: 0.8rem;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    position: fixed;
    top: 73px;
    left: 1rem;
    right: 1rem;
    z-index: 45;
    margin: 0;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 90px);
    overflow: auto;
  }

  .content_frame {
    min-height: 0;
    margin: 1rem;
    overflow: auto;
  }

  .frame_header {
    padding: 1.15rem;
    align-items: start;
    flex-direction: column;
  }

  .content_mount {
    overflow: visible;
    padding: 1.15rem;
  }

  .theme_toggle_mobile {
    padding-inline: 0.8rem;
  }

  .gallery_dialog {
    width: calc(100vw - 1rem);
  }

  .gallery_view {
    grid-template-columns: 1fr;
  }

  .gallery_nav {
    width: 100%;
  }
}
