@font-face {
  font-family: 'Cormorant Garamond';
  src: url('/assets/fonts/cormorant-semibold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Bricolage Grotesque';
  src:
    url('/assets/fonts/bricolage-variable.woff2') format('woff2-variations'),
    url('/assets/fonts/bricolage-regular.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Adwaita Mono';
  src: url('/assets/fonts/AdwaitaMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --ground-light: #f4efe2;
  --ground-dark: #141714;
  --surface-light: #e9e2ce;
  --surface-dark: #1c211c;
  --paper-light: #faf7ee;
  --paper-dark: #1a1f1a;
  --ink-light: #1e211b;
  --ink-dark: #efe9d8;
  --ink-muted-light: #565348;
  --ink-muted-dark: #aea796;
  --hero-sub-light: #2f332b;
  --hero-sub-dark: #d8d1be;
  --rule-light: #cfc4a8;
  --rule-dark: #373b30;
  --accent-light: #1877b8;
  --accent-dark: #38a8e2;
  --accent-hover-light: #125e93;
  --accent-hover-dark: #5bc0f2;
  --accent-ink-light: #ffffff;
  --accent-ink-dark: #081924;
  --accent-tint-light: rgba(24, 119, 184, 0.14);
  --accent-tint-dark: rgba(56, 168, 226, 0.24);
  --gold-light: #9a7434;
  --gold-dark: #c9a762;
  --hero-panel-light: rgba(244, 239, 226, 0.92);
  --hero-panel-dark: rgba(20, 23, 20, 0.88);
  --hero-btn-light: rgba(244, 239, 226, 0.92);
  --hero-btn-dark: rgba(20, 23, 20, 0.86);
  --scrollbar-thumb-light: #bfb292;
  --scrollbar-thumb-dark: #4b4f43;

  --ground: var(--ground-light);
  --surface: var(--surface-light);
  --paper: var(--paper-light);
  --ink: var(--ink-light);
  --ink-muted: var(--ink-muted-light);
  --hero-sub: var(--hero-sub-light);
  --rule: var(--rule-light);
  --accent: var(--accent-light);
  --accent-hover: var(--accent-hover-light);
  --accent-ink: var(--accent-ink-light);
  --accent-tint: var(--accent-tint-light);
  --gold: var(--gold-light);
  --hero-panel: var(--hero-panel-light);
  --hero-btn: var(--hero-btn-light);
  --scrollbar-thumb: var(--scrollbar-thumb-light);

  --shrine-cyan: #3ab8ea;
  --amber: #d98c2b;
  --slate-pin: rgba(28, 24, 19, 0.92);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  --font-mono: 'Adwaita Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 4px;

  &:has(> head > meta[name='color-scheme'][content='dark']) {
    color-scheme: dark;
  }

  &:has(> head > meta[name='color-scheme'][content='light']) {
    color-scheme: light;
  }

  @media (prefers-color-scheme: dark) {
    --ground: var(--ground-dark);
    --surface: var(--surface-dark);
    --paper: var(--paper-dark);
    --ink: var(--ink-dark);
    --ink-muted: var(--ink-muted-dark);
    --hero-sub: var(--hero-sub-dark);
    --rule: var(--rule-dark);
    --accent: var(--accent-dark);
    --accent-hover: var(--accent-hover-dark);
    --accent-ink: var(--accent-ink-dark);
    --accent-tint: var(--accent-tint-dark);
    --gold: var(--gold-dark);
    --hero-panel: var(--hero-panel-dark);
    --hero-btn: var(--hero-btn-dark);
    --scrollbar-thumb: var(--scrollbar-thumb-dark);
  }

  @supports (color: light-dark(white, black)) {
    --ground: light-dark(var(--ground-light), var(--ground-dark));
    --surface: light-dark(var(--surface-light), var(--surface-dark));
    --paper: light-dark(var(--paper-light), var(--paper-dark));
    --ink: light-dark(var(--ink-light), var(--ink-dark));
    --ink-muted: light-dark(var(--ink-muted-light), var(--ink-muted-dark));
    --hero-sub: light-dark(var(--hero-sub-light), var(--hero-sub-dark));
    --rule: light-dark(var(--rule-light), var(--rule-dark));
    --accent: light-dark(var(--accent-light), var(--accent-dark));
    --accent-hover: light-dark(var(--accent-hover-light), var(--accent-hover-dark));
    --accent-ink: light-dark(var(--accent-ink-light), var(--accent-ink-dark));
    --accent-tint: light-dark(var(--accent-tint-light), var(--accent-tint-dark));
    --gold: light-dark(var(--gold-light), var(--gold-dark));
    --hero-panel: light-dark(var(--hero-panel-light), var(--hero-panel-dark));
    --hero-btn: light-dark(var(--hero-btn-light), var(--hero-btn-dark));
    --scrollbar-thumb: light-dark(var(--scrollbar-thumb-light), var(--scrollbar-thumb-dark));
  }

  accent-color: var(--accent);
  scrollbar-color: var(--scrollbar-thumb) var(--ground);
}

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

html {
  scroll-behavior: smooth;
  background: var(--ground);
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

::selection {
  background: var(--accent-tint);
  color: var(--ink);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--ground);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-underline-offset: 0.22em;
}

section[id] {
  scroll-margin-top: 76px;
}

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

.tabular-meta {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.container {
  width: min(1140px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* BOTW Region Divider */
.hyrule-rule {
  position: relative;
  height: 1px;
  width: min(260px, 75%);
  margin: 0.75rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
}

.hyrule-rule::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
}

.hyrule-rule-left {
  margin: 0.75rem 0 0;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 65%, transparent 100%);
}

.hyrule-rule-left::after {
  left: 0;
  transform: translate(0, -50%) rotate(45deg);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.38rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark-mark {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  border: 1.5px solid var(--gold);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.site-nav a:not(.btn-outline) {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:not(.btn-outline):hover {
  color: var(--ink);
}

/* Buttons & Controls */
.btn-primary,
.btn-outline,
.btn-text,
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.btn-primary {
  padding: 0.78rem 1.2rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}

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

.btn-outline {
  padding: 0.68rem 1.05rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}

.btn-outline:hover {
  border-color: var(--gold);
}

.btn-hero-outline {
  background: var(--hero-btn);
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
}

.btn-text {
  padding: 0.45rem 0.55rem;
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid transparent;
}

.btn-text:hover,
.btn-icon:hover {
  color: var(--ink);
  border-color: var(--rule);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.theme-to-light {
  display: none;
}

.theme-to-dark {
  display: inline-flex;
}

:root:has(> head > meta[name='color-scheme'][content='dark']) .theme-to-dark {
  display: none;
}

:root:has(> head > meta[name='color-scheme'][content='dark']) .theme-to-light {
  display: inline-flex;
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name='color-scheme'][content='light'])) .theme-to-dark {
    display: none;
  }

  :root:not(:has(> head > meta[name='color-scheme'][content='light'])) .theme-to-light {
    display: inline-flex;
  }
}

.btn-primary:active,
.btn-outline:active {
  transform: scale(0.985);
}

.link-quiet {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  white-space: nowrap;
}

.link-quiet:hover {
  color: var(--accent-hover);
}

/* Panoramic Painterly Hero */
.hero-vista {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.hero-vista-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
  user-select: none;
}

.hero-vista-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      95deg,
      rgba(244, 239, 226, 0.93) 0%,
      rgba(244, 239, 226, 0.78) 44%,
      rgba(244, 239, 226, 0.28) 100%
    ),
    linear-gradient(
      180deg,
      rgba(244, 239, 226, 0.12) 0%,
      rgba(244, 239, 226, 0.35) 70%,
      rgba(244, 239, 226, 0.95) 100%
    );
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding-top: 3.4rem;
  padding-bottom: 3.6rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(270px, 0.72fr);
  gap: 2.5rem;
  align-items: end;
}

.hero-main h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.85rem, 5.2vw, 4.35rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.01em;
}

.hero-sub {
  margin: 1rem 0 0;
  max-width: 50ch;
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--hero-sub);
}

.hero-actions {
  margin-top: 1.45rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-facts {
  margin: 0;
  padding: 0.2rem 1.15rem;
  background: var(--hero-panel);
  border: 1px solid color-mix(in srgb, var(--gold) 38%, transparent);
  border-radius: var(--radius);
  display: grid;
}

:root:has(> head > meta[name='color-scheme'][content='dark']) .hero-vista-bg {
  filter: brightness(0.42) contrast(1.12) saturate(0.84) hue-rotate(-8deg);
}

:root:has(> head > meta[name='color-scheme'][content='dark']) .hero-vista-scrim {
  background:
    linear-gradient(
      95deg,
      rgba(20, 23, 20, 0.94) 0%,
      rgba(20, 23, 20, 0.76) 46%,
      rgba(20, 23, 20, 0.28) 100%
    ),
    linear-gradient(
      180deg,
      rgba(20, 23, 20, 0.16) 0%,
      rgba(20, 23, 20, 0.42) 70%,
      rgba(20, 23, 20, 0.96) 100%
    );
}

:root:has(> head > meta[name='color-scheme'][content='dark']) .atlas-plate {
  filter: brightness(0.68) contrast(1.14) saturate(0.92);
}

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name='color-scheme'][content='light'])) .hero-vista-bg {
    filter: brightness(0.42) contrast(1.12) saturate(0.84) hue-rotate(-8deg);
  }

  :root:not(:has(> head > meta[name='color-scheme'][content='light'])) .hero-vista-scrim {
    background:
      linear-gradient(
        95deg,
        rgba(20, 23, 20, 0.94) 0%,
        rgba(20, 23, 20, 0.76) 46%,
        rgba(20, 23, 20, 0.28) 100%
      ),
      linear-gradient(
        180deg,
        rgba(20, 23, 20, 0.16) 0%,
        rgba(20, 23, 20, 0.42) 70%,
        rgba(20, 23, 20, 0.96) 100%
      );
  }

  :root:not(:has(> head > meta[name='color-scheme'][content='light'])) .atlas-plate {
    filter: brightness(0.68) contrast(1.14) saturate(0.92);
  }
}

.hero-facts div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.68rem 0;
  border-top: 1px solid var(--rule);
}

.hero-facts div:first-child {
  border-top: none;
}

.hero-facts dt {
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.hero-facts dd {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: right;
}

/* Section Headers */
.region-header {
  text-align: center;
  margin-bottom: 1.9rem;
}

.region-header h2,
section h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: 0.015em;
}

/* Sheikah Slate Map Section */
.atlas-section {
  padding-top: 3.2rem;
  padding-bottom: 3rem;
}

.atlas-stage {
  margin: 0;
}

.atlas-canvas {
  position: relative;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  overflow: hidden;
  background: #cbb992;
  aspect-ratio: 16 / 7.2;
}

.atlas-inner-frame {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(244, 239, 226, 0.42);
  pointer-events: none;
  z-index: 1;
}

.atlas-plate {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
}

.map-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 2;
}

.map-corner.tl {
  top: 10px;
  left: 10px;
  border-top: 1.5px solid var(--gold);
  border-left: 1.5px solid var(--gold);
}

.map-corner.tr {
  top: 10px;
  right: 10px;
  border-top: 1.5px solid var(--gold);
  border-right: 1.5px solid var(--gold);
}

.map-corner.bl {
  bottom: 10px;
  left: 10px;
  border-bottom: 1.5px solid var(--gold);
  border-left: 1.5px solid var(--gold);
}

.map-corner.br {
  bottom: 10px;
  right: 10px;
  border-bottom: 1.5px solid var(--gold);
  border-right: 1.5px solid var(--gold);
}

.map-hud-badge {
  position: absolute;
  z-index: 3;
  padding: 0.28rem 0.6rem;
  font-size: 0.75rem;
  background: var(--slate-pin);
  border: 1px solid rgba(207, 196, 168, 0.5);
  border-radius: var(--radius);
  color: #f4efe2;
  pointer-events: none;
}

.map-hud-badge.top-left {
  top: 16px;
  left: 20px;
  color: #bce8fb;
}

.map-hud-badge.bottom-left {
  bottom: 16px;
  left: 20px;
}

.atlas-route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.atlas-route-svg line {
  stroke: var(--shrine-cyan);
  stroke-width: 0.36;
  stroke-dasharray: 0.9 0.7;
  opacity: 0.95;
}

.map-pins {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.map-pin {
  position: absolute;
  left: var(--pin-x);
  top: var(--pin-y);
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.36rem 0.66rem;
  background: var(--slate-pin);
  color: #faf7ee;
  border: 1px solid rgba(207, 196, 168, 0.55);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(20, 18, 14, 0.24);
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.pin-mark {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  border: 1.5px solid var(--amber);
  background: var(--amber);
  flex-shrink: 0;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.map-pin.is-visited .pin-mark {
  border-color: var(--shrine-cyan);
  background: var(--shrine-cyan);
}

.pin-reticle {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(58, 184, 234, 0.85);
  pointer-events: none;
}

.pin-reticle::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(154, 116, 52, 0.72);
  border-left-color: transparent;
  border-right-color: transparent;
}

@keyframes reticle-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

.map-pin.is-active {
  background: #103249;
  border-color: var(--shrine-cyan);
  box-shadow: 0 0 0 2px rgba(58, 184, 234, 0.25), 0 4px 14px rgba(16, 50, 73, 0.35);
  z-index: 5;
}

.map-pin.is-active .pin-reticle {
  display: block;
}

@media (prefers-reduced-motion: no-preference) {
  .map-pin.is-active .pin-reticle {
    animation: reticle-spin 18s linear infinite;
  }
}

.map-pin:hover {
  border-color: var(--shrine-cyan);
  transform: translate(-50%, -54%);
}

/* Atlas Readout */
.atlas-readout {
  margin-top: 1.15rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr) auto;
  gap: 1.5rem;
  align-items: center;
}

.readout-id {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}

.readout-id strong {
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 600;
  line-height: 1.18;
}

.readout-id > span:nth-child(2) {
  font-size: 0.92rem;
  color: var(--accent);
  font-weight: 600;
}

.readout-summary p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-muted);
  max-width: 60ch;
}

.readout-stack {
  margin-top: 0.45rem !important;
  font-family: var(--font-mono);
  font-size: 0.8rem !important;
  color: var(--ink) !important;
}

.readout-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

/* Compendium Projects Showcase */
.projects-section {
  padding-top: 3.4rem;
  padding-bottom: 3.4rem;
}

.projects-showcase {
  display: grid;
  gap: 3rem;
}

.project-featured {
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 2.2rem;
  align-items: center;
}

.compendium-frame {
  position: relative;
  padding: 5px;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--paper);
}

.compendium-frame-inner {
  border: 1px solid var(--rule);
  overflow: hidden;
  background: var(--surface);
  aspect-ratio: 16 / 10;
}

.compendium-frame-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.project-copy h3,
.project-band-head h3,
.project-pair-item h3 {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.12;
}

.compendium-specs {
  margin: 0.85rem 0 0;
  display: grid;
  border-top: 1px solid var(--rule);
}

.compendium-specs div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.48rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
}

.compendium-specs dt {
  color: var(--ink-muted);
}

.compendium-specs dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.project-desc {
  margin: 0.75rem 0 0;
  color: var(--ink-muted);
  max-width: 58ch;
}

.project-stack {
  margin: 0.85rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink);
}

.project-actions {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

/* Typographic Band for IMPREX */
.project-band {
  padding: 2rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.project-band-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.project-band-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.8rem;
}

.project-band-cols h4 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 600;
}

.project-band-cols p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

/* Editorial Pair */
.project-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.2rem;
}

.project-pair-item {
  display: flex;
  flex-direction: column;
}

.project-pair-item .compendium-frame {
  margin-bottom: 1rem;
}

/* Experience & Stack */
.experience-section {
  padding-top: 3.4rem;
  padding-bottom: 3.4rem;
  border-top: 1px solid var(--rule);
}

.experience-rows {
  display: grid;
}

.exp-row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
}

.exp-row:last-child {
  border-bottom: 1px solid var(--rule);
}

.exp-period {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.exp-content h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 600;
}

.exp-role {
  margin: 0.2rem 0 0.65rem;
  font-size: 0.94rem;
  color: var(--accent);
  font-weight: 600;
}

.exp-content ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink-muted);
  display: grid;
  gap: 0.35rem;
  max-width: 68ch;
}

.exp-content p {
  margin: 0;
  color: var(--ink-muted);
  max-width: 68ch;
}

.stack-columns {
  margin-top: 2.6rem;
}

.stack-columns h3 {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
}

.stack-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.8rem;
}

.stack-grid div {
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

.stack-grid dt {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.stack-grid dd {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.94rem;
}

/* Contact */
.contact-section {
  padding-top: 3.2rem;
  padding-bottom: 3.4rem;
  border-top: 1px solid var(--rule);
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 2.2rem;
  align-items: start;
}

.contact-lead {
  margin: 0.9rem 0 0;
  color: var(--ink-muted);
  max-width: 44ch;
}

.email-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.email-address {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.copy-status {
  font-size: 0.875rem;
  color: var(--accent);
}

.contact-links {
  list-style: none;
  padding: 1.15rem 0 0;
  margin: 1.15rem 0 0;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  font-size: 0.95rem;
}

.contact-links a {
  text-decoration: none;
  font-weight: 500;
}

.contact-links a:hover {
  color: var(--accent);
}

.site-footer {
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

/* Native Compendium <dialog> with light-dismiss, top-layer exit & scroll containment */
dialog#case-dialog {
  margin: auto;
  width: min(860px, calc(100vw - 1.5rem));
  max-height: min(88dvh, 840px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(25, 22, 16, 0.28);
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.18s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

@media (prefers-reduced-motion: no-preference) {
  dialog#case-dialog {
    transform: translateY(8px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  dialog#case-dialog,
  dialog#case-dialog::backdrop {
    transition-duration: 0.1s;
  }
}

dialog#case-dialog:modal {
  overscroll-behavior: contain;
}

dialog#case-dialog::backdrop {
  background-color: rgba(25, 22, 16, 0);
  overflow: hidden;
  overscroll-behavior: contain;
  transition-property: background-color, display, overlay;
  transition-duration: 0.18s;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}

dialog#case-dialog[open]:where(:not([data-closing])) {
  opacity: 1;

  @starting-style {
    opacity: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    transform: translateY(0) scale(1);

    @starting-style {
      transform: translateY(8px) scale(0.98);
    }
  }

  &::backdrop {
    background-color: rgba(25, 22, 16, 0.72);

    @starting-style {
      background-color: rgba(25, 22, 16, 0);
    }
  }
}

.dialog-shell {
  display: flex;
  flex-direction: column;
  max-height: min(88dvh, 840px);
  background: var(--paper);
  position: relative;
  z-index: 1;
}

.dialog-inner-frame {
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(154, 116, 52, 0.28);
  pointer-events: none;
  z-index: 0;
}

.dialog-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.3rem 1.55rem 1.05rem;
  border-bottom: 1px solid var(--rule);
}

.dialog-meta {
  margin: 0 0 0.2rem;
}

.dialog-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.85rem;
  line-height: 1.1;
}

.dialog-close {
  padding: 0.5rem 0.7rem;
  flex-shrink: 0;
}

.dialog-body {
  position: relative;
  z-index: 1;
  padding: 1.35rem 1.55rem 1.65rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 1.25rem;
}

.dialog-gallery {
  display: grid;
  gap: 0.7rem;
}

.dialog-stage {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
  aspect-ratio: 16 / 9;
  max-height: 340px;
}

.dialog-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  display: block;
}

.dialog-gallery-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dialog-thumbs {
  display: flex;
  gap: 0.5rem;
}

.dialog-thumb {
  padding: 0;
  width: 68px;
  height: 42px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  background: none;
  cursor: pointer;
  opacity: 0.65;
}

.dialog-thumb[aria-current='true'] {
  border-color: var(--accent);
  opacity: 1;
}

.dialog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dialog-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem;
}

.dialog-section {
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
}

.dialog-section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gold);
}

.dialog-section p,
.dialog-section ul {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--ink-muted);
}

.dialog-section ul {
  padding-left: 1.15rem;
  display: grid;
  gap: 0.35rem;
}

.dialog-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

@media (max-width: 960px) {
  .hero-grid,
  .atlas-readout,
  .project-featured,
  .project-band-cols,
  .stack-grid,
  .contact-layout {
    grid-template-columns: 1fr;
  }

  .exp-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

@media (max-width: 720px) {
  .container {
    width: min(1140px, calc(100% - 1.5rem));
  }

  .header-inner {
    gap: 0.45rem;
  }

  .wordmark {
    font-size: 1.05rem;
    gap: 0.38rem;
  }

  .site-nav {
    gap: 0.4rem;
  }

  .site-nav a:not(.btn-outline) {
    display: none;
  }

  .site-nav .btn-outline {
    padding: 0.48rem 0.68rem;
    font-size: 0.8125rem;
  }

  .hero-inner {
    padding-top: 2.3rem;
    padding-bottom: 2.4rem;
  }

  .atlas-canvas {
    aspect-ratio: 4 / 3;
  }

  .map-pin {
    padding: 0.28rem 0.48rem;
    font-size: 0.74rem;
    gap: 0.32rem;
  }

  .pin-mark {
    width: 7px;
    height: 7px;
  }

  .pin-reticle {
    width: 34px;
    height: 34px;
  }

  .map-hud-badge.bottom-left {
    display: none;
  }

  .project-pair,
  .dialog-columns {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
 * Sheikah AI Recruiter Chatbot Widget
 * -------------------------------------------------------------------------- */

.ai-chat-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  font-family: var(--font-sans);
}

.chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.42rem 0.95rem 0.42rem 0.45rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gold) 52%, var(--rule));
  background: var(--paper);
  color: var(--ink);
  box-shadow:
    0 12px 28px rgba(10, 14, 18, 0.22),
    0 0 0 1px color-mix(in srgb, var(--shrine-cyan) 16%, transparent);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.chat-launcher:hover,
.chat-launcher:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow:
    0 16px 34px rgba(10, 14, 18, 0.28),
    0 0 0 2px color-mix(in srgb, var(--shrine-cyan) 28%, transparent);
}

.chat-launcher:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.chat-launcher[aria-expanded='true'] {
  display: none;
}

.chat-launcher-avatar-wrap {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.chat-launcher-avatar-wrap img {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: block;
}

.chat-online-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--shrine-cyan);
  border: 2px solid var(--paper);
  box-shadow: 0 0 8px rgba(58, 184, 234, 0.65);
}

.chat-launcher-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.chat-launcher-copy strong {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.chat-launcher-copy small {
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.chat-panel {
  position: relative;
  width: min(408px, calc(100vw - 1.5rem));
  height: min(610px, calc(100dvh - 2.5rem));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--gold) 52%, var(--rule));
  border-radius: 10px;
  box-shadow:
    0 24px 60px rgba(8, 12, 16, 0.36),
    0 0 0 1px color-mix(in srgb, var(--shrine-cyan) 14%, transparent);
  overflow: hidden;
  animation: chatPanelIn 200ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

.chat-panel[hidden] {
  display: none;
}

@keyframes chatPanelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-inner-frame {
  position: absolute;
  inset: 5px;
  border: 1px solid color-mix(in srgb, var(--gold) 24%, transparent);
  border-radius: 6px;
  pointer-events: none;
}

.chat-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem 0.78rem;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-width: 0;
}

.chat-header-avatar {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  flex-shrink: 0;
  display: block;
}

.chat-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
  line-height: 1.1;
  color: var(--ink);
}

.chat-status {
  margin: 0.22rem 0 0;
  font-size: 0.7rem;
  color: var(--ink-muted);
  letter-spacing: 0.03em;
}

.chat-panel[data-state='thinking'] .chat-status {
  color: var(--accent);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.chat-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.chat-icon-btn:hover,
.chat-icon-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-messages {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.chat-msg {
  max-width: 88%;
  padding: 0.65rem 0.82rem;
  border-radius: 8px;
  font-size: 0.89rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-msg-assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
}

.chat-msg a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-msg-user a {
  color: inherit;
}

.chat-msg code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  padding: 0.08em 0.32em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
}

.chat-msg-thinking {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.chat-prompts {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  padding: 0.45rem 0.95rem 0.55rem;
  border-top: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
}

.chat-prompt-chip {
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.chat-prompt-chip:hover,
.chat-prompt-chip:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-tint);
}

.chat-form {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.5rem;
  padding: 0.72rem 0.95rem 0.85rem;
  background: var(--surface);
  border-top: 1px solid var(--rule);
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: 0.56rem 0.72rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

.chat-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.chat-send {
  padding: 0.52rem 0.92rem;
  font-size: 0.84rem;
  white-space: nowrap;
}

.chat-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .ai-chat-widget {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .chat-launcher-copy small {
    display: none;
  }

  .chat-panel {
    width: calc(100vw - 1.5rem);
    height: min(76dvh, 560px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-panel {
    animation: none;
  }
}
