:root {
  --ink: #0b0b0a;
  --panel: #121210;
  --panel-2: #171714;
  --line: #2b2a25;
  --paper: #f3eee4;
  --stone: #a9a399;
  --stone-dark: #777168;
  --copper: #ef7c32;
  --copper-bright: #ff9a55;
  --link-blue: #4da3ff;
  --green: #97d89b;
  --sans: "Geist", "Helvetica Neue", sans-serif;
  --mono: "Geist Mono", "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
body {
  margin: 0;
  color: var(--paper);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--ink);
  background-size: 72px 72px;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.project-link:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--copper-bright); outline-offset: 4px; }
.shell { width: min(1440px, calc(100% - 72px)); margin-inline: auto; }

.site-header {
  width: min(1440px, calc(100% - 72px));
  height: 100px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand { width: max-content; display: inline-flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--copper);
  font: 700 15px/1 var(--mono);
  clip-path: polygon(0 0,100% 0,100% 70%,70% 100%,0 100%);
}
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 13px; letter-spacing: .05em; white-space: nowrap; }
.gallery-label { color: var(--stone); font: 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.header-link { justify-self: end; display: flex; gap: 12px; font: 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.header-link:hover { color: var(--copper-bright); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 27px;
  color: var(--stone);
  font: 11px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.sample-section { width: min(1180px, calc(100% - 72px)); padding-block: 82px 154px; }
.sample-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 38px 24px; align-items: start; }
.sample-card { min-width: 0; align-self: start; }
.sample-preview { display: block; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #030817; }
.sample-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sample-card > div { padding: 15px 2px 0; }
.sample-card small { color: var(--copper); font: 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.sample-card h3 { margin: 9px 0 7px; font-size: 16px; font-weight: 550; letter-spacing: -.015em; }
.sample-card h3 a:hover { color: var(--copper-bright); }
.sample-card p { margin: 0; color: var(--stone-dark); font-size: 12px; line-height: 1.5; }
.sample-card p .project-link { color: var(--link-blue); }

/* Sample detail */
.sample-page { min-height: 100vh; }
.sample-head {
  width: min(1440px, calc(100% - 72px));
  min-height: 112px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.back-link { color: var(--stone); font: 11px/1 var(--mono); text-transform: uppercase; }
.back-link span { color: var(--copper); }
.sample-heading { text-align: center; }
.sample-heading p { margin: 0 0 7px; color: var(--copper); font: 10px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.sample-heading h1 { margin: 0; font-size: 28px; font-weight: 520; letter-spacing: -.03em; }
.runtime-badge { justify-self: end; display: flex; align-items: center; gap: 9px; color: var(--stone); font: 10px/1 var(--mono); text-transform: uppercase; }
.runtime-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.sample-workbench { width: min(1440px, calc(100% - 72px)); margin-inline: auto; padding: 72px 0 150px; }
.stage { position: relative; }
.stage canvas { display: block; width: 100%; height: min(68vh, 720px); min-height: 480px; border: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.debug-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 174px;
  overflow: hidden;
  color: var(--stone);
  background: rgba(11, 11, 10, .86);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 9px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
  font: 10px/1.3 var(--mono);
}
.debug-toggle {
  width: 100%;
  height: 38px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--paper);
  background: transparent;
  border: 0;
  font: 600 11px/1 var(--mono);
  cursor: pointer;
}
.debug-toggle svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; transform: rotate(180deg); }
.debug-overlay[data-expanded="false"] { width: 88px; }
.debug-overlay[data-expanded="false"] .debug-toggle svg { transform: none; }
.debug-overlay[data-expanded="false"] .debug-metrics { display: none; }
.debug-metrics { padding: 0 13px 13px; display: grid; gap: 5px; }
.debug-metrics b { color: var(--paper); font-size: 13px; font-weight: 600; }
.stage-meta { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 10px 0; }
.stage-meta p { max-width: 760px; margin: 0; color: var(--stone); font-size: 13px; line-height: 1.5; }
.stage-meta p .project-link { color: var(--link-blue); }
#status { color: var(--stone-dark); font: 10px/1.4 var(--mono); }
#status[data-failed="true"] { color: #ff765f; }

.source-panel { margin-top: 80px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.source-toolbar { min-height: 48px; display: flex; align-items: stretch; justify-content: space-between; border-bottom: 1px solid var(--line); }
.copy-button { padding: 9px 12px; color: var(--stone); background: transparent; border: 1px solid var(--line); font: 10px/1 var(--mono); cursor: pointer; }
.copy-button:hover { color: var(--ink); background: var(--copper); border-color: var(--copper); }
.source-tabs { display: flex; padding: 0 22px; }
.source-tabs button { padding: 16px 14px 14px; color: var(--stone-dark); background: none; border: 0; border-bottom: 2px solid transparent; font: 10px/1 var(--mono); cursor: pointer; }
.source-tabs button[aria-selected="true"] { color: var(--copper-bright); border-bottom-color: var(--copper); }
#source-code { max-height: 760px; overflow: auto; display: grid; grid-template-columns: max-content minmax(0, 1fr); margin: 0; padding: 0; color: #d8d1c6; background: #0e0e0c; font: 12px/1.75 var(--mono); tab-size: 2; }
#source-code code { min-width: max-content; padding: 34px 24px 48px; white-space: pre; }
.line-numbers { position: sticky; left: 0; z-index: 1; padding: 34px 14px 48px 18px; color: #4c4b46; background: #0b0b09; border-right: 1px solid #20201c; text-align: right; user-select: none; }
.syntax-comment { color: #686860; font-style: italic; }
.syntax-keyword { color: #ef7c32; }
.syntax-type { color: #e9b979; }
.syntax-string { color: #9fc287; }
.syntax-number { color: #8fb7d8; }
.syntax-preprocessor { color: #c794bc; }
.syntax-attribute { color: #d4a75d; }
.syntax-function { color: #e8ded0; }

.sample-page.embed { overflow: hidden; background: #030817; }
.sample-page.embed .sample-head, .sample-page.embed .debug-overlay, .sample-page.embed .stage-meta, .sample-page.embed .source-panel { display: none; }
.sample-page.embed .sample-workbench { width: 100%; height: 100vh; padding: 0; }
.sample-page.embed .stage { height: 100vh; padding: 0; border: 0; }
.sample-page.embed .stage canvas { width: 100%; height: 100%; min-height: 100vh; border: 0; }

@media (max-width: 980px) {
  .sample-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .shell, .site-header, .sample-head, .sample-workbench { width: min(100% - 32px, 1440px); }
  .site-header { grid-template-columns: 1fr auto; }
  .gallery-label { display: none; }
  .sample-section { padding-block: 64px 92px; }
  .sample-head { grid-template-columns: 1fr auto; padding-block: 20px; }
  .sample-heading { grid-row: 2; grid-column: 1 / -1; margin-top: 24px; }
  .sample-workbench { padding-block: 32px 90px; }
  .stage canvas { height: 56vh; min-height: 320px; }
  .stage-meta { align-items: flex-start; flex-direction: column; }
  .source-panel { margin-top: 48px; }
  .source-tabs { overflow-x: auto; }
  .sample-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
