/* Три темы: «индиго» (по умолчанию), «день», «ночь». Переключает theme.js через data-theme. */
:root {
  color-scheme: light;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --bg: oklch(0.965 0.012 270); --surface: oklch(1 0 0); --ink: oklch(0.21 0.03 270); --mute: oklch(0.47 0.04 270);
  --line: oklch(0.89 0.015 270); --accent: oklch(0.5 0.22 275);
  --feature: linear-gradient(135deg, oklch(0.4 0.2 262), oklch(0.45 0.24 290) 55%, oklch(0.5 0.22 325));
  --feature-ink: oklch(0.99 0 0); --feature-mute: oklch(0.93 0.03 290);
}
[data-theme="light"] {
  --bg: oklch(0.97 0.002 265); --ink: oklch(0.2 0.004 265); --mute: oklch(0.48 0.005 265);
  --line: oklch(0.9 0.003 265); --accent: oklch(0.52 0.19 255);
  --feature: oklch(0.2 0.004 265); --feature-ink: oklch(0.98 0 0); --feature-mute: oklch(0.78 0 0);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.13 0 0); --surface: oklch(0.2 0 0); --ink: oklch(0.96 0 0); --mute: oklch(0.7 0 0);
  --line: oklch(0.28 0 0); --accent: oklch(0.96 0 0);
  --feature: oklch(0.96 0 0); --feature-ink: oklch(0.15 0 0); --feature-mute: oklch(0.38 0 0);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); accent-color: var(--accent); scrollbar-color: var(--line) var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; font: clamp(1.0625rem, 1rem + .25vw, 1.1875rem)/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
html, header, article, pre, code, #theme { transition: background-color .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Полоса на всю ширину, содержимое — по центру, без обёрток */
header, main, footer { padding-inline: max(.75rem, calc((100% - 64rem) / 2)); }

/* Шапка прилипает, страница просвечивает под ней */
header { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .25rem 1rem; min-height: 3.25rem; padding-block: .4rem; background: color-mix(in oklch, var(--bg) 72%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid color-mix(in oklch, var(--line) 70%, transparent); font-size: .875rem; }
.site { display: inline-flex; align-items: center; gap: .55rem; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; color: inherit; text-decoration: none; }
.site::before { content: ""; width: 1.4rem; height: 1.4rem; background: url(/favicon.svg) center / contain no-repeat; }
nav { display: flex; align-items: center; gap: 1rem; }
nav a { color: var(--mute); text-decoration: none; }
nav a:hover { color: var(--ink); }
#theme { min-height: 2.25rem; padding: 0 .9rem; font: inherit; font-weight: 500; color: var(--ink); background: var(--surface); border: 0; border-radius: 999px; cursor: pointer; }
#theme:hover { background: var(--ink); color: var(--bg); }

main { padding-bottom: clamp(3rem, 8vw, 6rem); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2 { text-wrap: balance; }
h1 { margin: 0 0 .75rem; font-size: clamp(2rem, 1.2rem + 3.4vw, 3.25rem); line-height: 1.06; letter-spacing: -.03em; }
h2 { margin: 3rem 0 .75rem; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; }
h3 { margin: 2rem 0 .4rem; font-size: 1.2rem; letter-spacing: -.01em; }
time { color: var(--mute); font-size: .875rem; font-variant-numeric: tabular-nums; }

/* Витрина: главная и 404 */
.hero { padding-block: clamp(3rem, 9vw, 7rem) clamp(2.5rem, 7vw, 5rem); text-align: center; }
.hero h1 { max-width: 16ch; margin-inline: auto; font-size: clamp(2.5rem, 1rem + 6.5vw, 5rem); line-height: 1.04; }
.hero p { max-width: 36ch; margin: 1.25rem auto 0; color: var(--mute); font-size: clamp(1.15rem, 1rem + 1vw, 1.5rem); line-height: 1.35; }
.hero .big { max-width: none; margin: 0 0 .5rem; font-size: clamp(4.5rem, 20vw, 6rem); font-weight: 700; line-height: 1; letter-spacing: -.04em; color: var(--ink); }
.hero .big + h1 { font-size: clamp(1.6rem, 1rem + 2.5vw, 2.5rem); }
.hero ul { max-width: 36rem; margin: 2rem auto 0; padding: 0; list-style: none; }
.hero li + li { margin-top: .5rem; }

/* Плитки записей: первая — крупная, на всю ширину */
.posts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.posts article { position: relative; display: grid; grid-template: auto 1fr auto / 1fr auto; gap: .75rem 1rem; padding: clamp(1.5rem, 4vw, 2.5rem); background: var(--surface); border-radius: 1.5rem; transition: transform .5s var(--ease), box-shadow .5s var(--ease), background-color .4s var(--ease), color .4s var(--ease); }
.posts article:hover { transform: scale(1.012); box-shadow: 0 1.5rem 3rem -1.5rem oklch(0 0 0 / .3); }
.posts h2, .posts p { grid-column: 1 / -1; margin: 0; }
.posts h2 { font-size: clamp(1.35rem, 1rem + 1.2vw, 1.75rem); }
.posts h2 a { color: inherit; text-decoration: none; }
.posts h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 1.5rem; } /* вся плитка — ссылка */
.posts h2 a:focus-visible { outline: none; }
.posts h2 a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }
.posts p { max-width: 52ch; color: var(--mute); }
.posts time, .more { align-self: end; }
.more { font-size: .9375rem; font-weight: 500; color: var(--accent); }
.more::after { content: ""; display: inline-block; width: .42em; height: .42em; margin-left: .35em; border: solid currentColor; border-width: 0 .1em .1em 0; transform: translateY(-.1em) rotate(-45deg); }
.posts article:first-child { grid-column: 1 / -1; min-height: clamp(17rem, 34vw, 23rem); padding: clamp(1.75rem, 6vw, 4rem); background: var(--feature); color: var(--feature-ink); }
.posts article:first-child h2 { max-width: 18ch; font-size: clamp(1.9rem, 1rem + 3.6vw, 3.25rem); line-height: 1.06; letter-spacing: -.03em; }
.posts article:first-child p { max-width: 42ch; font-size: 1.15em; line-height: 1.45; }
.posts article:first-child :is(p, time) { color: var(--feature-mute); }
.posts article:first-child .more { color: var(--feature-ink); }
@media (max-width: 44rem) { .posts { grid-template-columns: 1fr; } }

#about { max-width: 40rem; margin: clamp(3.5rem, 9vw, 7rem) auto 0; text-align: center; scroll-margin-top: 5rem; }
#about h2 { margin-top: 0; font-size: clamp(1.75rem, 1rem + 2.5vw, 2.5rem); letter-spacing: -.03em; }
#about p { color: var(--mute); }

/* Запись — белый лист на сером фоне */
main > article { max-width: 50rem; margin: clamp(.75rem, 4vw, 3rem) auto 0; padding: clamp(1.5rem, 6vw, 4.5rem); background: var(--surface); border-radius: 1.75rem; }
main > article > time { display: block; margin-bottom: 2rem; }
.lead { font-size: 1.3em; font-weight: 500; line-height: 1.4; letter-spacing: -.01em; }
ul { padding-left: 1.2em; }
li::marker { color: var(--mute); }
code { padding: .15em .4em; font: .88em/1.5 var(--mono); background: var(--bg); border-radius: 6px; }
pre { padding: 1.1rem 1.25rem; overflow-x: auto; background: var(--bg); border-radius: 14px; }
pre code { padding: 0; background: none; }

footer { padding-block: 2rem 3rem; border-top: 1px solid var(--line); color: var(--mute); font-size: .8125rem; text-align: center; }
