/* The Keel landing page. Tokens follow the Keel design system: dark by default, square corners,
   Archivo for text, JetBrains Mono for code. */
:root, [data-theme="dark"] {
  --color-bg: #0B1520; --color-surface: #101D2C; --k-deep: #07101A; --k-raised: #162638;
  --color-text: #E6ECF2; --k-muted: #94A3B4; --color-accent: #3DD6C3; --color-accent-600: #66E0D1;
  --color-accent-700: #8FE9DE; --color-divider: #2C3F56; --k-rule: #18273A; --k-grid: rgba(148,163,180,0.07);
  --k-code-bg: #040B12; --k-code-text: #D3DCE6; --syn-kw: #3DD6C3; --syn-attr: #D4A856; --syn-type: #8DB8E8;
  --syn-str: #D4A856; --syn-com: #7A8CA2; --k-ink: #E6ECF2;
  --font-mono: "JetBrains Mono", ui-monospace, monospace; --gutter: clamp(20px,4vw,48px);
  color-scheme: dark;
}
[data-theme="light"] {
  --color-bg: #F5F7FA; --color-surface: #FFFFFF; --k-deep: #E8EDF2; --k-raised: #DDE4EB;
  --color-text: #0B1520; --k-muted: #4A5869; --color-accent: #0A7568; --color-accent-600: #08625A;
  --color-accent-700: #064F48; --color-divider: #BCC7D3; --k-rule: #D3DBE4; --k-grid: rgba(18,38,63,0.06);
  --k-code-bg: #FFFFFF; --k-code-text: #1B2633; --syn-kw: #0A7568; --syn-attr: #8A5F0F; --syn-type: #1F4F8A;
  --syn-str: #8A5F0F; --syn-com: #5E6B7A; --k-ink: #12263F;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --color-bg: #F5F7FA; --color-surface: #FFFFFF; --k-deep: #E8EDF2; --k-raised: #DDE4EB;
    --color-text: #0B1520; --k-muted: #4A5869; --color-accent: #0A7568; --color-accent-600: #08625A;
    --color-accent-700: #064F48; --color-divider: #BCC7D3; --k-rule: #D3DBE4; --k-grid: rgba(18,38,63,0.06);
    --k-code-bg: #FFFFFF; --k-code-text: #1B2633; --syn-kw: #0A7568; --syn-attr: #8A5F0F; --syn-type: #1F4F8A;
    --syn-str: #8A5F0F; --syn-com: #5E6B7A; --k-ink: #12263F;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--k-deep); }
body {
  color: var(--color-text); font-family: "Archivo", system-ui, sans-serif; font-size: 16px; line-height: 1.6;
  overflow-x: clip; font-variant-ligatures: no-contextual; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 800; margin: 0; }
a { color: var(--color-accent); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-600); }
code { font-family: var(--font-mono); }
.mono { font-family: var(--font-mono); }
.muted { color: var(--k-muted); }
.accent { color: var(--color-accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--color-bg); padding: 8px 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 24px; min-height: 48px; padding: 0 18px;
  font: 800 16px/1.2 "Archivo", system-ui, sans-serif; text-decoration: none; cursor: pointer;
  color: var(--color-text); border: 1px solid transparent; background: transparent;
}
.btn svg { display: block; flex: none; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); justify-content: space-between; min-width: 220px; }
.btn-primary:hover { background: var(--color-accent-600); color: var(--color-bg); }
.btn-primary:active { background: var(--color-accent-700); }
.btn-secondary { border-color: var(--color-divider); background: var(--color-bg); gap: 10px; }
.btn-secondary:hover { background: var(--k-raised); color: var(--color-text); }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0; cursor: pointer;
  border: 1px solid var(--color-divider); background: transparent; color: var(--color-text);
}
.icon-btn:hover { background: var(--k-raised); }

/* Header and hero */
.top { position: relative; background: var(--color-bg); }
.grid-lines { position: absolute; inset: 0; pointer-events: none; display: grid; grid-template-columns: repeat(12, 1fr); }
.grid-lines span + span { border-left: 1px solid var(--k-grid); }
.nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 20px 0;
  border-bottom: 2px solid var(--color-divider);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--k-ink); margin-right: auto; }
.brand:hover { color: var(--k-ink); }
.brand span { font-weight: 800; font-size: 25px; letter-spacing: -0.045em; line-height: 1; }
.nav-links { display: flex; align-items: center; gap: 4px 24px; flex-wrap: wrap; font-size: 15px; }
.nav-links a, .footer-nav a { color: var(--color-text); text-decoration: none; }
.nav-links a:hover, .footer-nav a:hover { color: var(--color-accent); }
[data-theme="light"] .when-dark, [data-theme="dark"] .when-light { display: none; }

.hero { position: relative; padding-top: clamp(64px,10vw,140px); padding-bottom: var(--hero-pad, clamp(56px,7vw,96px)); }
.eyebrow { margin: 0 0 28px; font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.02em; color: var(--k-muted); display: flex; flex-wrap: wrap; gap: 8px 16px; }
.hero h1 { position: relative; z-index: 4; max-width: 16ch; font-size: clamp(40px,6.6vw,88px); line-height: 0.98; letter-spacing: -0.04em; }
.hero h1 span { display: inline-block; }
.lede { position: relative; z-index: 4; margin: 28px 0 0; max-width: 34ch; font-size: clamp(18px,1.8vw,22px); line-height: 1.45; color: var(--k-muted); text-wrap: pretty; }
.actions { position: relative; z-index: 4; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 44px; }
.install {
  position: relative; z-index: 4; margin-top: 20px; display: flex; max-width: 100%; width: fit-content;
  border: 1px solid var(--color-divider); background: var(--k-code-bg);
}
.install code { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 14px; white-space: pre; overflow-x: auto; min-width: 0; color: var(--k-code-text); }
.copy {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; min-width: 92px; border: 0;
  border-left: 1px solid var(--color-divider); background: transparent; color: var(--color-text);
  font-family: var(--font-mono); font-size: 13px; cursor: pointer;
}
.copy:hover { background: var(--k-raised); }
.hero-mark { position: absolute; z-index: 3; right: var(--gutter); width: var(--mark, 360px); height: var(--mark, 360px); bottom: calc(var(--mark, 360px) * -0.203); pointer-events: none; }
.hero-mark svg { display: block; overflow: visible; width: 100%; height: 100%; }
.hero-mark path { fill: var(--k-ink); stroke: var(--k-ink); stroke-width: 0.09; fill-opacity: 0.1; }
.waterline { position: absolute; z-index: 2; left: 0; right: 0; bottom: -12px; height: 24px; overflow: hidden; color: var(--color-accent); pointer-events: none; }
.waterline svg { display: block; }
.waterline path { fill: none; stroke: currentColor; vector-effect: non-scaling-stroke; }
.below { position: absolute; z-index: 2; left: var(--gutter); bottom: -44px; margin: 0; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--k-muted); }

/* Sections */
section.block { padding-bottom: clamp(64px,9vw,120px); }
section.first { padding-top: clamp(112px,13vw,176px); }
.section-head { border-top: 2px solid var(--color-divider); padding-top: clamp(48px,6vw,80px); margin-bottom: 40px; }
.section-head.split, .split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,340px),1fr)); gap: 20px 48px; align-items: end; margin-bottom: 48px; }
.first .split { border-top: 0; padding-top: 0; }
.num { margin: 0 0 12px; font-family: var(--font-mono); font-size: 13px; color: var(--color-accent); }
h2 { font-size: clamp(32px,4.4vw,56px); line-height: 1.0; letter-spacing: -0.035em; }
.intro { margin: 0; max-width: 52ch; color: var(--k-muted); text-wrap: pretty; }

/* Code panels */
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,460px),1fr)); border-top: 2px solid var(--color-divider); border-bottom: 2px solid var(--color-divider); background: var(--k-code-bg); }
.panel { min-width: 0; display: flex; flex-direction: column; }
.panel + .panel { border-left: 1px solid var(--k-rule); }
.panel-bar { padding: 12px 20px; font-family: var(--font-mono); font-size: 12px; color: var(--k-muted); border-bottom: 1px solid var(--k-rule); display: flex; justify-content: space-between; gap: 12px; }
.code + .panel-bar { border-top: 1px solid var(--k-rule); }
.code { overflow-x: auto; padding: 20px; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.75; color: var(--k-code-text); }
.code.grow { flex: 1; }
.code > div { min-width: max-content; }
.code .l { white-space: pre; }
.i1 { padding-left: 4ch; } .i2 { padding-left: 8ch; }
.code.flush { padding-left: 0; }
.p0 { padding-left: 20px; } .p1 { padding-left: calc(20px + 2ch); }
.err { white-space: pre; padding-left: calc(17px + 4ch); border-left: 3px solid var(--color-accent); }
.kw { color: var(--syn-kw); } .at { color: var(--syn-attr); } .ty { color: var(--syn-type); } .st { color: var(--syn-str); } .co { color: var(--syn-com); }
.panel dl { margin: 0; padding: 20px; display: grid; gap: 10px; font-size: 14px; border-top: 1px solid var(--k-rule); }
.panel dl div { display: grid; grid-template-columns: 9ch 1fr; gap: 12px; }
.panel dt { font-family: var(--font-mono); color: var(--color-accent); }
.panel dd { margin: 0; color: var(--k-muted); }

/* Features */
.features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%,260px),1fr)); border-top: 1px solid var(--color-divider); border-left: 1px solid var(--color-divider); }
.features li { background: var(--k-deep); border-right: 1px solid var(--color-divider); border-bottom: 1px solid var(--color-divider); padding: 28px 24px 32px; display: flex; flex-direction: column; gap: 14px; transition: background .3s, box-shadow .3s; }
.features li:hover { background: var(--color-bg); box-shadow: inset 0 3px 0 var(--color-accent); }
.features svg { fill: none; stroke: var(--color-accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.features h3 { font-size: 19px; line-height: 1.25; letter-spacing: -0.01em; }
.features h3 a { color: inherit; text-decoration: none; }
.features h3 a:hover { color: var(--color-accent); }
.features p { margin: 0; font-size: 15px; color: var(--k-muted); text-wrap: pretty; }
.features code { font-size: 13px; color: var(--color-text); }

/* Performance */
.perf { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,360px),1fr)); gap: 48px 64px; align-items: start; }
.perf + .perf { margin-top: 64px; }
.perf figure { margin: 0; min-width: 0; }
.perf table { width: 100%; border-collapse: collapse; font-size: 15px; }
.perf caption { caption-side: bottom; text-align: left; padding-top: 14px; font-size: 13px; color: var(--k-muted); font-family: var(--font-mono); }
.perf thead th { text-align: left; font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--k-muted); padding: 0 0 10px; border-bottom: 2px solid var(--color-divider); }
.perf thead th:last-child { text-align: right; }
.perf tbody th { text-align: left; font-weight: 500; padding: 18px 16px 18px 0; border-bottom: 1px solid var(--k-rule); }
.perf tbody td { text-align: right; vertical-align: top; padding: 18px 0; font-family: var(--font-mono); font-size: 15px; border-bottom: 1px solid var(--k-rule); white-space: nowrap; }
.bar { margin-top: 12px; height: 10px; background: var(--k-rule); }
.bar > div { height: 100%; background: var(--color-accent); }
.bar.dim > div { background: var(--k-muted); }
.claim { border-left: 2px solid var(--color-divider); padding-left: clamp(20px,3vw,40px); }
.claim .big { margin: 0; font-size: clamp(56px,8vw,112px); font-weight: 800; letter-spacing: -0.05em; line-height: 0.9; }
.claim .big span { color: var(--k-muted); font-weight: 400; }
.claim p { margin: 20px 0 0; max-width: 30ch; font-size: 18px; line-height: 1.45; text-wrap: pretty; }
.more { display: inline-flex; align-items: center; gap: 8px; margin-top: 20px; font-size: 15px; font-weight: 600; text-underline-offset: 4px; }

/* Token binding */
.surface { background: var(--color-surface); border-top: 2px solid var(--color-divider); border-bottom: 2px solid var(--color-divider); }
.surface .wrap { padding-top: clamp(64px,9vw,112px); padding-bottom: clamp(64px,9vw,112px); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,230px),1fr)); gap: 0 24px; }
.steps li { padding: 0 0 28px; display: flex; flex-direction: column; gap: 12px; transition: opacity .5s; }
.steps li.dim { opacity: 0.38; }
.track { height: 3px; background: var(--color-divider); margin-bottom: 12px; }
.track div { height: 100%; width: 100%; background: var(--color-text); }
.steps li.dim .track div { width: 0; }
.steps li.active .track div { animation: keel-fill 2.4s linear both; }
.steps li:last-child .track div { background: var(--color-accent); }
.steps h3 { font-size: 22px; letter-spacing: -0.015em; }
.steps p { margin: 0; font-size: 15px; color: var(--k-muted); }
.steps .n { font-family: var(--font-mono); font-size: 13px; color: var(--k-muted); }
.chip { margin-top: auto; align-self: flex-start; font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--color-divider); background: var(--color-bg); color: var(--color-text); }
.chip.dashed { border-style: dashed; }
.chip.revoked { border: 0; background: var(--color-accent); color: var(--color-bg); font-weight: 500; text-decoration: line-through; }

/* Start */
.start { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%,340px),1fr)); gap: 40px 64px; align-items: start; }
.start .intro { margin-top: 20px; max-width: 40ch; }
.start .btn { margin-top: 28px; }
.terminal { min-width: 0; border: 1px solid var(--color-divider); background: var(--k-code-bg); }
.terminal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 0 16px; border-bottom: 1px solid var(--color-divider); font-family: var(--font-mono); font-size: 12px; color: var(--k-muted); }
.terminal-bar .copy { padding: 10px 16px; min-height: 40px; font-size: 12px; }
.terminal .code { line-height: 1.9; }
.cursor { display: inline-block; width: 0.6em; height: 1.1em; vertical-align: -0.2em; margin-left: 4px; background: var(--color-accent); animation: keel-blink 1.1s steps(1) infinite; }

/* Footer */
footer { border-top: 2px solid var(--color-divider); overflow: hidden; }
.footer-top { padding-top: 48px; display: flex; flex-wrap: wrap; gap: 32px 64px; align-items: flex-start; }
.footer-brand { display: flex; flex-direction: column; gap: 14px; margin-right: auto; }
.footer-brand div { display: flex; align-items: center; gap: 10px; color: var(--k-ink); }
.footer-brand div span { font-weight: 800; font-size: 22px; letter-spacing: -0.045em; line-height: 1; }
.footer-brand p { margin: 0; font-size: 14px; color: var(--k-muted); }
.footer-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 12px 40px; min-width: min(100%,460px); font-size: 15px; }
.wordmark { margin-top: 56px; font-weight: 800; font-size: clamp(120px,30vw,400px); letter-spacing: -0.06em; line-height: 0.72; color: transparent; -webkit-text-stroke: 1px var(--color-divider); margin-bottom: -0.06em; user-select: none; }

/* Motion */
@keyframes keel-d200 { from { transform: translateX(0) } to { transform: translateX(-200px) } }
@keyframes keel-d300 { from { transform: translateX(-300px) } to { transform: translateX(0) } }
@keyframes keel-d140 { from { transform: translateX(0) } to { transform: translateX(-140px) } }
@keyframes keel-draw { from { stroke-dashoffset: 1 } to { stroke-dashoffset: 0 } }
@keyframes keel-tint { from { fill-opacity: 0 } to { fill-opacity: 0.1 } }
@keyframes keel-growx { from { transform: scaleX(0) } to { transform: scaleX(1) } }
@keyframes keel-growy { from { transform: scaleY(0) } to { transform: scaleY(1) } }
@keyframes keel-fill { from { width: 0 } to { width: 100% } }
@keyframes keel-blink { 0% { opacity: 1 } 50% { opacity: 0 } }

.motion .w300 { animation: keel-d300 26s linear infinite; }
.motion .w140 { animation: keel-d140 11s linear infinite; }
.motion .w200 { animation: keel-d200 16s linear infinite; }
.motion .hero-mark path { stroke-dasharray: 1; animation: keel-draw 1.8s cubic-bezier(.65,0,.25,1) both, keel-tint 1s ease both; }
.motion .hero-mark path:nth-child(1) { animation-delay: .2s, 1.7s; }
.motion .hero-mark path:nth-child(2) { animation-delay: .38s, 1.8s; }
.motion .hero-mark path:nth-child(3) { animation-delay: .56s, 1.9s; }
.motion .hero-mark .wl { transform-box: fill-box; transform-origin: left; animation: keel-growx 1.2s cubic-bezier(.65,0,.25,1) 1s both; }
.motion .hero-mark .kl { transform-box: fill-box; transform-origin: top; animation: keel-growy 1s cubic-bezier(.65,0,.25,1) 1.9s both; }
.motion [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); }
.motion [data-reveal].in { opacity: 1; transform: none; }
.motion [data-bar] { width: 0 !important; transition: width 1.6s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0ms); }
.motion [data-bar].in { width: var(--w) !important; }
html:not(.motion) .cursor { animation: none; }

@media (max-width: 759px) {
  .hero { --hero-pad: calc(var(--mark) * 0.8 + 48px); }
}
