@import "tailwindcss";
@import "tw-animate-css";
@plugin "@tailwindcss/typography";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-geist-sans);
  --font-mono: var(--font-geist-mono);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --animate-shimmer: shimmer-sweep var(--shimmer-duration, 1000ms) linear
    infinite both;
  @keyframes shimmer-sweep {
    from {
      background-position: 150% 0;
    }
    to {
      background-position: -100% 0;
    }
  }
  --animate-pipeline-running: pipeline-running-glow 1800ms ease-in-out infinite;
  @keyframes pipeline-running-glow {
    0%,
    100% {
      box-shadow:
        0 0 0 1px rgb(52 211 153 / 0.45),
        0 0 0 0 rgb(52 211 153 / 0);
      border-color: rgb(52 211 153 / 0.6);
    }
    50% {
      box-shadow:
        0 0 0 1px rgb(52 211 153 / 0.95),
        0 0 18px 2px rgb(52 211 153 / 0.4);
      border-color: rgb(52 211 153 / 1);
    }
  }
  --animate-pipeline-running-blue: pipeline-running-glow-blue 1800ms ease-in-out
    infinite;
  @keyframes pipeline-running-glow-blue {
    0%,
    100% {
      box-shadow:
        0 0 0 1px rgb(56 189 248 / 0.45),
        0 0 0 0 rgb(56 189 248 / 0);
      border-color: rgb(56 189 248 / 0.7);
    }
    50% {
      box-shadow:
        0 0 0 1px rgb(56 189 248 / 0.95),
        0 0 18px 2px rgb(56 189 248 / 0.45);
      border-color: rgb(56 189 248 / 1);
    }
  }
  --animate-pipeline-progress-shimmer: pipeline-progress-shimmer 1400ms linear
    infinite;
  @keyframes pipeline-progress-shimmer {
    from {
      transform: translateX(-100%);
    }
    to {
      transform: translateX(250%);
    }
  }
  --animate-pipeline-pill-glow: pipeline-pill-glow 1800ms ease-in-out infinite;
  @keyframes pipeline-pill-glow {
    0%,
    100% {
      box-shadow:
        0 0 0 1px rgb(56 189 248 / 0.3),
        0 0 0 0 rgb(56 189 248 / 0);
      border-color: rgb(56 189 248 / 0.45);
    }
    50% {
      box-shadow:
        0 0 0 1px rgb(56 189 248 / 0.7),
        0 0 10px 2px rgb(56 189 248 / 0.35);
      border-color: rgb(56 189 248 / 0.85);
    }
  }
  --animate-pipeline-dot-ping: pipeline-dot-ping 1400ms ease-out infinite;
  @keyframes pipeline-dot-ping {
    0% {
      transform: scale(0.6);
      opacity: 0.9;
    }
    80%,
    100% {
      transform: scale(2.2);
      opacity: 0;
    }
  }
  --animate-icon-spin: icon-spin 3200ms linear infinite;
  @keyframes icon-spin {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
}

.project-doc-page {
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.038) 1px, transparent 1px),
    linear-gradient(180deg, #eef5ff 0%, #f8fafc 42%, #f1fbf7 100%);
  background-size: 34px 34px, 34px 34px, auto;
  color: #1f2937;
}

.project-doc-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(118deg, rgba(37, 99, 235, 0.1), transparent 32%),
    linear-gradient(250deg, rgba(20, 184, 166, 0.08), transparent 38%);
  pointer-events: none;
}

.project-doc-page > * {
  position: relative;
  z-index: 1;
}

.project-doc-page a {
  color: inherit;
  text-decoration: none;
}

.project-doc-nav,
.project-doc-hero-inner,
.project-doc-section {
  max-width: 1120px;
  margin: 0 auto;
}

.project-doc-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 30px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.12);
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(226, 239, 255, 0.92) 58%, rgba(236, 253, 245, 0.9));
  background-size: 36px 36px, 36px 36px, auto;
  color: #0f172a;
}

.project-doc-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(37, 99, 235, 0.12), transparent 44%),
    linear-gradient(270deg, rgba(15, 118, 110, 0.1), transparent 42%);
  pointer-events: none;
}

.project-doc-hero::after {
  content: none;
  position: absolute;
  right: max(22px, calc((100vw - 1120px) / 2));
  bottom: -34px;
  width: 430px;
  height: 260px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(20, 184, 166, 0.1)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 18px);
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
  opacity: 0.9;
  pointer-events: none;
  transform: rotate(-4deg);
}

.project-doc-nav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
}

.project-doc-nav > a {
  color: #0f172a;
  font-weight: 850;
}

.project-doc-nav div {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: #475569;
  font-size: 13px;
  font-weight: 750;
}

.project-doc-hero-inner {
  position: relative;
  z-index: 1;
  padding: 72px 28px 44px;
}

.project-doc-kicker {
  margin: 0 0 14px;
  color: #2563eb;
  font-size: 13px;
  font-weight: 850;
}

.project-doc-hero h1 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(44px, 6vw, 82px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 18px 42px rgba(37, 99, 235, 0.12);
}

.project-doc-hero p:not(.project-doc-kicker) {
  max-width: 820px;
  margin: 24px 0 0;
  color: #475569;
  font-size: 19px;
  line-height: 1.8;
}

.project-doc-section {
  position: relative;
  padding: 58px 28px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.project-doc-section-head {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
}

.project-doc-section-head > span {
  display: grid;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.18);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 850;
}

.project-doc-section-head h2 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 900;
  line-height: 1.14;
}

.project-doc-section-head p {
  max-width: 880px;
  margin: 12px 0 0;
  color: #4b5563;
  font-size: 16px;
  line-height: 1.72;
}

.project-doc-overview-grid,
.project-doc-grid,
.project-doc-index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.project-doc-overview-grid div,
.project-doc-grid div,
.project-doc-index div,
.project-doc-list div,
.project-doc-runtime div {
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.72));
  box-shadow:
    0 18px 46px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.project-doc-overview-grid h3,
.project-doc-grid h3,
.project-doc-index h3,
.project-doc-runtime h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.project-doc-overview-grid p,
.project-doc-grid p,
.project-doc-list p,
.project-doc-runtime p {
  margin: 0;
  color: #4b5563;
  line-height: 1.68;
}

.project-doc-position {
  max-width: 1240px;
  padding-top: 44px;
}

.position-framing {
  display: grid;
  gap: 28px;
  margin: 0 0 30px;
  padding: 20px 0 22px;
}

.position-framing-copy > span,
.position-friction-cloud strong {
  color: #2563eb;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
}

.position-framing-copy h3 {
  margin: 18px 0 18px;
}

.position-framing-copy p,
.position-dimension-grid p {
  margin: 0;
  color: #4b5563;
  line-height: 1.72;
}

.position-framing-copy p {
  max-width: 760px;
}

.position-framing-copy {
  display: grid;
  justify-items: center;
  text-align: center;
}

.position-formula {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  gap: clamp(4px, 0.75vw, 9px);
  color: #0f172a;
  font-size: clamp(22px, 3.08vw, 40px);
  font-weight: 950;
  line-height: 1.15;
  white-space: nowrap;
}

.position-formula span {
  display: inline-flex;
}

.position-formula b {
  color: #2563eb;
  font-family: var(--font-mono);
  font-size: 0.62em;
  font-weight: 900;
}

.position-dimension-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 34px;
  margin-top: 2px;
}

.position-dimension-grid div {
  display: grid;
  gap: 8px;
  border-top: 2px solid rgba(37, 99, 235, 0.18);
  padding-top: 12px;
}

.position-dimension-grid strong {
  color: #0f172a;
  font-size: clamp(18px, 1.8vw, 24px);
  font-weight: 950;
  line-height: 1.05;
}

.position-dimension-grid p {
  font-size: 14px;
}

.position-friction-cloud {
  position: relative;
  display: flex;
  min-height: 178px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px 30px;
  margin: 0 auto;
  padding: 26px 46px 32px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.065) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 24% 30%, rgba(37, 99, 235, 0.16), transparent 30%),
    radial-gradient(circle at 76% 68%, rgba(16, 185, 129, 0.13), transparent 32%),
    rgba(255, 255, 255, 0.74);
  background-size: 28px 28px, 28px 28px, auto, auto, auto;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
  color: #64748b;
  line-height: 1.2;
  overflow: hidden;
  backdrop-filter: blur(14px);
}

.position-friction-cloud::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px dashed rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  pointer-events: none;
}

.position-friction-cloud strong {
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 1;
}

.position-friction-cloud span {
  position: relative;
  z-index: 1;
  color: #64748b;
  font-weight: 800;
  letter-spacing: 0;
}

.position-friction-cloud .is-weight-1 {
  color: #94a3b8;
  font-size: 15px;
}

.position-friction-cloud .is-weight-2 {
  color: #64748b;
  font-size: 18px;
}

.position-friction-cloud .is-weight-3 {
  color: #334155;
  font-size: 24px;
}

.position-friction-cloud .is-weight-4 {
  color: #1d4ed8;
  font-size: 32px;
  font-weight: 950;
}

.position-friction-cloud .is-weight-5 {
  color: #1e40af;
  font-size: clamp(36px, 4vw, 50px);
  font-weight: 950;
}

.position-friction-cloud span:nth-of-type(2n) {
  transform: translateY(8px);
}

.position-friction-cloud span:nth-of-type(3n) {
  transform: translateY(-8px);
}

.position-friction-cloud span:nth-of-type(5n) {
  transform: translateY(4px) rotate(-1deg);
}

.position-friction-cloud em {
  flex-basis: 100%;
  position: relative;
  z-index: 1;
  color: #2563eb;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  margin-top: 2px;
  text-align: center;
}

.position-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.72fr);
  gap: 18px;
}

.position-stage-card,
.position-detail-card {
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(241, 245, 249, 0.7));
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
}

.position-stage-card {
  overflow: hidden;
}

.position-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.12);
  padding: 16px 18px;
}

.position-controls div:first-child {
  display: grid;
  gap: 4px;
}

.position-controls span,
.position-score span,
.position-meter-list span,
.position-detail-card dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.position-controls strong {
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 12px;
}

.position-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.position-preset-row button {
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  padding: 7px 9px;
}

.position-preset-row button.is-selected {
  border-color: rgba(37, 99, 235, 0.54);
  background: #2563eb;
  color: #ffffff;
}

.position-stage {
  position: relative;
  display: grid;
  min-height: 560px;
  place-items: center;
  background:
    radial-gradient(circle at 74% 18%, rgba(37, 99, 235, 0.22), transparent 28%),
    radial-gradient(circle at 16% 82%, rgba(16, 185, 129, 0.16), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.88) 0%, rgba(226, 237, 250, 0.96) 100%);
  cursor: grab;
  perspective: 950px;
  touch-action: none;
  user-select: none;
}

.position-stage.is-dragging {
  cursor: grabbing;
}

.position-scene {
  position: relative;
  display: grid;
  width: 560px;
  height: 560px;
  place-items: center;
}

.position-space-grid,
.position-tool-layer {
  position: absolute;
  inset: 0;
}

.position-space-grid {
  opacity: 0.82;
  background:
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.11), transparent 42%),
    linear-gradient(90deg, rgba(15, 23, 42, 0.085) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.085) 1px, transparent 1px);
  background-size: auto, 56px 56px, 56px 56px;
  mask-image: radial-gradient(circle at 50% 50%, #000 0 66%, transparent 78%);
  pointer-events: none;
}

.position-tool-layer {
  z-index: 6;
  overflow: visible;
  pointer-events: none;
}

.position-tool-anchor {
  position: absolute;
  left: var(--tool-x);
  top: var(--tool-y);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: #0f172a;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(var(--label-scale));
  transition:
    filter 140ms ease,
    transform 140ms ease;
  white-space: nowrap;
}

.position-ball {
  display: block;
  width: 24px;
  height: 24px;
  border: 1px solid color-mix(in srgb, var(--point-color) 54%, white);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 26%, #ffffff 0 9%, transparent 10%),
    radial-gradient(circle at 34% 30%, color-mix(in srgb, var(--point-color) 38%, white), transparent 24%),
    color-mix(in srgb, var(--point-color) 82%, white);
  box-shadow:
    inset -5px -7px 11px color-mix(in srgb, var(--point-color) 45%, #0f172a),
    inset 4px 5px 9px rgba(255, 255, 255, 0.5),
    0 14px 26px rgba(15, 23, 42, 0.2),
    0 0 0 7px color-mix(in srgb, var(--point-color) 15%, transparent);
}

.position-tool-label {
  border: 1px solid color-mix(in srgb, var(--point-color) 18%, white);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
  font-size: 11px;
  font-weight: 900;
  padding: 4px 7px;
  text-shadow: 0 1px 0 #ffffff;
}

.position-tool-anchor.is-hovered,
.position-tool-anchor.is-selected {
  filter: saturate(1.25);
  transform: translate(-50%, -50%) scale(var(--label-scale));
}

.position-tool-anchor.is-hovered .position-tool-label,
.position-tool-anchor.is-selected .position-tool-label {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.16);
}

.position-axis-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.position-axis-overlay line {
  stroke-linecap: round;
  stroke-width: 2.4;
  filter: drop-shadow(0 5px 12px rgba(15, 23, 42, 0.16));
}

.position-axis-label-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.position-axis-label {
  position: absolute;
  left: var(--axis-label-x);
  top: var(--axis-label-y);
  border: 1px solid color-mix(in srgb, var(--axis-color) 22%, white);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: color-mix(in srgb, var(--axis-color) 76%, #0f172a);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  padding: 5px 8px;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.position-detail-card {
  align-self: stretch;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.position-detail-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, #2563eb, #14b8a6, #9333ea);
  pointer-events: none;
}

.position-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.position-score strong {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #10b981);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 22px;
}

.position-detail-card h3 {
  margin: 24px 0 12px;
  font-size: 28px;
  font-weight: 950;
  line-height: 1.12;
}

.position-detail-card p {
  margin: 0;
  color: #475569;
  line-height: 1.72;
}

.position-meter-list {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.position-meter-list div {
  display: grid;
  gap: 7px;
}

.position-meter-list div::after {
  content: "";
  display: block;
  height: 9px;
  border-radius: 999px;
  background: #e2e8f0;
}

.position-meter-list i {
  display: block;
  height: 9px;
  margin-bottom: -16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #2563eb, #10b981);
  position: relative;
  z-index: 1;
}

.position-detail-card dl {
  display: grid;
  gap: 16px;
  margin: 0;
}

.position-detail-card dd {
  margin: 6px 0 0;
  color: #334155;
  line-height: 1.65;
}

.project-doc-figure {
  display: block;
  overflow: hidden;
  margin: 22px 0;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.055) 1px, transparent 1px),
    #ffffff;
  background-size: 28px 28px, 28px 28px, auto;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.1);
}

.project-doc-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.project-doc-point {
  position: relative;
  padding-left: 18px;
}

.project-doc-point::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #2563eb;
}

.project-doc-grid code,
.project-doc-index code,
.project-doc-list code {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 8px 0;
  border-radius: 7px;
  background: #eff6ff;
  padding: 6px 8px;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.project-doc-link {
  display: inline-flex;
  margin-top: 14px;
  border: 1px solid rgba(37, 99, 235, 0.3);
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff, #ecfeff);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
  padding: 9px 12px;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 850;
}

.project-doc-link:hover,
.project-doc-back-link:hover {
  border-color: rgba(37, 99, 235, 0.44);
  background: #dbeafe;
}

.project-doc-runtime {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.project-doc-runtime div {
  min-height: 170px;
  position: relative;
  overflow: hidden;
}

.project-doc-runtime div::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 90px;
  height: 90px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 999px;
}

.project-doc-runtime span {
  color: #2563eb;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 850;
}

.project-doc-list {
  display: grid;
  gap: 10px;
}

.project-doc-list div {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: center;
}

.project-doc-index {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.project-doc-session-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.project-doc-session-card {
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 249, 255, 0.7)),
    #ffffff;
  box-shadow:
    0 20px 52px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
  padding: 20px;
}

.project-doc-session-card h3 {
  margin: 0 0 10px;
  font-size: 20px;
}

.project-doc-session-card p {
  min-height: 54px;
  margin: 0 0 16px;
  color: #4b5563;
  line-height: 1.65;
}

.project-doc-session-card div {
  display: grid;
  gap: 8px;
}

.project-doc-session-card a {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
  padding: 9px 10px;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.project-doc-session-card a:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.32);
  background: #eff6ff;
}

.project-doc-session-card a span {
  display: grid;
  width: 28px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 11px;
}

.project-doc-detail-hero {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background:
    linear-gradient(115deg, rgba(15, 23, 42, 0.94), rgba(30, 58, 138, 0.78)),
    #0b1220;
  color: #f8fafc;
}

.project-doc-detail-head,
.project-doc-detail-shell {
  max-width: 980px;
  margin: 0 auto;
}

.project-doc-detail-head {
  padding: 54px 28px 46px;
}

.project-doc-detail-head h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(34px, 4.5vw, 58px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
}

.project-doc-back-link {
  display: inline-flex;
  margin-top: 22px;
  border: 1px solid rgba(226, 232, 240, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  padding: 9px 12px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 850;
}

.project-doc-detail-shell {
  padding: 40px 28px 84px;
}

.project-doc-article {
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: clamp(28px, 4.4vw, 56px);
}

.project-doc-article h1 {
  margin: 0 0 24px;
  color: #111827;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 900;
  line-height: 1.15;
}

.project-doc-article h2 {
  margin: 42px 0 16px;
  border-top: 1px solid rgba(31, 41, 55, 0.12);
  padding-top: 30px;
  color: #111827;
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 900;
  line-height: 1.24;
}

.project-doc-article h3 {
  margin: 30px 0 12px;
  color: #1f2937;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.32;
}

.project-doc-article h4,
.project-doc-article h5,
.project-doc-article h6 {
  margin: 18px 0 8px;
  color: #1f2937;
  font-size: 16px;
  font-weight: 850;
}

.project-doc-article p,
.project-doc-article li {
  color: #374151;
  font-size: 17px;
  line-height: 1.88;
}

.project-doc-article p {
  margin: 12px 0;
}

.project-doc-article ul,
.project-doc-article ol {
  margin: 14px 0 20px 24px;
  padding: 0;
}

.project-doc-article li {
  margin: 7px 0;
}

.project-doc-article a {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.project-doc-article code {
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 6px;
  background: #eff6ff;
  padding: 2px 5px;
  color: #1d4ed8;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.project-doc-code-block > div {
  margin-top: 22px;
  border-color: rgba(31, 41, 55, 0.16);
  border-radius: 10px 10px 0 0;
  background: #f8fafc;
  border: 1px solid rgba(31, 41, 55, 0.16);
  border-bottom: 0;
  padding: 8px 12px;
  color: #6b7280;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 750;
}

.project-doc-code-block pre {
  margin: 0 0 22px;
  border: 1px solid rgba(31, 41, 55, 0.16);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 13px;
  line-height: 1.78;
  overflow-x: auto;
  padding: 18px;
}

.project-doc-code-block pre code {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.project-doc-article table {
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 10px;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.project-doc-article th {
  background: #f3f4f6;
  color: #111827;
  text-align: left;
}

.project-doc-article td,
.project-doc-article th {
  border-bottom: 1px solid rgba(31, 41, 55, 0.12);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.55;
}

.project-doc-article tr:last-child td {
  border-bottom: 0;
}

.project-doc-article blockquote {
  margin: 18px 0;
  border-left: 3px solid #2563eb;
  background: #eff6ff;
  padding: 12px 16px;
  color: #374151;
}

.project-doc-article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 8px 0 32px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
}

.project-doc-page .project-doc-hero {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(226, 239, 255, 0.94) 58%, rgba(236, 253, 245, 0.92)) !important;
  background-size: 36px 36px, 36px 36px, auto !important;
  color: #0f172a !important;
}

.project-doc-page .project-doc-hero::before {
  background:
    linear-gradient(115deg, rgba(37, 99, 235, 0.1), transparent 44%),
    linear-gradient(270deg, rgba(15, 118, 110, 0.08), transparent 42%) !important;
}

.project-doc-page .project-doc-hero::after {
  display: none !important;
}

.project-doc-page .project-doc-hero h1,
.project-doc-page .project-doc-nav > a {
  color: #0f172a !important;
}

.project-doc-page .project-doc-hero p:not(.project-doc-kicker),
.project-doc-page .project-doc-nav div {
  color: #475569 !important;
}

.project-doc-page .project-doc-position {
  border-top: 1px solid rgba(37, 99, 235, 0.12);
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(238, 245, 255, 0.92));
  background-size: 34px 34px, 34px 34px, auto;
  box-shadow: 0 0 0 100vmax rgba(248, 250, 252, 0.96);
  clip-path: inset(0 -100vmax);
}

@media (max-width: 1000px) {
  .position-map-layout {
    grid-template-columns: 1fr;
  }

  .position-dimension-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .project-doc-overview-grid,
  .project-doc-grid,
  .project-doc-runtime,
  .project-doc-session-grid,
  .project-doc-index {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .project-doc-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .position-dimension-grid div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .position-formula {
    flex-wrap: wrap;
    justify-content: flex-start;
    text-align: left;
    white-space: normal;
  }

  .position-framing-copy {
    justify-items: start;
    text-align: left;
  }

  .position-friction-cloud {
    justify-content: flex-start;
    min-height: 0;
    padding-left: 0;
    padding-right: 0;
    border: 0;
    background: transparent;
  }

  .position-friction-cloud em {
    text-align: left;
  }

  .project-doc-section-head,
  .project-doc-overview-grid,
  .project-doc-grid,
  .project-doc-runtime,
  .project-doc-index,
  .project-doc-session-grid,
  .project-doc-list div {
    grid-template-columns: 1fr;
  }

  .project-doc-session-card p {
    min-height: 0;
  }
}

:root {
  --radius: 0.625rem;
  --background: oklch(1 0 0);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.21 0.006 285.885);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.967 0.001 286.375);
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.705 0.015 286.067);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.141 0.005 285.823);
  --sidebar-primary: oklch(0.21 0.006 285.885);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.967 0.001 286.375);
  --sidebar-accent-foreground: oklch(0.21 0.006 285.885);
  --sidebar-border: oklch(0.92 0.004 286.32);
  --sidebar-ring: oklch(0.705 0.015 286.067);
}

.dark {
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.21 0.006 285.885);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.92 0.004 286.32);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.552 0.016 285.938);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.21 0.006 285.885);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.274 0.006 286.033);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.552 0.016 285.938);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  :root {
    color-scheme: light;
  }

  :root.dark {
    color-scheme: dark;
  }

  body {
    @apply bg-background text-foreground;
  }
}
