/* Layout and tokens modelled on kolejain.com: a fixed left rail and a rounded content panel. */
@font-face { font-family: "DM Sans"; src: url(/fonts/dm-sans.woff2) format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Geist"; src: url(/fonts/geist.woff2) format("woff2"); font-weight: 600 800; font-display: swap; }

:root {
  --bg-1: #fafafa;
  --bg-2: #f5f5f5;
  --bg-3: #ebebeb;
  --stroke: #e0e0e0;
  --text: #1a1a1a;
  --subtext: #6f6f6f;
  --button: #161618;
  --ease: cubic-bezier(.075, .82, .165, 1);
  --rail: 232px; /* 192px sidebar + 2 × 20px margin */
  color-scheme: light;
}
@media (min-width: 768px) { :root[data-collapsed] { --rail: 76px; } } /* 36px = 20px icon + 2 × 8px padding */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg-2); color: var(--text); font: 400 14px/1.3 "DM Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3 { margin: 0; }
button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 8px; }
.icon { flex: none; }
.label { transition: opacity .3s; }

/* Keep the sidebar still while pages swap (Chromium/Safari; others just navigate). */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
.sidebar { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }

.layout { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: 100dvh; transition: grid-template-columns 1s var(--ease); }

/* Sidebar */
.sidebar { position: fixed; inset: 20px auto 20px 20px; width: calc(var(--rail) - 40px); display: flex; flex-direction: column; justify-content: space-between; gap: 24px; transition: width 1s var(--ease); z-index: 2; }
.brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 12px; height: 32px; padding: 4px 8px; border-radius: 8px; overflow: hidden; white-space: nowrap; font: 800 14px "Geist", system-ui, sans-serif; }
.icon-btn { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px; transition: background-color .4s; }
.icon-btn:hover { background: var(--bg-3); }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 8px; height: 32px; padding: 4px 8px; border-radius: 8px; overflow: hidden; white-space: nowrap; transition: background-color .4s; }
.nav-item:hover, .nav-item[aria-current] { background: var(--bg-3); }

.side-bottom { display: flex; flex-direction: column; gap: 16px; transition: opacity .3s, visibility .3s; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 4px 4px 12px; background: var(--bg-1); border: .5px solid var(--stroke); border-radius: 16px; overflow: hidden; transition: background-color .4s; }
.card:hover { background: #fff; }
.card-img { display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: 12px; background: linear-gradient(135deg, #e3e8ff, #f3e6ff 55%, #ffeadb); color: rgb(26 26 26 / .45); }
.card-text { display: grid; gap: 2px; padding: 0 8px; }
.card-title { font-weight: 600; }
.card-sub { color: var(--subtext); font-size: 12px; }
.clock { color: var(--subtext); text-align: center; font-variant-numeric: tabular-nums; min-height: 1.3em; }
.socials { flex-direction: row; justify-content: center; gap: 4px; }
@media (max-height: 600px) { .card { display: none; } } /* the rail needs ~575px with the card */

/* Content panel */
.panel { display: flex; flex-direction: column; height: calc(100dvh - 8px); margin-top: 8px; background: var(--bg-1); border-radius: 16px 0 0 0; overflow: auto; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 48px 16px; text-align: center; }
h1 { max-width: 500px; font: 600 24px/1.25 "Geist", system-ui, sans-serif; letter-spacing: -.025em; text-wrap: balance; }
.sub { max-width: 300px; color: var(--subtext); text-wrap: balance; }
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pill { display: flex; align-items: center; gap: 8px; height: 34px; padding: 4px 12px; background: var(--bg-2); border: 1px solid var(--stroke); border-radius: 12px; transition: background-color .4s; }
.pill:hover { background: var(--bg-3); }
.foot { padding: 32px 0; color: var(--subtext); text-align: center; }

/* Landing pages: a status chip above the title */
.status { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; background: var(--bg-2); border: 1px solid var(--stroke); border-radius: 14px; font-size: 12px; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #2e9d5b; }

/* Sub-pages: a left-aligned reading column */
.stage.page { justify-content: flex-start; align-items: stretch; gap: 16px; width: min(100%, 680px); margin: 0 auto; padding-top: 64px; text-align: left; }
.page h1 { max-width: none; font-size: 32px; line-height: 1.15; }
.crumb { align-self: flex-start; color: var(--subtext); transition: color .3s; }
.crumb:hover { color: var(--text); }

.prose { font-size: 16px; line-height: 1.7; }
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1em; }
.prose strong { font-weight: 600; }
.prose h2 { margin-top: 2em; font: 600 20px/1.3 "Geist", system-ui, sans-serif; letter-spacing: -.02em; }
.prose h3 { margin-top: 1.6em; font: 600 16px/1.4 "Geist", system-ui, sans-serif; }
.prose h3 + p { margin-top: .25em; }
.prose ul { padding-left: 1.4em; }
.prose li + li { margin-top: .4em; }
.prose .note { padding-left: 16px; border-left: 2px solid var(--stroke); color: var(--subtext); }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.prose th, .prose td { padding: 8px 12px; border-bottom: 1px solid var(--stroke); text-align: left; vertical-align: top; }
.prose th { font-weight: 600; white-space: nowrap; }

/* Mobile-only chrome */
.topbar, .scrim { display: none; }

@media (min-width: 768px) {
  :root[data-collapsed] .brand-row { flex-direction: column; align-items: stretch; gap: 4px; }
  :root[data-collapsed] .icon-btn { width: 100%; }
  :root[data-collapsed] .label { opacity: 0; }
  :root[data-collapsed] .side-bottom { opacity: 0; visibility: hidden; }
}

@media (max-width: 767px) {
  .layout { display: block; height: auto; }
  .sidebar { inset: 8px auto 8px 8px; width: min(320px, calc(100vw - 16px)); padding: 20px; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--stroke); border-radius: 16px; transform: translateX(calc(-100% - 16px)); visibility: hidden; transition: transform .5s var(--ease), visibility 0s .5s; z-index: 20; }
  :root[data-open] .sidebar { transform: none; visibility: visible; transition-delay: 0s; }
  .card { display: flex; }
  #collapse { display: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgb(0 0 0 / .2); opacity: 0; pointer-events: none; transition: opacity .3s; }
  :root[data-open] .scrim { opacity: 1; pointer-events: auto; }
  .topbar { display: flex; align-items: center; gap: 4px; position: fixed; inset: 8px 8px auto; z-index: 5; padding: 8px; background: var(--bg-2); border: 1px solid var(--stroke); border-radius: 16px; }
  .panel { height: 100dvh; margin-top: 0; padding-top: 64px; border-radius: 0; }
  .stage.page { padding-top: 32px; }
  .page h1 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; transition-delay: 0s !important; }
}
