/* Keel landing page. Composition only: colour, type and the header come from the shared Eknath theme (--ek-* tokens). */
.keel { padding-bottom: 40px; }
.keel section { margin-top: 72px; scroll-margin-top: 84px; }
.keel section.hero { margin-top: 0; }
.keel h1 { font-family: var(--ek-font-display); }
.keel h2, .keel h3 { font-family: var(--ek-font-display); }
.keel .lead { color: var(--ek-muted); font-size: 17px; max-width: 760px; margin: 0 0 24px; line-height: 1.65; }
.keel p, .keel li { line-height: var(--ek-lh-body); }
.keel code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; background: var(--ek-soft); border: 1px solid var(--ek-border); border-radius: 6px; padding: 1px 6px; }
.keel pre code { background: none; border: 0; padding: 0; font-size: 13px; }

/* hero */
.keel .hero { padding: 56px 0 8px; }
.keel .hero-description { max-width: 720px; font-size: 18px; line-height: 1.65; color: var(--ek-muted); margin: 18px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 18px; }
.cta { display: inline-flex; align-items: center; padding: 11px 20px; border-radius: 8px; font-weight: 600; font-size: 15px; text-decoration: none; background: var(--ek-button-fill); color: var(--ek-button-text); border: 1px solid transparent; }
.cta:hover { filter: brightness(1.1); color: var(--ek-button-text); }
.cta.ghost { background: transparent; color: var(--ek-text); border-color: var(--ek-border); }
.cta.ghost:hover { border-color: var(--ek-accent); color: var(--ek-accent); filter: none; }
.install { display: flex; align-items: center; gap: 12px; max-width: 640px; padding: 10px 12px 10px 16px; background: var(--ek-code); border: 1px solid var(--ek-border); border-radius: 10px; }
.install code { flex: 1; background: none; border: 0; padding: 0; color: #e6edf8; font-size: 13.5px; overflow-x: auto; white-space: nowrap; }
.install button { flex-shrink: 0; font-size: 12px; padding: 5px 12px; border-radius: 6px; border: 1px solid #2c3a50; background: #151f30; color: #e6edf8; cursor: pointer; }
.install button:hover { border-color: var(--ek-accent); }
.keel .hero-meta { margin-top: 20px; }

/* grids and cards */
.grid { display: grid; gap: 16px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid > *, .split > * { min-width: 0; }
.card { padding: 20px 22px; }
.card .prose pre { overflow-x: auto; }
.card h3 { font-size: 17px; margin: 0 0 8px; letter-spacing: -.01em; }
.card p { margin: 0 0 10px; color: var(--ek-muted); font-size: 14.5px; }
.card p:last-child { margin-bottom: 0; }
.card .prose { margin: 10px 0 12px; }
.card .prose pre { margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 36px; align-items: start; }
.split p { color: var(--ek-muted); margin: 0 0 12px; }
.split p strong, .split p em { color: var(--ek-text); font-style: normal; }
.split p em { font-style: italic; }

/* lists */
.ticks, .plain { margin: 12px 0 0; padding: 0; list-style: none; }
.ticks li { position: relative; padding: 6px 0 6px 28px; color: var(--ek-muted); font-size: 14.5px; }
.ticks li strong { color: var(--ek-text); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: 13px; width: 12px; height: 7px; border-left: 2px solid var(--ek-accent); border-bottom: 2px solid var(--ek-accent); transform: rotate(-45deg); }
.plain li { position: relative; padding: 5px 0 5px 18px; color: var(--ek-muted); font-size: 14.5px; }
.plain li::before { content: ""; position: absolute; left: 2px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--ek-accent); }

/* diagram */
.diagram { margin: 0; padding: 18px 18px 14px; }
.diagram svg { width: 100%; height: auto; display: block; color: var(--ek-muted); }
.diagram .box rect { fill: var(--ek-soft); stroke: var(--ek-border); stroke-width: 1.2; }
.diagram .box.core rect { stroke: var(--ek-accent); fill: color-mix(in srgb, var(--ek-accent) 9%, var(--ek-panel)); }
.diagram text { fill: var(--ek-text); text-anchor: middle; font-family: var(--ek-font-body); }
.diagram .t1 { font-size: 15px; font-weight: 700; }
.diagram .t2 { font-size: 11.5px; fill: var(--ek-muted); }
.diagram .t3 { font-size: 10.5px; fill: var(--ek-muted); text-anchor: start; }
.diagram .line { stroke: currentColor; stroke-width: 1.4; fill: none; }
.diagram figcaption { margin: 10px 4px 0; font-size: 13px; color: var(--ek-muted); }

/* before and after, subnav, guide and specs pages */
.table-wrap { overflow-x: auto; padding: 4px 6px; }
table.compare { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.compare th { text-align: left; font: 600 11px var(--ek-font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--ek-muted); padding: 12px 16px; border-bottom: 1px solid var(--ek-border); }
table.compare th:last-child { color: var(--ek-accent); }
table.compare td { padding: 12px 16px; border-bottom: 1px solid var(--ek-border); vertical-align: top; width: 50%; line-height: 1.55; }
table.compare tr:last-child td { border-bottom: 0; }
table.compare td:first-child { color: var(--ek-muted); }
.subnav { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 14px 0 0; font-size: 14px; border-bottom: 1px solid var(--ek-border); }
.subnav a { padding: 6px 0 12px; color: var(--ek-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ek-text); }
.subnav a[aria-current="page"] { color: var(--ek-accent); border-bottom-color: var(--ek-accent); font-weight: 600; }
.keel .page-head { padding: 36px 0 8px; }
.keel .page-head h1 { font-size: clamp(30px, 3.6vw, 44px); letter-spacing: -.04em; margin: 0 0 10px; }
.docs-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 48px; align-items: start; margin-top: 28px; }
.toc-side { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; font-size: 13.5px; }
.toc-side h2 { font: 600 11px var(--ek-font-body); letter-spacing: .13em; text-transform: uppercase; color: var(--ek-muted); margin: 0 0 10px; display: block; }
.toc-side h2::after { display: none; }
.toc-side ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--ek-border); }
.toc-side a { display: block; padding: 5px 0 5px 14px; color: var(--ek-muted); text-decoration: none; margin-left: -1px; border-left: 2px solid transparent; }
.toc-side a:hover { color: var(--ek-text); }
.toc-side a.on { color: var(--ek-accent); border-left-color: var(--ek-accent); }
.guide-body { max-width: 800px; }
.guide-body h2 { scroll-margin-top: 88px; }
.guide-body .prose pre { overflow-x: auto; }
.tool-filter { width: 100%; max-width: 420px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--ek-border); background: var(--ek-panel); color: var(--ek-text); font-size: 14px; margin: 4px 0 18px; }
.tool-filter:focus-visible { outline: 2px solid var(--ek-accent); outline-offset: 2px; }
.tools { display: grid; gap: 10px; }
.tool { padding: 14px 18px; }
.tool header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
.tool h3 { margin: 0; font-size: 15px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.tool p { margin: 0 0 6px; color: var(--ek-muted); font-size: 14px; }
.tool .args { font-size: 12.5px; color: var(--ek-muted); }
.tool .args code { font-size: 12px; }
.tier { font: 600 10.5px var(--ek-font-body); letter-spacing: .1em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--ek-border); color: var(--ek-muted); }
.tier.write { color: var(--ek-amber); border-color: color-mix(in srgb, var(--ek-amber) 45%, var(--ek-border)); }
.tier.outbound { color: var(--ek-purple); border-color: color-mix(in srgb, var(--ek-purple) 45%, var(--ek-border)); }
.tier.read { color: var(--ek-green); border-color: color-mix(in srgb, var(--ek-green) 45%, var(--ek-border)); }
.schemas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.schemas .card h3 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.schemas .card h3 a { font: 12px ui-monospace, "SF Mono", Menlo, monospace; font-weight: 400; }
.count-note { color: var(--ek-muted); font-size: 13px; margin: 0 0 10px; }
@media (max-width: 900px) { .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; } .toc-side { position: static; max-height: none; } .toc-side ol { columns: 2; } .schemas { grid-template-columns: 1fr; } }

/* screenshots */
.shot { margin: 0; }
.shot img { width: 100%; height: auto; display: block; border: 1px solid var(--ek-border); border-radius: 12px; background: var(--ek-panel); }
.shot figcaption { margin: 8px 2px 0; font-size: 13px; color: var(--ek-muted); line-height: 1.5; }
.shot figcaption strong { color: var(--ek-text); }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; margin-top: 22px; }
@media (max-width: 760px) { .shots { grid-template-columns: 1fr; } }

/* timeline */
.timeline { list-style: none; counter-reset: step; margin: 0; padding: 0 0 0 4px; max-width: 820px; }
.timeline li { position: relative; padding: 0 0 26px 52px; counter-increment: step; }
.timeline li::before { counter-increment: none; content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 700 14px var(--ek-font-display); color: var(--ek-accent); background: var(--ek-soft); border: 1px solid var(--ek-border); }
.timeline li::after { content: ""; position: absolute; left: 16.5px; top: 40px; bottom: 6px; width: 1px; background: var(--ek-border); }
.timeline li:last-child::after { display: none; }
.timeline h3 { margin: 4px 0 6px; font-size: 17px; }
.timeline p { margin: 0; color: var(--ek-muted); font-size: 14.5px; }

/* notes, faq, closing */
.note { color: var(--ek-muted); font-size: 13.5px; margin-top: 16px; }
.faq details { border-top: 1px solid var(--ek-border); padding: 4px 0; }
.faq details:last-child { border-bottom: 1px solid var(--ek-border); }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ek-accent); font-weight: 400; font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 0 0 14px; color: var(--ek-muted); font-size: 14.5px; max-width: 760px; }
.closing { text-align: center; padding: 40px 20px; border: 1px solid var(--ek-border); border-radius: 16px; background: var(--ek-panel); }
.closing h2 { font-size: 28px; margin: 0 0 8px; letter-spacing: -.03em; }
.closing p { color: var(--ek-muted); max-width: 560px; margin: 0 auto; }
.closing .actions { justify-content: center; }

@media (max-width: 900px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 640px) {
  .grid.three, .grid.two { grid-template-columns: 1fr; }
  .keel section { margin-top: 52px; }
  .keel .hero { padding-top: 32px; }
  .keel .hero-description { font-size: 16px; }
  .install code { font-size: 12px; white-space: normal; word-break: break-word; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
