@font-face {
  font-family: 'Google Sans Flex';
  src: url('google%20font/GoogleSansFlex-VariableFile_GRAD,ROND,opsz,slnt,wdth,wght.ttf') format('truetype');
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Google Sans Flex';
  src: url('google%20font/GoogleSansFlex-VariableFile_GRAD,ROND,opsz,slnt,wdth,wght.ttf') format('truetype');
  font-weight: 100 1000;
  font-style: italic;
  font-display: swap;
}

:root {
  --canvas: #0a0f1d;
  --surface: #111827;
  --surface-2: #1f2937;
  --surface-3: #374151;
  --bone: #f9fafb;
  --muted: #9ca3af;
  --dim: #6b7280;
  --line: rgba(249, 250, 251, 0.1);
  --line-soft: rgba(249, 250, 251, 0.05);
  --accent: #10b981;
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --sans: 'Google Sans Flex', system-ui, -apple-system, sans-serif;
  --mono: 'Google Sans Flex', 'Courier New', monospace;
  --serif: 'Google Sans Flex', Georgia, serif;
  --shell: min(1200px, calc(100% - 48px));
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2147483647;
  transform: translate(-50%, -50%);
  will-change: transform, left, top;
}

body.has-custom-cursor,
body.has-custom-cursor * {
  cursor: none !important;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.cursor-ring {
  width: 40px;
  height: 40px;
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  border-radius: 50%;
  transition: width 0.15s ease, height 0.15s ease, border-color 0.15s ease;
}

.cursor-ring.active {
  width: 60px;
  height: 60px;
  border-color: rgba(16, 185, 129, 0.7);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent-gradient);
  z-index: 10000;
  transition: width 0.1s linear;
}

.mouse-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.06) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  z-index: 1;
  transition: opacity 0.3s ease;
}

[data-scramble] {
  min-height: 1.2em;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 32px 32px;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

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

.skip-link {
  position: fixed;
  z-index: 20;
  top: -60px;
  left: 20px;
  padding: 10px 16px;
  background: var(--accent);
  color: #0a0f1d;
  font-weight: 600;
  font-size: 14px;
  border-radius: 6px;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 16px;
}

/* Header */
.site-header {
  position: sticky;
  z-index: 2147483647;
  top: 0;
  min-height: 76px;
  padding: 0 max(24px, calc((100vw - 1200px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(10, 15, 29, 0.9);
  backdrop-filter: blur(16px);
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent) 70%, transparent 100%);
  opacity: 0.4;
  animation: header-glow 3s ease-in-out infinite;
  pointer-events: none;
}

.site-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.04), transparent);
  animation: header-scan 5s linear infinite;
  pointer-events: none;
}

@keyframes header-glow {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.7; }
}

@keyframes header-scan {
  0% { left: -60%; }
  100% { left: 160%; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.brand::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent), 0 0 12px rgba(16, 185, 129, 0.4);
  animation: brand-dot-pulse 2s ease-in-out infinite;
}

@keyframes brand-dot-pulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50% { opacity: 0.4; transform: translateY(-50%) scale(0.7); }
}

.brand-mark {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.15), 0 0 16px rgba(16, 185, 129, 0.1);
  transition: box-shadow 0.4s var(--ease);
}

.brand:hover .brand-mark {
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35), 0 0 28px rgba(16, 185, 129, 0.25);
}

.brand-copy {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--bone);
}

.desktop-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.desktop-nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
  padding: 4px 0;
}

.desktop-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-gradient);
  transition: width 0.35s var(--ease);
}

.desktop-nav a:hover,
.desktop-nav a:focus-visible {
  color: var(--bone);
}

.desktop-nav a:hover::after,
.desktop-nav a:focus-visible::after {
  width: 100%;
}

.desktop-nav a.is-active {
  color: var(--accent);
}

.desktop-nav a.is-active::after {
  width: 100%;
}

.header-actions-end {
  display: flex;
  align-items: center;
}

.header-github {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.04);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.header-github::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.header-github:hover,
.header-github:focus-visible {
  color: var(--bone);
  border-color: var(--accent);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.15);
}

.header-github:hover::before,
.header-github:focus-visible::before {
  opacity: 1;
}

.menu-toggle,
.mobile-nav {
  display: none;
}

/* Hero */
.hero {
  padding: 56px 0 40px;
}

.hero-meta {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  font-family: var(--mono);
}

.hero-rule {
  flex: 1;
  border-top: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 6%;
  align-items: center;
  padding: 40px 0 32px;
}

.hero-index {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  border-top: 1px solid var(--line);
  padding: 18px 0 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  font-family: var(--mono);
}

.hero-index span:last-child {
  text-align: right;
  color: var(--accent);
  font-weight: 600;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.4rem, 4.5vw, 4.2rem);
  max-width: 740px;
}

h1 em,
h2 em {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
}

.hero-lede {
  max-width: 480px;
  margin: 20px 0 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.hero-actions,
.contact-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-note {
  align-self: end;
  padding-bottom: 8px;
}

.note-number {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
}

.hero-note p {
  margin: 10px 0 16px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.4;
}

.note-line {
  width: 40px;
  border-top: 1px solid var(--accent);
  margin-bottom: 8px;
}

.note-caption {
  font-size: 12px;
  font-weight: 500;
  color: var(--dim);
  font-family: var(--mono);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: transform 0.2s var(--ease), background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
}

.button-dark {
  background: var(--bone);
  color: var(--canvas);
}

.button-light {
  background: var(--accent-gradient);
  color: #0a0f1d;
}

.text-link {
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.text-link span,
.button span {
  color: var(--accent);
}

.button-dark span {
  color: var(--canvas);
}

/* Sections */
.section {
  padding: 64px 0;
}

.section + .section {
  border-top: 1px solid var(--line-soft);
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 0 auto;
  width: 60%;
}

.section-kicker {
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  font-family: var(--mono);
}

.section-heading {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: end;
  margin-bottom: 40px;
}

h2 {
  font-size: clamp(2rem, 3.2vw, 3.2rem);
  margin-top: 6px;
}

.section-intro {
  max-width: 380px;
  justify-self: end;
  color: var(--muted);
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
}

.section-more {
  margin-top: 40px;
  text-align: center;
}

/* Live Grid */
.live-section {
  padding: 40px 0 64px;
  border-top: 1px solid var(--line);
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.live-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.live-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.live-card-preview {
  position: relative;
  min-height: 300px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.live-card-preview .preview-frame {
  min-height: 300px;
}

.live-card-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.live-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--dim);
  font-family: var(--mono);
  margin-bottom: 12px;
}

.live-card-index {
  color: var(--accent);
  font-weight: 600;
}

.live-card-body h3 {
  margin: 0 0 10px;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.live-card-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  flex: 1;
}

.live-card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.live-card-actions a,
.live-card-inspect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: transform 0.2s var(--ease), background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.live-card-actions a {
  background: var(--accent-gradient);
  color: #0a0f1d;
  border: 0;
}

.live-card-actions a:hover {
  transform: translateY(-2px);
}

.live-card-inspect {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  cursor: pointer;
}

.live-card-inspect:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.bento-card {
  grid-column: span 6;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.bento-card.bento-large {
  grid-column: span 12;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.bento-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.bento-preview {
  position: relative;
  min-height: 260px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.bento-card.bento-large .bento-preview {
  border-bottom: 0;
  border-right: 1px solid var(--line);
  min-height: 100%;
}

.bento-content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

.bento-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--dim);
  font-family: var(--mono);
  margin-bottom: 12px;
}

.bento-index {
  color: var(--accent);
  font-weight: 600;
}

.bento-badge {
  font-size: 12px;
  font-family: var(--mono);
}

.bento-content h3 {
  margin: 0 0 12px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.bento-card.bento-large .bento-content h3 {
  font-size: 1.9rem;
}

.bento-content p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.bento-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.bento-tags span {
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--mono);
  color: var(--muted);
}

.bento-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
  margin-top: auto;
}

.project-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  background: var(--accent-gradient);
  color: #0a0f1d;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.project-links a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.project-links a:hover {
  color: #0a0f1d;
}

.bento-inspect {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 6px;
  font-family: var(--mono);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.bento-inspect:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Preview Widgets */
.preview-frame {
  position: relative;
  height: 100%;
  min-height: 260px;
  overflow: hidden;
  background: var(--surface);
}

.preview-caption {
  position: absolute;
  z-index: 1;
  inset: 16px 16px auto;
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
}

.preview-caption strong {
  color: var(--accent);
  font-weight: 600;
}

.preview-action {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: 16px;
  border: 1px solid var(--line);
  background: var(--canvas);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
  border-radius: 6px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.preview-action:hover,
.preview-action:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.voxel-preview {
  background: #0f172a;
}

.voxel-preview canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.voxel-preview canvas:active {
  cursor: grabbing;
}

.voxel-note {
  position: absolute;
  left: 16px;
  bottom: 16px;
  color: rgba(249, 250, 251, 0.6);
  font-size: 12px;
  font-family: var(--mono);
}

.wage-preview {
  padding: 56px 24px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #111827;
}

.wage-big {
  font-size: 2.3rem;
  letter-spacing: -0.04em;
  line-height: 1;
  font-weight: 600;
}

.wage-big small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 400;
  margin-top: 6px;
}

.wage-track {
  position: relative;
  height: 4px;
  background: var(--surface-3);
  margin: 24px 0 10px;
  border-radius: 2px;
}

.wage-track::before {
  content: '';
  display: block;
  width: var(--progress, 55%);
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.wage-thumb {
  position: absolute;
  top: -6px;
  left: var(--progress, 55%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  background: var(--surface);
  border-radius: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.wage-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: ew-resize;
}

.wage-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}

.rule-preview {
  display: grid;
  place-items: center;
  background: #064e3b;
  padding: 56px 24px 24px;
}

.arabic {
  color: #a7f3d0;
  font-size: 3.5rem;
  font-family: serif;
  direction: rtl;
}

.rule-name {
  margin-top: 14px;
  color: var(--bone);
  font-size: 13px;
  font-weight: 600;
}

.rule-switch {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
}

.rule-switch button {
  flex: 1;
  padding: 6px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--muted);
  border-radius: 6px;
}

.rule-switch button.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

.folio-preview {
  background: #1e293b;
  padding: 44px 24px 24px;
  color: #f9fafb;
  display: grid;
  place-items: center;
}

.compass-preview {
  background: linear-gradient(135deg, #064e3b 0%, #0a0f1d 100%);
  display: grid;
  place-items: center;
  position: relative;
}

.compass-ring {
  width: 120px;
  height: 120px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  position: relative;
  animation: compass-pulse 3s ease-in-out infinite;
}

.compass-ring::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.compass-arrow {
  position: absolute;
  top: 28px;
  color: var(--accent);
  font-size: 24px;
  font-weight: 700;
}

.compass-label {
  position: absolute;
  bottom: 28px;
  color: var(--bone);
  font-size: 14px;
  font-weight: 600;
}

@keyframes compass-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}

.extension-preview {
  background: #1a1d28;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.extension-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-gradient);
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #0a0f1d;
}

.extension-name {
  color: var(--bone);
  font-size: 16px;
  font-weight: 600;
}

.extension-desc {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 900px) {
  .compass-ring {
    width: 90px;
    height: 90px;
  }
}

.folio-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 82%;
  max-height: 70%;
  aspect-ratio: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.folio-page {
  background: #0f172a;
  padding: 12px 10px;
  overflow: hidden;
  border-right: 1px solid #334155;
}

.folio-page:last-child {
  border: 0;
}

.folio-page::before {
  content: '';
  display: block;
  height: 100%;
  opacity: 0.35;
  background: repeating-linear-gradient(to bottom, transparent 0 6px, #475569 7px 8px, transparent 9px 12px);
}

.folio-center {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 60%;
  background: rgba(255, 255, 255, 0.2);
}

/* Archive Section */
.archive-section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}

.archive-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  font-family: var(--mono);
}

.archive-filters {
  display: flex;
  gap: 8px;
}

.filter-button {
  padding-inline: 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 500;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.filter-button.is-active {
  background: var(--bone);
  color: var(--canvas);
  font-weight: 600;
}

.ledger-wrap {
  overflow-x: auto;
  margin-top: 24px;
}

.ledger {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  padding: 16px 14px;
  font-size: 14px;
}

th {
  color: var(--dim);
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 600;
}

td:first-child,
td:nth-child(4) {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

td:nth-child(2) {
  font-weight: 600;
}

.row-links {
  display: flex;
  gap: 16px;
}

.row-links a {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

.github-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.github-section {
  padding: 64px 0;
  border-top: 1px solid var(--line);
}

.contact-section h2 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  margin: 24px 0;
}

.contact-lede {
  max-width: 440px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.5;
  margin-bottom: 28px;
}

.text-link-light {
  color: var(--muted);
}

/* Footer */
.site-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 24px 0 28px;
  font-size: 14px;
  color: var(--dim);
  font-family: var(--mono);
}

.site-footer b {
  color: var(--bone);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
}

/* Dialog Modal */
.project-dialog {
  width: min(860px, calc(100% - 32px));
  max-height: min(820px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--bone);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.project-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.dialog-inner {
  padding: 32px 40px 44px;
}

.dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.dialog-close {
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  padding: 8px 14px;
  font-size: 13px;
  font-family: var(--mono);
  font-weight: 500;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.dialog-close:hover {
  color: var(--accent);
  background: var(--surface-3);
}

.dialog-close span {
  font-size: 16px;
  margin-left: 6px;
}

.dialog-title {
  font-size: clamp(2rem, 4.5vw, 3.8rem);
  margin: 28px 0 16px;
}

.dialog-body {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.friction {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line-soft);
  margin-top: 28px;
  background: var(--surface-2);
  border-radius: 12px;
  overflow: hidden;
}

.friction > div {
  padding: 20px;
}

.friction > div + div {
  border-left: 1px solid var(--line-soft);
}

.friction-label {
  display: block;
  margin-bottom: 6px;
  color: var(--dim);
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
}

.friction p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.friction > div:last-child p {
  color: var(--bone);
}

.dialog-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  margin-top: 32px;
}

.dialog-spec {
  padding: 16px 16px 16px 0;
  border-bottom: 1px solid var(--line-soft);
}

.dialog-spec:nth-child(even) {
  padding-left: 16px;
  border-left: 1px solid var(--line-soft);
}

.dialog-spec label {
  display: block;
  color: var(--dim);
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
  margin-bottom: 6px;
}

.dialog-spec span {
  font-size: 15px;
}

/* Toast */
.toast {
  position: fixed;
  z-index: 30;
  right: 20px;
  bottom: 20px;
  padding: 12px 18px;
  background: var(--bone);
  color: var(--canvas);
  transform: translateY(90px);
  transition: transform 0.25s var(--ease);
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toast.is-visible {
  transform: translateY(0);
}

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

.reveal {
  opacity: 1;
  transform: none;
}

@media (min-width: 901px) {
  .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
  }
  .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 900px) {
  :root {
    --shell: min(100% - 36px, 680px);
  }
  .site-header {
    padding: 0 18px;
    z-index: 2147483647;
  }
  .brand {
    min-width: 0;
    flex: 1;
  }
  .header-actions-end {
    display: none;
  }
  .desktop-nav {
    display: none;
  }
  .menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
  }
  .menu-toggle span {
    display: block;
    width: 14px;
    border-top: 2px solid var(--bone);
  }
  .mobile-nav {
    position: fixed;
    z-index: 9;
    inset: 76px 0 auto;
    display: none;
    flex-direction: column;
    border-bottom: 1px solid var(--line);
    background: var(--canvas);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }
  .mobile-nav.is-open {
    display: flex;
  }
  .mobile-nav a {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 15px;
    font-weight: 500;
  }
  .hero {
    padding: 44px 0 28px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 28px 0;
  }
  h1 {
    font-size: clamp(2.2rem, 8.5vw, 3.8rem);
  }
  .hero-note {
    justify-self: start;
    max-width: 280px;
  }
  .section,
  .archive-section,
  .contact-section {
    padding: 56px 0;
  }
  .section-heading {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 32px;
  }
  .section-intro {
    justify-self: start;
    font-size: 18px;
  }
  .bento-card,
  .bento-card.bento-large {
    grid-column: span 12;
    display: flex;
    flex-direction: column;
  }
  .bento-card.bento-large .bento-preview {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 250px;
  }
  .contact-section h2 {
    font-size: clamp(2.4rem, 9vw, 4.5rem);
  }
  .dialog-inner {
    padding: 24px 20px 32px;
  }
  .dialog-specs {
    grid-template-columns: 1fr;
  }
  .dialog-spec:nth-child(even) {
    padding-left: 0;
    border-left: 0;
  }
  .friction {
    grid-template-columns: 1fr;
  }
  .friction > div + div {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }
  .live-grid {
    grid-template-columns: 1fr;
  }
  .live-card-preview {
    min-height: 260px;
  }
  .live-card-preview .preview-frame {
    min-height: 260px;
  }
}

@media (max-width: 520px) {
  :root {
    --shell: calc(100% - 24px);
  }
  .site-header {
    padding: 0 14px;
  }
  .preview-frame {
    min-height: 220px;
  }
  .archive-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }
  .archive-filters {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
