/* FgSNotes site — the page is a desktop, sections are islands (same idea as the app). */
:root {
    /* palette from alex-fgdev.ru and S.I.T Education: a deep green-black wall, darker cards, one teal accent */
    --wall: #090c0a; --island: #111713; --island-2: #161d18; --raised: #1d2620;
    --text: #f1f5ef; --muted: #98a398; --line: rgba(240, 255, 238, .13); --inset: #0c110e;
    --accent: #21aabe; --accent-hi: #62c7d4; --deep: #18628c; --mint: #91e48b; --on-accent: #061316;
    --radius: 14px; --radius-sm: 8px; --gap: 8px; --sx: clamp(20px, 4.5vw, 64px); --sy: clamp(36px, 5vw, 72px); --measure: 1200px;
    --ui: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --syn-keyword: #cf8e6d; --syn-string: #6aab73; --syn-number: #2aacb8; --syn-comment: #7a7e85; --syn-function: #56a8f5; --syn-type: #e0bb73; --syn-field: #c77dbb;
    color-scheme: dark;
}
:root[data-theme="light"] {
    --wall: #eef2e9; --island: #f8faf4; --island-2: #e8eee2; --raised: #dde5d6; --inset: #e4eade;
    --text: #121713; --muted: #5e695f; --line: rgba(18, 23, 19, .13); --mint: #2e8a3c; --accent: #147889; --accent-hi: #147889; --on-accent: #ffffff;
    --syn-keyword: #0033b3; --syn-string: #067d17; --syn-number: #1750eb; --syn-comment: #8c8c8c; --syn-function: #00627a; --syn-type: #7a5a00; --syn-field: #871094;
    color-scheme: light;
}
* { box-sizing: border-box; }
html { max-width: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0; overflow-x: clip; max-width: 100%; color: var(--text); font: 400 17px/1.6 var(--ui); -webkit-font-smoothing: antialiased; background: var(--wall);
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; border-radius: 8px; }
.page { width: 100%; margin: 0; padding: 84px var(--gap) var(--gap); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.island { background: var(--island); border-radius: var(--radius); padding: var(--sy) var(--sx); position: relative; overflow: hidden; }

/* Navigation: the only glass element on the page */
.nav { position: fixed; z-index: 50; top: 8px; left: var(--gap); right: var(--gap); }
.nav-bar { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border-radius: 12px;
    background: color-mix(in srgb, var(--island) 66%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.5); backdrop-filter: blur(22px) saturate(1.5);
    box-shadow: inset 0 .5px 0 #ffffff33, inset 0 0 0 .5px #ffffff1c, 0 10px 30px #0000003d; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; text-decoration: none; margin-right: auto; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav-links { display: flex; gap: 2px; }
.nav-links a { text-decoration: none; padding: 8px 14px; border-radius: 8px; font-size: 15px; color: var(--muted); transition: background-color .15s, color .15s; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); background: color-mix(in srgb, var(--text) 9%, transparent); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s, transform .3s cubic-bezier(.34, 1.5, .64, 1); }
.icon-btn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 9%, transparent); }
.icon-btn:active { transform: scale(.92); }
.menu-btn { display: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 24px; border-radius: 8px; border: 0; font: 600 16px var(--ui); text-decoration: none; cursor: pointer;
    background: var(--raised); color: var(--text); transition: background-color .15s, transform .3s cubic-bezier(.34, 1.5, .64, 1), box-shadow .2s; }
.btn:hover { background: color-mix(in srgb, var(--raised) 82%, var(--text)); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hi); }
.btn.primary:active { background: var(--deep); color: #fff; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; border-radius: 8px; }

/* Typography */
.eyebrow { font: 500 13px var(--mono); color: var(--muted); letter-spacing: .02em; }
h1 { font-size: clamp(34px, 4.8vw, 66px); line-height: 1.04; letter-spacing: -.03em; font-weight: 750; text-wrap: balance; }
h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.1; letter-spacing: -.028em; font-weight: 700; text-wrap: balance; }
h3 { font-size: 21px; line-height: 1.25; letter-spacing: -.015em; font-weight: 650; }
.lead { font-size: clamp(17px, 1.35vw, 20px); line-height: 1.5; color: var(--muted); max-width: 52ch; text-wrap: pretty; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--island-2); font: 500 13px var(--mono); color: var(--muted); }

/* Hero: copy on the left, the window on the right; every section shares one measure and one edge */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: clamp(28px, 4vw, 64px); padding: clamp(40px, 7vw, 104px) var(--sx) var(--sy); }
.hero .split-copy { gap: 22px; }
.hero h1 { max-width: 12ch; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.shot { margin: 0; border-radius: 10px; overflow: hidden; background: #1a1a1a; box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 9%, transparent), 0 20px 48px #0004; }
.shot img { width: 100%; height: auto; }

/* Open sections sit straight on the wall; islands alternate with them */
.flat { padding: var(--sy) var(--sx); }
.hero, .flat, .island:not(.foot) { --edge: 0px; }
.hero > *, .flat > *, .island:not(.foot):not(.themes-reel):not(.cell) > *, .themes-reel > .section-head { width: min(100%, var(--measure)); margin-inline: auto; }
.flat > .section-head { margin-bottom: clamp(24px, 3vw, 40px); }

/* Bento */
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(24px, 3vw, 40px); }
.section-head > * { min-width: 0; }
.section-head p { color: var(--muted); max-width: 46ch; }
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.cell { --pad: clamp(24px, 3vw, 44px); padding: var(--pad); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cell p { color: var(--muted); font-size: 16px; max-width: 52ch; }
.c-glass { grid-column: 1 / 8; grid-row: 1 / 3; padding-bottom: 0; }
.c-glass .shot { margin: 16px calc(var(--pad) * -1) 0; border-radius: 8px 8px 0 0; flex: 1; min-height: 220px; position: relative; box-shadow: none; }
.c-glass .shot img { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: cover; object-position: 12% 30%; }
.c-syntax { grid-column: 8 / 13; }
.c-stack, .c-files, .c-keys { grid-column: span 4; min-height: 280px; }
.fan { position: relative; height: 150px; margin-top: auto; }
.fan img { position: absolute; width: 60%; border-radius: 6px; box-shadow: 0 6px 18px #0004; transition: transform .45s cubic-bezier(.3, .9, .3, 1); }
.fan img:nth-child(1) { left: 0; top: 14px; transform: rotate(-5deg); }
.fan img:nth-child(2) { left: 20%; top: 0; z-index: 1; }
.fan img:nth-child(3) { right: 0; top: 20px; transform: rotate(5deg); }
.c-stack:hover .fan img:nth-child(1) { transform: rotate(-9deg) translateX(-10px); }
.c-stack:hover .fan img:nth-child(3) { transform: rotate(9deg) translateX(10px); }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.files span { font: 500 13px var(--mono); padding: 8px 12px; border-radius: 8px; background: var(--inset); color: var(--muted); }
kbd { font: 500 13px var(--mono); padding: 3px 8px; border-radius: 6px; background: var(--inset); color: var(--text); }
.c-tabs { grid-column: 8 / 13; }
.c-cells { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(20px, 3vw, 40px); align-items: center; }
.c-cells p + p { margin-top: 10px; }
.c-cells code:not(pre code) { padding: 1px 6px; border-radius: 4px; background: var(--inset); font: 400 .9em var(--mono); }
.nbm { display: grid; gap: 0; min-width: 0; }
.nbm > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: start; gap: 4px; background: var(--inset); }
.nbm pre.code { margin: 0; padding: 14px 16px 14px 0; background: transparent; }
.nbm-in { border-radius: 8px 8px 0 0; }
.nbm-out { border-radius: 0 0 8px 8px; border-top: 1px solid var(--island); }
.nbm-n { padding: 14px 0 0 10px; color: var(--muted); font: 400 12px var(--mono); }
.nbm-val { color: var(--accent); }
pre.code { margin: 8px 0 0; padding: 16px 18px; border-radius: 8px; background: var(--inset); font: 400 13.5px/1.65 var(--mono); overflow: auto; color: var(--text); }
.tk { color: var(--syn-keyword); } .ts { color: var(--syn-string); } .tn { color: var(--syn-number); } .tc { color: var(--syn-comment); font-style: italic; } .tf { color: var(--syn-function); } .tt { color: var(--syn-type); }
.minidoc { position: relative; min-height: 150px; margin-top: 4px; border-radius: 8px; background: var(--inset); overflow: hidden; }
.minidoc .pane { position: absolute; inset: 0; padding: 18px 20px; display: grid; gap: 8px; align-content: start; opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .35s cubic-bezier(.3, .9, .3, 1); pointer-events: none; font-size: 15px; }
.minidoc .pane.on { opacity: 1; transform: none; pointer-events: auto; }
.minidoc b { font: 500 14px var(--mono); color: var(--accent-hi); }
.minidoc span { color: var(--muted); display: flex; align-items: center; gap: 10px; }
.minidoc i { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--muted); flex: none; }
.minidoc i.ok { background: var(--accent); box-shadow: none; }

/* Segmented control with a sliding lens (same idea as the editor's mode switch) */
.seg { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 8px; background: var(--island-2); }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; color: var(--muted); font: 500 15px var(--ui); height: 40px; padding: 0 16px; border-radius: 8px; cursor: pointer; transition: color .15s, transform .3s cubic-bezier(.34, 1.5, .64, 1); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button:active { transform: scale(.95); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { color: var(--text); }
.lens { position: absolute; z-index: 0; left: 0; top: 0; width: 0; height: 0; border-radius: 8px; pointer-events: none; background: var(--raised); box-shadow: inset 0 .5px 0 #ffffff2e, 0 1px 4px #0003; }
.seg.on-cell { background: color-mix(in srgb, var(--island) 70%, transparent); }

/* Modes gallery */
.stage { position: relative; }
.stage .shot { aspect-ratio: 1800 / 1125; width: min(100%, calc(78dvh * 1.6), 880px); margin: 0 auto; background: #1a1a1a; }
.stage img { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: cover; opacity: 0; transition: opacity .35s ease; }
.stage img.on { opacity: 1; }

/* Themes carousel: drifts on its own, can be dragged, scrolled or stepped with the arrows */
.marquee { overflow-x: auto; scrollbar-width: none; cursor: grab; margin: 0 calc(var(--sx) * -1); }
.marquee::-webkit-scrollbar { display: none; }
.marquee.dragging { cursor: grabbing; user-select: none; }
.track { display: flex; width: max-content; padding-left: var(--sx); }
.tile { flex: none; width: clamp(240px, 21vw, 330px); margin-right: var(--gap); text-decoration: none; display: grid; gap: 12px; -webkit-user-drag: none; }
.tile img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: 8px; pointer-events: none; transition: transform .35s cubic-bezier(.3, .9, .3, 1); }
.tile:hover img { transform: translateY(-4px); }
.tile span { font-weight: 600; font-size: 16px; }
.reel-nav { display: flex; gap: 8px; align-items: center; }
.reel-nav .icon-btn { background: var(--island-2); }
.icon.flip { transform: scaleX(-1); }

/* Downloads */
.dl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.dl { background: var(--island); border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.dl .icon { width: 30px; height: 30px; stroke-width: 1.4; }
.dl ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; color: var(--muted); font-size: 15px; }
.dl li { display: flex; gap: 10px; align-items: baseline; }
.dl li b { font: 500 13px var(--mono); color: var(--mint); background: var(--island); padding: 2px 8px; border-radius: 8px; }
.dl .btn { margin-top: auto; }
.note { margin-top: 20px; color: var(--muted); font-size: 15px; max-width: 80ch; }

/* Footer */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; padding-block: 28px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-left: auto; }
.foot nav a { text-decoration: none; color: var(--muted); transition: color .15s; }
.foot nav a:hover { color: var(--text); }
.foot .copy { color: var(--muted); font-size: 14px; }
.keys { display: grid; gap: 10px; margin-top: auto; }
.keys div { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 15px; }
.minitabs { position: relative; display: flex; gap: 2px; padding: 4px; border-radius: 8px; background: var(--island-2); margin-top: 8px; overflow: hidden; }
.minitabs button { position: relative; z-index: 1; flex: 1; border: 0; background: transparent; color: var(--muted); height: 36px; border-radius: 6px; font: 500 14px var(--ui); cursor: pointer; transition: color .15s, transform .3s cubic-bezier(.34, 1.5, .64, 1); }
.minitabs button:active { transform: scale(.94); }
.minitabs button[aria-pressed="true"] { color: var(--text); }
.minitabs .lens { background: var(--raised); border-radius: 6px; }

/* Themes store */
.store-top { display: grid; gap: 28px; }
.store-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 48px; border-radius: 8px; border: 0; background: var(--island-2); color: var(--text); font: 400 16px var(--ui); padding: 0 16px 0 44px; }
.search input::placeholder { color: var(--muted); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.tcard { min-width: 0; background: var(--island); border-radius: 12px; padding: 12px 12px 20px; display: grid; gap: 14px; align-content: start; }
.tcard button.thumb { width: 100%; min-width: 0; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; overflow: hidden; display: block; }
.tcard img { border-radius: 8px; aspect-ratio: 8/5; object-fit: cover; width: 100%; transition: transform .4s cubic-bezier(.3, .9, .3, 1); }
.tcard .thumb:hover img { transform: scale(1.03); }
.tcard .meta { padding: 0 8px; display: grid; gap: 6px; }
.tcard .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tcard p { color: var(--muted); font-size: 15px; line-height: 1.45; }
.dots { display: flex; gap: 4px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px #ffffff2a; }
.tcard .actions { display: flex; gap: 8px; padding: 0 8px; }
.empty { padding: 56px 0; text-align: center; color: var(--muted); grid-column: 1 / -1; }
dialog.viewer { border: 0; padding: 0; border-radius: 12px; background: var(--island); color: var(--text); width: min(1080px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-shadow: 0 40px 100px #000a; }
dialog.viewer::backdrop { background: #05060dcc; backdrop-filter: blur(6px); }
dialog.viewer img { width: 100%; height: auto; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 16px 16px 24px; }

/* Docs: left toolbar plus one calm column */
.docs { display: grid; grid-template-columns: 220px minmax(0, 820px); justify-content: center; gap: clamp(16px, 3vw, 48px); align-items: start; padding: clamp(24px, 5vw, 72px) 0; }
.toc { position: sticky; top: 84px; display: grid; gap: 2px; padding: 8px; background: var(--island); border-radius: 12px; }
.toc a { text-decoration: none; padding: 9px 12px; border-radius: 8px; font-size: 15px; color: var(--muted); transition: background-color .15s, color .15s; }
.toc a:hover { color: var(--text); background: var(--island-2); }
.toc a.active { color: var(--text); background: var(--raised); }
.doc { min-width: 0; display: grid; gap: 40px; }
.doc section { display: grid; gap: 14px; }
.doc p, .doc li { color: var(--muted); max-width: 70ch; }
.doc p code, .doc li code, td code { font: 500 .88em var(--mono); background: var(--island); padding: 2px 7px; border-radius: 5px; color: var(--text); }
.doc ol { padding-left: 22px; display: grid; gap: 8px; margin: 0; }
.doc pre.code { background: var(--island); }
.callout { background: var(--island); border-radius: 8px; padding: 16px 20px; color: var(--muted); max-width: 70ch; }
.tokens { width: 100%; border-collapse: collapse; font-size: 15px; }
.tokens th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 8px 12px; }
.tokens td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; color: var(--muted); }
.tokens td:first-child { white-space: nowrap; }
.sw { display: inline-block; width: 22px; height: 22px; border-radius: 5px; vertical-align: middle; margin-right: 10px; box-shadow: inset 0 0 0 1px #ffffff26; }
.table-wrap { overflow-x: auto; border-radius: 8px; background: var(--island); }

@media (max-width: 960px) {
    .c-glass, .c-syntax, .c-tabs, .c-stack, .c-files, .c-keys { grid-column: 1 / -1; grid-row: auto; }
    .c-cells { grid-template-columns: minmax(0, 1fr); }
    .dl-grid { grid-template-columns: minmax(0, 1fr); }
    .docs { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
    .toc { position: static; grid-auto-flow: column; overflow-x: auto; scrollbar-width: none; }
    .toc a { white-space: nowrap; }
}
@media (max-width: 720px) {
    .nav-links { display: none; }
    .menu-btn { display: grid; }
    .nav .btn.small { display: none; }
    body { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition-duration: .01ms !important; }
}

/* Mobile menu: a full-screen panel revealed from the right (clip-path, so nothing sits outside the screen) */
.menu { display: none; }
@media (max-width: 720px) {
    .menu { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 60; background: var(--wall); padding: max(12px, env(safe-area-inset-top)) max(var(--gap), env(safe-area-inset-right)) max(var(--gap), env(safe-area-inset-bottom)) max(var(--gap), env(safe-area-inset-left));
        clip-path: inset(0 0 0 100%); visibility: hidden; transition: clip-path .45s cubic-bezier(.3, .9, .3, 1), visibility 0s linear .45s; }
    .menu-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; }
    .menu-links { display: grid; align-content: center; flex: 1; gap: 4px; padding: 0 16px; }
    .menu-links a { text-decoration: none; font-size: clamp(34px, 11vw, 52px); font-weight: 700; letter-spacing: -.03em; line-height: 1.2; padding: 10px 0; color: var(--muted); transition: color .15s, transform .35s cubic-bezier(.3, .9, .3, 1); }
    .menu-links a:hover, .menu-links a[aria-current="page"] { color: var(--text); }
    .menu-links a:active { transform: translateX(6px); }
    .menu-foot { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); padding: 0 var(--gap) 16px; }
    html.menu-open .menu { clip-path: inset(0); visibility: visible; transition-delay: 0s; }
    html.menu-open body { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .menu { transition: none; } }

/* Mobile version */
@media (max-width: 720px) {
    :root { --gap: 6px; }
    .page { padding: 76px max(var(--gap), env(safe-area-inset-right)) max(var(--gap), env(safe-area-inset-bottom)) max(var(--gap), env(safe-area-inset-left)); }
    .nav { top: max(6px, env(safe-area-inset-top)); left: max(var(--gap), env(safe-area-inset-left)); right: max(var(--gap), env(safe-area-inset-right)); }
    .nav-bar { padding: 6px 6px 6px 12px; }
    .island { padding: 28px 20px; }
    .flat { padding: 36px 20px; }
    .flat > .section-head, .section-head { margin-bottom: 20px; gap: 14px; }
    h2 { font-size: clamp(26px, 8vw, 34px); }
    h3 { font-size: 19px; }
    .lead { font-size: 17px; }
    /* hero: crop to the editor so the screenshot stays readable on a narrow screen */
    .hero { gap: 24px; padding: 28px 20px 8px; }
    .hero .shot { width: 100%; aspect-ratio: 5 / 4; margin: 0; border-radius: 8px; }
    .hero .shot img { width: 100%; height: 100% !important; object-fit: cover; object-position: 0 0; }
    .hero-cta { width: 100%; }
    .hero-cta .btn { flex: 1 1 140px; }
    /* features */
    .cell { --pad: 20px; min-height: 0; }
    .c-glass .shot { min-height: 200px; }
    .c-stack, .c-files, .c-keys { min-height: 0; }
    .fan { height: 130px; margin-top: 12px; }
    /* gallery and carousel */
    .stage .shot { width: 100%; }
    .seg { width: 100%; }
    .seg button { flex: 1 0 auto; }
    .marquee { margin: 0 -20px; }
    .track { padding-left: 20px; }
    .tile { width: 72vw; }
    .reel-nav .btn { display: none; }
    /* downloads */
    .dl { padding: 20px; }
    .dl .btn { width: 100%; }
    /* footer: comfortable tap targets */
    .foot { padding: 20px; gap: 12px 24px; }
    .foot nav { margin-left: 0; width: 100%; gap: 0 20px; }
    .foot nav a { padding: 10px 0; }
    /* theme store */
    .store-top .section-head { gap: 8px; }
    .search { max-width: none; flex-basis: 100%; }
    .store-tools .seg { order: 3; }
    .theme-grid { grid-template-columns: 1fr; }
    .tcard .actions .btn { flex: 1; }
    dialog.viewer { width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; margin: 0; }
    .viewer-bar h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .viewer-bar > div { flex: none; }
    .viewer-bar { padding: 12px 12px 12px 16px; position: sticky; top: 0; background: var(--island); z-index: 1; }
    /* docs: sections bar sticks under the header */
    .docs { padding-top: 8px; gap: 12px; }
    .doc { gap: 32px; padding-inline: 4px; }
    /* tokens table becomes a list: name on top, description below */
    .tokens, .tokens tbody, .tokens tr, .tokens td { display: block; }
    .tokens thead { display: none; }
    .tokens tr { padding: 10px 14px; border-top: 1px solid var(--line); }
    .tokens tr:first-child { border-top: 0; }
    .tokens td { padding: 2px 0; border: 0; font-size: 14px; }
    .tokens td:first-child { white-space: nowrap; }
    .doc pre.code { font-size: 12.5px; }
}
@media (max-width: 380px) {
    h1 { font-size: 34px; }
    .brand { font-size: 17px; }
    .nav-bar .icon-btn { width: 36px; }
}
@media (hover: none) {
    .tile:hover img, .c-stack:hover .fan img, .tcard .thumb:hover img { transform: none; }
}

/* Docs sections on mobile: a pinned strip of chips, the current section is filled with the accent */
@media (max-width: 960px) {
    .toc { position: sticky; top: 62px; z-index: 5; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; padding: 8px 6px; border-radius: 0; background: color-mix(in srgb, var(--wall) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
    .toc::-webkit-scrollbar { display: none; }
    .toc a { flex: none; display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 8px; background: var(--island); color: var(--muted); font-size: 15px; font-weight: 500; white-space: nowrap; transition: background-color .2s, color .2s; }
    .toc a:hover { background: var(--island-2); }
    .toc a.active { background: var(--accent); color: var(--on-accent); }
    html { scroll-padding-top: 128px; }
}

/* Theme store, mobile: a two-column wall of previews; details and download live in the viewer */
@media (max-width: 720px) {
    .store-top { padding-top: 24px; gap: 16px; }
    .store-top h2 { font-size: 30px; }
    .store-top .section-head p { font-size: 15px; }
    .store-tools { gap: 8px; }
    .store-tools .seg { min-width: 0; max-width: 100%; }
    #themeCount { margin-left: auto; }
    .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
    .tcard { padding: 6px 6px 10px; gap: 8px; }
    .tcard .meta { padding: 0 4px; gap: 0; }
    .tcard .meta h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tcard .meta p, .tcard .actions { display: none; }
    .tcard .dots { display: none; }
    .tcard .row { gap: 4px; }
    dialog.viewer { display: none; flex-direction: column; }
    dialog.viewer[open] { display: flex; }
    .viewer-body { flex: 1; overflow: auto; }
    .viewer-foot { position: sticky; bottom: 0; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); background: var(--island); }
    .viewer-foot .btn { width: 100%; }
}
.viewer-body { display: grid; gap: 14px; padding: 0 16px 16px; }
.viewer-body img { border-radius: 8px; }
.viewer-body p { color: var(--muted); }
.viewer-foot { padding: 0 16px 16px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.viewer-foot .dots i { width: 18px; height: 18px; }

/* Single-column grids must not grow to their widest child (that made phones zoom the page out) */
.store-top, .doc, .doc section, .tcard, .viewer-body, .keys, .menu-links, .minidoc .pane { grid-template-columns: minmax(0, 1fr); }

/* AI assistant and phone sections */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px); align-items: center; }
.split.rev { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); margin-top: clamp(40px, 5vw, 72px); }
.split-copy { display: grid; gap: 18px; align-content: start; }
.split-copy p { color: var(--muted); text-wrap: pretty; }
.split-copy .lead { max-width: 44ch; }
.split-copy .hero-cta { margin-top: 6px; }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.ticks li { position: relative; padding-left: 26px; color: var(--muted); font-size: 16px; line-height: 1.55; text-wrap: pretty; }
.ticks li::before { content: ''; position: absolute; left: 4px; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.ticks b { color: var(--text); font-weight: 600; }
.ticks.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 40px; margin-top: clamp(32px, 4vw, 56px); }
.phones { display: flex; justify-content: center; align-items: flex-start; gap: clamp(16px, 2.6vw, 40px); }
.phone-fig { margin: 0; flex: 0 1 250px; min-width: 0; display: grid; gap: 16px; }
.phone { padding: 9px; border-radius: 42px; background: #0b0b0c; box-shadow: inset 0 0 0 1.5px #3a3a3d, 0 28px 60px #0006; }
.phone img { width: 100%; border-radius: 34px; }
.phone-fig figcaption { color: var(--muted); font-size: 14px; line-height: 1.5; text-align: center; text-wrap: balance; padding: 0 8px; }
.note a { color: var(--accent-hi); }
.dl-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) {
    .hero, .split, .split.rev { grid-template-columns: minmax(0, 1fr); }
    .hero h1 { max-width: 16ch; }
    .split.rev .shot { order: 2; }
    .dl-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
    .ticks.cols { grid-template-columns: minmax(0, 1fr); }
    .phones { justify-content: flex-start; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 8px 12px; margin: 0 -8px; scrollbar-width: none; }
    .phones::-webkit-scrollbar { display: none; }
    .phone-fig { flex: 0 0 min(72vw, 280px); scroll-snap-align: center; }
    }

.flat > .note, .island > .note { margin-inline: 0; }
.dl .btn { padding: 0 16px; font-size: 15px; white-space: nowrap; }

/* the features block: a little narrower than the other sections */
.bento { width: min(calc(100% - 2 * clamp(0px, 3vw, 40px)), 1200px); margin-inline: auto; }
@media (max-width: 720px) { .bento { width: 100%; } }

/* Header after S.I.T Education: a transparent bar with the logo, a pill-shaped navigation capsule and round buttons; it gets a blurred background on scroll */
.nav { top: 14px; left: 50%; right: auto; width: min(1240px, calc(100vw - 32px)); transform: translateX(-50%); transition: top .3s; }
.nav.is-scrolled { top: 8px; }
.nav-bar { padding: 0 10px 0 16px; height: 68px; gap: 10px; background: transparent; border: 1px solid transparent; border-radius: var(--radius); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; transition: background .3s, border-color .3s; }
.nav.is-scrolled .nav-bar { background: color-mix(in srgb, var(--wall) 82%, transparent); border-color: var(--line); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.brand { gap: 14px; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.brand img { width: 38px; height: 38px; border-radius: 10px; }
.brand-sep { width: 1px; height: 26px; background: color-mix(in srgb, var(--text) 28%, transparent); }
.nav-links { gap: 2px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--island) 80%, transparent); }
.nav-links a { padding: 9px 15px; border-radius: 999px; font-size: 14.5px; font-weight: 600; }
.nav-links a:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); }
.nav-links a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.nav .icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: color-mix(in srgb, var(--island) 80%, transparent); color: var(--text); }
.nav .icon-btn:hover { border-color: color-mix(in srgb, var(--text) 28%, transparent); background: var(--island-2); }
.nav .btn.small { border-radius: 999px; min-height: 44px; padding: 0 20px; }
@media (max-width: 720px) {
    .nav { width: calc(100vw - 16px); top: 8px; }
    .nav-bar { height: 60px; padding: 0 8px 0 12px; }
    .brand-sep { display: none; }
    .nav-bar { background: color-mix(in srgb, var(--wall) 82%, transparent); border-color: var(--line); }
}

/* One shell for the header, the hero, the sections and the cards: the same left and right edge everywhere, centred */
:root { --shell: min(calc(100vw - 32px), 1240px); }
.page > .hero, .page > .flat, .page > .island, .page > .bento, .page > .foot { width: var(--shell); margin-inline: auto; }
.hero > *, .flat > *, .island > * { width: auto; margin-inline: 0; }
.bento { width: var(--shell); }
.hero > .shot, .hero > .split-copy { min-width: 0; }
@media (max-width: 720px) { :root { --shell: calc(100vw - 16px); } .page > .hero, .page > .flat, .page > .island, .page > .bento, .page > .foot { width: var(--shell); } }
