/* Layout of the brand book page only. The reusable parts live in tokens.css and kobalt.css. */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body.ko { margin: 0; overflow-x: hidden; font-size: var(--ko-site-text-base); line-height: var(--ko-site-text-base-lh); }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
h1, h2, h3, h4 { margin: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: absolute; left: 16px; top: -48px; z-index: 20; padding: 8px 12px; border-radius: var(--ko-radius-sm); background: var(--ko-primary); color: var(--ko-on-primary); }
.skip:focus { top: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.body { margin: 0; color: var(--ko-text-muted); max-width: 44em; }

/* Top bar */
.bar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--ko-bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--ko-line); }
.bar .wrap { display: flex; align-items: center; gap: 12px; height: 56px; }
.bar .ko-logo img { height: 26px; }
.bar-tag { padding-left: 12px; border-left: 1px solid var(--ko-line); color: var(--ko-text-muted); font-size: 15px; font-weight: 500; }
.bar nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.bar nav a { padding: 6px 8px; border-radius: var(--ko-radius-sm); color: var(--ko-text-muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.bar nav a:hover { color: var(--ko-text); background: var(--ko-hover); }

/* Hero */
.hero { padding: 88px 0 72px; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 48px 48px; background-position: -1px -1px;
  --grid: color-mix(in srgb, var(--ko-text) 5%, transparent); }
.hero-grid { display: grid; grid-template-columns: 1fr 240px; gap: 48px; align-items: center; }
.hero h1 { max-width: 12em; font: 600 var(--ko-site-heading-lg)/var(--ko-site-heading-lg-lh) var(--ko-font-display); letter-spacing: -0.02em; margin-top: 12px; }
.lead { max-width: 36em; margin: 20px 0 28px; color: var(--ko-text-muted); font-size: var(--ko-site-text-lg); line-height: var(--ko-site-text-lg-lh); }

/* Sections */
section.s { padding: 80px 0; border-top: 1px solid var(--ko-line); }
section.s:nth-of-type(odd) { background: var(--ko-surface-sunken); }
.s-head { display: grid; grid-template-columns: 200px 1fr; gap: 24px; margin-bottom: 40px; }
.s-head .num { margin: 0; padding-top: 10px; color: var(--ko-primary); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.s-head h2 { margin-bottom: 8px; font: 600 var(--ko-site-heading-md)/var(--ko-site-heading-md-lh) var(--ko-font-display); letter-spacing: -0.015em; }
.s-head p { margin: 0; max-width: 42em; color: var(--ko-text-muted); }
h3.sub { margin: 40px 0 16px; font-size: var(--ko-site-text-lg); line-height: var(--ko-site-text-lg-lh); font-weight: 600; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { margin-top: 8px; align-items: start; gap: 32px; }
.tile { position: relative; min-width: 0; border: 1px solid var(--ko-line); border-radius: var(--ko-radius-lg); background: var(--ko-surface); padding: 20px; }
.tile h3 { margin-bottom: 6px; font-size: 17px; font-weight: 600; }
.tile p { margin: 0; color: var(--ko-text-muted); font-size: 15px; line-height: 1.5; }
.tile .ko-eyebrow { margin-bottom: 8px; font-size: 12px; color: var(--ko-text-muted); }
.quote { color: var(--ko-text) !important; font: 600 24px/1.25 var(--ko-font-display) !important; letter-spacing: -0.01em; margin-bottom: 10px !important; }
.cap { margin: 12px 0 0; font-size: 14px; line-height: 1.5; color: var(--ko-text-muted); max-width: 60em; }
.rules { margin: 0; padding-left: 20px; color: var(--ko-text-muted); font-size: 15px; }
.rules li { margin: 6px 0; }
.rules b { color: var(--ko-text); font-weight: 600; }
.principles { margin: 0 0 24px; padding-left: 22px; display: grid; gap: 6px; max-width: 50em; }
.principles b { font-weight: 600; }
.table-scroll { overflow-x: auto; }
code { font-family: var(--ko-font-mono); font-size: 0.86em; }

/* Voice tables */
.voice { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; background: var(--ko-surface); border: 1px solid var(--ko-line); border-radius: var(--ko-radius-md); }
.voice th, .voice td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--ko-line); vertical-align: top; }
.voice th { font-size: 13px; color: var(--ko-text-muted); font-weight: 600; }
.voice td:first-child { font-weight: 500; }
.voice td.yes, .voice td.no { font-weight: 400; }
.voice .yes::before { content: "✓ "; color: var(--ko-success); font-weight: 700; }
.voice .no { color: var(--ko-text-muted); }
.voice .no::before { content: "✕ "; color: var(--ko-danger); font-weight: 700; }
.voice + .voice, .table-scroll + .grid { margin-top: 24px; }
.words td:first-child { font-weight: 400; }
.agent-say { margin-top: 16px; display: grid; gap: 8px; padding: 16px; border-radius: var(--ko-radius-md); background: var(--ko-surface); border: 1px solid var(--ko-line); border-left: 2px solid var(--ko-agent); }
.agent-say p { margin: 0; font-size: 15px; }
.agent-say .ko-actor { font-size: 15px; }

/* Logo */
.logo-tile { display: grid; place-items: center; min-height: 200px; padding: 24px; border-radius: var(--ko-radius-lg); border: 1px solid var(--ko-line); }
.logo-tile img { width: min(220px, 80%); height: auto; }
.on-porcelain { background: #f7f5f0; border-color: #e2dcd0; }
.on-dark { background: #0e121b; border-color: #2a3142; }
.on-cobalt { background: #0b1a4a; border-color: #0b1a4a; }

.construct { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: center; }
.grid32 { position: relative; width: 160px; aspect-ratio: 1; }
.grid32 img { width: 100%; display: block; }
.grid32::after { content: ""; position: absolute; inset: 0; border-radius: 30px; pointer-events: none;
  background-image: linear-gradient(rgb(255 255 255 / .22) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .22) 1px, transparent 1px); background-size: 5px 5px; }
.clear { padding: 18px; border: 1.5px dashed color-mix(in srgb, var(--ko-primary) 55%, transparent); border-radius: 4px; flex: none; }
.clear img { display: block; width: 72px; height: 72px; }
.tile.row { flex-wrap: nowrap; gap: 20px; }
.sizes { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px; margin-top: 16px; }
.sizes figure { margin: 0; display: grid; justify-items: center; gap: 8px; font-size: 12px; color: var(--ko-text-muted); }
.s16 { width: 16px; } .s24 { width: 24px; } .s32 { width: 32px; } .s64 { width: 64px; } .l96 img { width: 96px; height: auto; }
.versions figure { margin: 0; display: grid; justify-items: center; gap: 12px; }
.versions img { width: 64px; height: 64px; }
.versions figcaption { font-size: 13px; color: var(--ko-text-muted); }
.versions .on-porcelain figcaption { color: #575146; }
.versions .on-dark figcaption, .versions .on-cobalt figcaption { color: #e6e9f0; }
.dont { display: grid; place-items: center; min-height: 160px; overflow: hidden; }
.dont img { width: 64px; height: 64px; }
.dont .x { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: var(--ko-radius-xs); display: grid; place-items: center; background: var(--ko-danger-soft); color: var(--ko-danger-text); font-weight: 700; font-size: 12px; }
.dont p { position: absolute; bottom: 12px; left: 8px; right: 8px; text-align: center; font-size: 13px; }
.bad-stretch { transform: scaleX(1.45) rotate(-8deg); }
.bad-round { border-radius: 50%; }
.bad-effect { filter: drop-shadow(0 0 10px #3a63e0) drop-shadow(4px 6px 0 #8fa8ff); }
.bad-live { font: italic 700 30px/1 Georgia, serif; color: var(--ko-primary); }

/* Color */
.big { min-height: 180px; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 16px; border-radius: var(--ko-radius-lg); color: #fff; }
.big b { font-size: 18px; font-weight: 600; }
.big span { font-size: 13px; }
.big code { font-size: 14px; margin-top: 4px; }
.big-cobalt { background: #1f47c9; }
.big-deep { background: #0b1a4a; }
.big-porcelain { background: #f7f5f0; color: #12161f; border: 1px solid #e2dcd0; }
.big-iron { background: #0e121b; border: 1px solid #2a3142; }
.ratio { display: flex; height: 40px; border-radius: var(--ko-radius-md); overflow: hidden; font-size: 13px; font-weight: 600; border: 1px solid var(--ko-line); }
.ratio span { display: grid; place-items: center; }
.r-n { flex: 85; background: var(--ko-surface); color: var(--ko-text-muted); }
.r-c { flex: 10; background: #1f47c9; color: #fff; }
.r-s { flex: 5; background: linear-gradient(90deg, #13795b 0 25%, #e8b54a 25% 50%, #c0362c 50% 75%, #7a3fc0 75%); }
.family b { display: block; margin-bottom: 4px; font-size: 17px; }
.fam-porcelain { background: #f7f5f0; border-color: #e2dcd0; }
.fam-porcelain b { color: #12161f; } .fam-porcelain p { color: #575146; }
.scale-name { margin: 24px 0 10px; font-size: 14px; font-weight: 600; }
.scale { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.scale li { display: grid; gap: 1px; font-size: 13px; min-width: 0; }
.scale .chip { height: 48px; border-radius: var(--ko-radius-sm); border: 1px solid color-mix(in srgb, var(--ko-text) 8%, transparent); margin-bottom: 6px; }
.scale code { color: var(--ko-text-muted); font-size: 12px; }
.scale small { color: var(--ko-text-muted); font-size: 11px; }
.tokens { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 1.4; border: 1px solid var(--ko-line); border-radius: var(--ko-radius-md); overflow: hidden; background: var(--ko-surface); }
.tokens th, .tokens td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--ko-line); }
.tokens th { font-size: 12px; color: var(--ko-text-muted); font-weight: 600; }
.tokens tr:last-child td { border-bottom: 0; }
.tokens td[data-theme], .tokens td:first-child code { white-space: nowrap; }
.tokens td[data-theme] code { color: var(--ko-text-muted); }
.tokens .chip { display: inline-block; width: 20px; height: 20px; border-radius: var(--ko-radius-xs); vertical-align: middle; margin-right: 8px; border: 1px solid color-mix(in srgb, var(--ko-text) 15%, transparent); }
.tokens .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.contrast td:nth-child(3) { white-space: nowrap; }
.chart-row { display: inline-flex; gap: 3px; vertical-align: middle; margin: 0 4px; }
.chart-row i { width: 14px; height: 14px; border-radius: 2px; }
.more { margin-top: 16px; }
.more summary { cursor: pointer; color: var(--ko-primary); font-weight: 500; font-size: 15px; width: fit-content; }
.more .table-scroll { margin-top: 12px; }

/* Type */
.font-card { display: grid; gap: 6px; }
.font-card .glyph { font-size: 56px; line-height: 1.1; font-weight: 500; letter-spacing: -0.01em; }
.font-card .display { font-family: var(--ko-font-display); font-weight: 700; letter-spacing: -0.02em; }
.font-card .mono { font-family: var(--ko-font-mono); font-weight: 400; letter-spacing: 0; }
.font-card b { font-size: 16px; font-weight: 600; }
.type-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--ko-line); }
.type-row code { color: var(--ko-text-muted); font-size: 12px; }
.type-row > span { min-width: 0; overflow-wrap: anywhere; }
.t-hlg { font: 600 var(--ko-heading-lg)/var(--ko-heading-lg-lh) var(--ko-font-display); letter-spacing: -0.02em; }
.t-hmd { font: 600 var(--ko-heading-md)/var(--ko-heading-md-lh) var(--ko-font-display); letter-spacing: -0.01em; }
.t-hsm { font-size: var(--ko-heading-sm); line-height: var(--ko-heading-sm-lh); font-weight: 600; }
.t-lg { font-size: var(--ko-text-lg); line-height: var(--ko-text-lg-lh); font-weight: 500; }
.t-base { font-size: var(--ko-text-base); line-height: var(--ko-text-base-lh); }
.t-sm { font-size: var(--ko-text-sm); line-height: var(--ko-text-sm-lh); color: var(--ko-text-muted); }
.t-xs { font-size: var(--ko-text-xs); line-height: var(--ko-text-xs-lh); font-weight: 500; color: var(--ko-text-muted); }
.t-mono { font: 400 var(--ko-mono-sm)/var(--ko-mono-sm-lh) var(--ko-font-mono); font-variant-numeric: tabular-nums; }
.m-hlg { font: 600 var(--ko-site-heading-lg)/var(--ko-site-heading-lg-lh) var(--ko-font-display); letter-spacing: -0.02em; }
.m-hmd { font: 600 var(--ko-site-heading-md)/var(--ko-site-heading-md-lh) var(--ko-font-display); letter-spacing: -0.015em; }
.m-base { font-size: var(--ko-site-text-base); line-height: var(--ko-site-text-base-lh); }
.type-row + .rules { margin-top: 20px; }

/* Layout tokens */
.spaces { display: grid; gap: 8px; }
.spaces div { display: grid; grid-template-columns: 80px 28px 1fr; align-items: center; gap: 12px; font-size: 13px; color: var(--ko-text-muted); }
.spaces i { display: block; height: 12px; border-radius: 2px; background: var(--ko-primary); }
.sp-1 { width: var(--ko-space-1); } .sp-2 { width: var(--ko-space-2); } .sp-3 { width: var(--ko-space-3); } .sp-4 { width: var(--ko-space-4); } .sp-5 { width: var(--ko-space-5); }
.sp-6 { width: var(--ko-space-6); } .sp-8 { width: var(--ko-space-8); } .sp-12 { width: var(--ko-space-12); } .sp-16 { width: var(--ko-space-16); }
.radii, .shadows { display: flex; flex-wrap: wrap; gap: 20px; }
.radii figure, .shadows figure { margin: 0; display: grid; justify-items: center; align-content: start; gap: 8px; font-size: 13px; line-height: 1.35; text-align: center; color: var(--ko-text-muted); }
.radii i { display: block; width: 72px; height: 72px; background: var(--ko-primary-soft); border: 1.5px solid var(--ko-primary); }
.rad-xs { border-radius: var(--ko-radius-xs); } .rad-sm { border-radius: var(--ko-radius-sm); } .rad-md { border-radius: var(--ko-radius-md); }
.rad-lg { border-radius: var(--ko-radius-lg); } .rad-full { border-radius: var(--ko-radius-full); }
.shadows i { display: block; width: 112px; height: 72px; border-radius: var(--ko-radius-md); background: var(--ko-surface-raised); }
.sh-0 { border: 1px solid var(--ko-line); } .sh-1 { box-shadow: var(--ko-shadow-1); } .sh-2 { box-shadow: var(--ko-shadow-2); }

/* Components */
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { min-width: 0; color: var(--ko-text); background: var(--ko-bg); border: 1px solid var(--ko-line); border-radius: var(--ko-radius-lg); padding: 20px; display: grid; gap: 24px; align-content: start;
  font-size: var(--ko-text-base); line-height: var(--ko-text-base-lh); }
.panel-title { margin: 0; font-size: 12px; font-weight: 600; color: var(--ko-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.group { display: grid; gap: 10px; min-width: 0; }
.group > .label { font-size: 12px; font-weight: 500; color: var(--ko-text-muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { row-gap: 10px; }
.group .row { column-gap: 12px; }

/* Object visuals */
.tones { display: flex; flex-wrap: wrap; gap: 12px 24px; margin: 16px 0 24px; }
.obj-panels { align-items: start; }
.obj-panels .panel { gap: 16px; }
.rules-grid { margin-top: 24px; }

/* Icons */
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.icons figure { margin: 0; display: grid; justify-items: center; gap: 10px; padding: 18px 8px 12px; border: 1px solid var(--ko-line); border-radius: var(--ko-radius-md); background: var(--ko-surface); font-size: 12px; text-align: center; color: var(--ko-text-muted); }
.icons .ko-icon { width: 24px; height: 24px; color: var(--ko-text); }

/* Motion */
.motion .m { display: grid; gap: 4px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.motion .m b { font-size: 15px; font-weight: 600; }
.motion .m span { color: var(--ko-text-muted); font-size: 14px; }
.motion .m i { display: block; width: 24px; height: 24px; margin-top: 12px; border-radius: var(--ko-radius-xs); background: var(--ko-primary);
  transition: transform var(--d-exit) var(--ko-motion-ease-exit), opacity var(--d-exit) var(--ko-motion-ease-exit); opacity: 0.55; }
.motion .m:hover i, .motion .m:focus-visible i { transform: translateX(8px); opacity: 1; transition: transform var(--d) var(--ko-motion-ease-enter), opacity var(--d) var(--ko-motion-ease-enter); }
.m-fast { --d: var(--ko-motion-fast); --d-exit: var(--ko-motion-fast-exit); }
.m-base { --d: var(--ko-motion-base); --d-exit: var(--ko-motion-base-exit); }
.m-slow { --d: var(--ko-motion-slow); --d-exit: var(--ko-motion-slow-exit); }
.motion + .cap { margin-bottom: 24px; }
.row-p { margin: 8px 0 10px !important; color: var(--ko-text) !important; }
.land { display: inline-block; padding: 4px 8px; border-radius: var(--ko-radius-xs); animation: ko-land-agent var(--ko-motion-highlight) var(--ko-motion-ease-exit); }
.tile:hover .land { animation: ko-land-agent-2 var(--ko-motion-highlight) var(--ko-motion-ease-exit); }
@keyframes ko-land-agent-2 { from { background-color: var(--ko-agent-soft); } }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 54em; }
.checklist li { position: relative; padding-left: 28px; font-size: 15px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border: 1px solid var(--ko-line-strong); border-radius: var(--ko-radius-xs); background: var(--ko-surface); }

/* Downloads */
.downloads { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 12px; border: 1px solid var(--ko-line); border-radius: var(--ko-radius-md); background: var(--ko-surface); color: inherit; text-decoration: none; }
.dl:hover { border-color: var(--ko-primary); }
.dl img, .dl .ext { grid-row: span 2; width: 36px; height: 36px; }
.dl .ext { display: grid; place-items: center; border-radius: var(--ko-radius-sm); background: var(--ko-primary-soft); color: var(--ko-primary-soft-text); font-size: 11px; font-weight: 700; }
.dl b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.dl span { font-size: 13px; color: var(--ko-text-muted); }
.on-cobalt-img { background: #0b1a4a; border-radius: var(--ko-radius-sm); padding: 4px; }
.on-dark-img { background: #0e121b; border-radius: var(--ko-radius-sm); padding: 4px; }
pre { margin: 0; padding: 20px; overflow-x: auto; border-radius: var(--ko-radius-md); background: #0e121b; color: #e6e9f0; font-size: 13px; line-height: 1.6; border: 1px solid var(--ko-line); }
pre code { font-size: inherit; }
pre .c { color: #9aa3b8; } pre .k { color: #8fa8ff; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 32px 0 48px; color: var(--ko-text-muted); font-size: 14px; }
.foot a { color: inherit; }

@media (max-width: 960px) {
  .s-head { grid-template-columns: 1fr; gap: 8px; }
  .s-head .num { padding-top: 0; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panels { grid-template-columns: minmax(0, 1fr); }
  .bar nav { display: none; }
  .hero-grid { grid-template-columns: 1fr 180px; gap: 32px; }
}
@media (max-width: 600px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .versions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding: 48px 0 40px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero .ko-element { max-width: 160px; }
  section.s { padding: 56px 0; }
  .type-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .construct { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .voice th, .voice td { padding: 10px; }
  .tile.row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .motion .m i, .motion .m:hover i { transition-duration: 1ms; }
}
