/* Kernelin site: shared tokens, header, buttons, footer and the logs dialog. Light theme only. */
:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --paper: #fffdf9;
  --ink: #15141a;
  --ink-2: #4b4852;
  --muted: #8a8690;
  --line: #d9d5cc;
  --line-strong: #1d1b22;
  --purple: #7f52ff;
  --magenta: #c711e1;
  --coral: #e44857;
  --amber: #f0a43a;
  --green: #2fa36b;
  --code-bg: #f1eee7;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --wrap: 1100px;
  --gutter: 24px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13.5px/1.7 var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
img, svg { max-width: 100%; }
::selection { background: rgba(127, 82, 255, .22); }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.rule { border: 0; border-top: 1px solid var(--line-strong); margin: 0; opacity: .85; }

.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
.caps { text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.kotlin-text {
  background: linear-gradient(90deg, var(--purple), var(--magenta) 55%, var(--coral));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- top "logs" link ---------- */
.toplog {
  display: flex; justify-content: center; padding-top: 10px;
}
.toplog button {
  font: 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: lowercase;
  color: var(--muted); background: none; border: 0; padding: 4px 8px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.toplog button::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(47,163,107,.15); }
.toplog button:hover { color: var(--ink); }

/* ---------- header ---------- */
.nav {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 64px; position: relative; z-index: 5;
}
.nav ul { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.nav ul a { text-decoration: none; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 0; }
.nav ul a:hover, .nav ul a[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }
.nav .right { justify-self: end; display: flex; align-items: center; gap: 10px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; justify-self: center; }
.logo svg { width: 30px; height: 30px; display: block; }
.logo .word { font: 600 15px/1 var(--mono); letter-spacing: -.02em; }
.menu-btn { display: none; background: none; border: 1px solid var(--line-strong); border-radius: 999px; width: 36px; height: 36px; cursor: pointer; }
.menu-btn span, .menu-btn span::before, .menu-btn span::after { display: block; width: 14px; height: 1.5px; background: var(--ink); margin: 0 auto; position: relative; content: ""; }
.menu-btn span::before { position: absolute; top: -5px; }
.menu-btn span::after { position: absolute; top: 5px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 15px;
  border-radius: 999px; font: 600 10.5px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border: 1px solid var(--ink); white-space: nowrap;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #2d2938; box-shadow: 0 6px 20px -8px rgba(127,82,255,.65); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: rgba(21,20,26,.05); }
.btn:active { transform: translateY(1px); }
.btn .arr { transition: transform .15s ease; }
.btn:hover .arr { transform: translateX(2px); }

/* ---------- code ---------- */
code, pre { font-family: var(--mono); font-variant-ligatures: none; }
.tok-k { color: #0033b3; font-weight: 500; }   /* keyword */
.tok-a { color: #9e880d; }                     /* annotation / attribute */
.tok-s { color: #067d17; }                     /* string */
.tok-n { color: #1750eb; }                     /* number */
.tok-c { color: #8c8c8c; font-style: italic; } /* comment */
.tok-f { color: #00627a; }                     /* function */
.tok-t { color: #7f52ff; }                     /* type */

/* ---------- footer ---------- */
.foot {
  position: relative; padding: 0 0 40px;
}
.foot .grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 24px; padding-top: 56px; align-items: start;
}
.foot h4 { margin: 0 0 10px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin: 0 0 4px; }
.foot li a { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; }
.foot li a:hover { text-decoration: underline; text-underline-offset: 4px; }
.foot .brand .logo { justify-self: start; }
.foot .brand .logo svg { width: 40px; height: 40px; }
.foot .brand .logo .word { font-size: 28px; font-family: var(--sans); font-weight: 500; letter-spacing: -.03em; }
.foot .meta { margin-top: 18px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); line-height: 1.9; }
.foot .meta .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.foot .meta .dot.on { background: var(--green); }
.foot .legal { margin-top: 40px; font-size: 10.5px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }

/* ---------- logs dialog ---------- */
.gate {
  position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center;
  background: rgba(247,245,240,.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); padding: 16px;
}
.gate.open { display: flex; animation: fade .18s ease; }
.gate .box {
  width: 100%; max-width: 340px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 26px 24px 22px; text-align: center; box-shadow: 0 30px 80px -30px rgba(127,82,255,.45);
}
.gate h3 { margin: 4px 0 4px; font: 400 26px/1.2 var(--serif); }
.gate p { margin: 0 0 18px; color: var(--ink-2); font-size: 12px; }
.pins { position: relative; display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; cursor: text; }
.pins input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px; color: transparent; caret-color: transparent; background: none; }
.pins .cell {
  width: 48px; height: 54px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  display: flex; align-items: center; justify-content: center; transition: border-color .15s, box-shadow .15s, background .15s;
}
.pins .cell.filled::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.pins .cell.active { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(127,82,255,.15); background: #fff; }
.gate.bad .pins { animation: shake .35s ease; }
.gate.bad .pins .cell { border-color: var(--coral); }
.gate .msg { min-height: 18px; font-size: 11px; color: var(--coral); margin-bottom: 8px; }
.gate .gate-actions { display: flex; gap: 8px; justify-content: center; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .nav { grid-template-columns: auto 1fr auto; }
  .nav .logo { grid-column: 1; grid-row: 1; justify-self: start; }
  .nav .right { grid-column: 3; }
  .nav ul {
    display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--paper); border: 1px solid var(--line-strong); border-radius: 12px; padding: 8px;
    box-shadow: 0 24px 60px -30px rgba(21,20,26,.4);
  }
  .nav.open ul { display: flex; }
  .nav ul a { display: block; padding: 10px 12px; font-size: 12px; }
  .menu-btn { display: inline-block; }
  .nav .right .btn { display: none; }
  .foot .grid { grid-template-columns: 1fr 1fr; }
  .foot .brand { grid-column: 1 / -1; }
  .foot .grid > .cta { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
