/* ============================================================
   Портфолио — оформление витрины.
   Эталон палитры и типографики: design/preview.html («как у Клода»).
   Веб-шрифты не подключаем: системная Georgia для заголовков,
   гротеск для текста. Внешних запросов — ноль.
   ============================================================ */

/* ============ ТЁМНАЯ ТЕМА (по умолчанию) ============ */
:root {
  --bg:           #262624;
  --surface:      #30302E;
  --surface-2:    #3A3A37;
  --ink:          #F0EEE8;
  --muted:        #A8A49B;
  --faint:        #837F76;
  --line:         #403F3B;
  --line-2:       #4E4C47;
  --accent:       #D97757;
  --accent-ink:   #1F1E1C;
  --accent-weak:  #3A2A24;
  --ok:           #7FB08C;
  --ok-bg:        #233026;
  --warn:         #D9A45E;
  --warn-bg:      #332A1D;
  --glow:         rgba(217,119,87,.16);
  --grain-opacity: .045;

  --radius:    10px;
  --radius-lg: 14px;
  --font:      "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-head: Georgia, "Times New Roman", serif;
  --font-mono: Consolas, "Cascadia Mono", ui-monospace, Menlo, monospace;
  --maxw:      1120px;
  --ease:      cubic-bezier(.2,.7,.2,1);

  color-scheme: dark;
}

/* ============ СВЕТЛАЯ ТЕМА ============ */
:root[data-theme="light"] {
  --bg:           #F5F3EE;
  --surface:      #FDFCFA;
  --surface-2:    #EFEDE6;
  --ink:          #1F1E1C;
  --muted:        #6B6862;
  --faint:        #93908A;
  --line:         #E3E0D7;
  --line-2:       #D5D1C6;
  --accent:       #D97757;
  --accent-ink:   #FFFFFF;
  --accent-weak:  #F7EAE3;
  --ok:           #4C7C5A;
  --ok-bg:        #E8EFE8;
  --warn:         #B0762C;
  --warn-bg:      #F7EFE1;
  --glow:         rgba(217,119,87,.13);
  --grain-opacity: .06;
  color-scheme: light;
}

/* ============ БАЗА ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
h1, h2, h3 { margin: 0; font-family: var(--font-head); font-weight: 400; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(var(--maxw), 92vw); margin-inline: auto; }

/* ============ АТМОСФЕРА: свечение + зерно ============ */
.atmo { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.atmo .glow {
  position: absolute; top: -220px; right: -180px;
  width: 720px; height: 720px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  transition: background .25s var(--ease);
}
.atmo .grain {
  position: absolute; inset: 0; opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}
.page { position: relative; z-index: 1; }

/* ============ ШАПКА ============ */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top__in { display: flex; align-items: center; gap: 22px; height: 62px; }
.brand { font-family: var(--font-head); font-size: 19px; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .brand__tail { color: var(--accent); }
/* На телефоне имя сокращается до «М. Белоусов»: так в шапку влезают и тема,
   и вход для владельца, и кнопка входа. */
.brand__short { display: none; }
.menu { display: flex; gap: 4px; margin-left: 8px; }
.menu a { color: var(--muted); font-size: 14px; padding: 7px 11px; border-radius: 8px; }
.menu a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.top__act { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  white-space: nowrap; transition: background .15s, border-color .15s, transform .15s var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn .ic { font-size: 15px; line-height: 1; }
/* Две надписи на одной кнопке: длинная для широких экранов, короткая для телефона. */
.btn .txt-s { display: none; }
.btn.big { font-size: 15px; padding: 11px 20px; border-radius: 10px; }

/* ============ HERO ============ */
.hero { padding: clamp(56px, 9vh, 104px) 0 clamp(36px, 6vh, 56px); }
.eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(38px, 5.4vw, 62px); line-height: 1.06; letter-spacing: -0.025em;
  max-width: 16ch;
}
.hero h1 .thin { display: block; color: var(--muted); font-size: .58em; letter-spacing: -0.015em; margin-top: 14px; line-height: 1.25; font-style: italic; }
.hero__lead { color: var(--muted); font-size: 17.5px; line-height: 1.65; max-width: 60ch; margin-top: 28px; }
.hero__lead b { color: var(--ink); font-weight: 400; border-bottom: 1px solid var(--accent); }
.hero__cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 30px; }

.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-top: clamp(40px, 6vh, 60px);
}
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 16px; position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; left: 20px; bottom: 0; width: 36px; height: 2px; background: var(--accent); }
.kpi .v { font-family: var(--font-head); font-size: clamp(30px, 3vw, 42px); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13.5px; color: var(--muted); margin-top: 8px; line-height: 1.4; }
.rule { border: 0; border-top: 1px solid var(--line); margin: clamp(36px, 6vh, 56px) 0 0; }

/* ============ СЕКЦИИ ============ */
.sec { padding: clamp(40px, 6vh, 64px) 0 0; }
.sec__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.sec h2 { font-size: clamp(26px, 3vw, 32px); letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 12px; }
.count { font-family: var(--font); font-size: 12px; font-weight: 600; background: var(--accent); color: var(--accent-ink); border-radius: 20px; padding: 2px 9px; position: relative; top: -4px; }
.sec__note { font-size: 14.5px; color: var(--faint); max-width: 44ch; }

/* Карточки в строке одной высоты (растягиваются). Подробности раскрываются
   В ПОТОКЕ (решение Максима 08.09.2026): карточка становится выше, ряды ниже
   съезжают вниз и ничего не перекрывается. Раньше они выпадали поверх — так
   строка не росла, но раскрытая карточка накрывала соседей снизу. */
/* Карточки в ряду одной высоты: «Развернуть» и подвал стоят на одной линии.
   Раскрытие идёт в потоке — растёт весь ряд, ряды ниже съезжают. */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: stretch; }

/* ============ КАРТОЧКА ПРОЕКТА ============ */
.pcard {
  /* height: 100% — карточка занимает всю ячейку: подвалы и кнопки в ряду
     стоят на одной линии независимо от длины текста. */
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px 22px 18px; position: relative; overflow: hidden;
  transition: transform .28s var(--ease), border-color .2s;
}
.pcard::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.pcard:hover { transform: translateY(-3px); border-color: var(--line-2); }
.pcard:hover::before { transform: scaleX(1); }

.pcard__top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; min-height: 22px; }
.tag {
  font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); padding: 3px 9px; border-radius: 6px;
}
.badge { margin-left: auto; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.stand  { background: var(--ok-bg);      color: var(--ok); }
.badge.live   { background: var(--accent-weak); color: var(--accent); }
.badge.paused { background: var(--warn-bg);    color: var(--warn); }

.pcard h3 { font-size: 21px; line-height: 1.2; margin-bottom: 10px; }
.pcard p { font-size: 14.5px; line-height: 1.6; color: var(--muted); margin-bottom: 14px; }
/* margin-bottom: auto — «Развернуть» и подвал прижаты к низу карточки,
   поэтому во всей строке они выстроены по одной линии */
.pcard__who { font-size: 12.5px; color: var(--faint); margin-bottom: auto; padding-bottom: 18px; }
.pcard__foot {
  padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pcard__client { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.pcard__client small { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 600; margin-bottom: 2px; }
.pcard__go { font-size: 13.5px; font-weight: 600; color: var(--accent); display: inline-flex; gap: 6px; white-space: nowrap; }
.pcard__go:hover { text-decoration: none; }
.pcard__go .arr { transition: transform .28s var(--ease); }
.pcard:hover .pcard__go .arr { transform: translateX(4px); }

/* «Зачем» — одна фраза над описанием (вариант А, согласован 07.09.2026) */
.pcard__goal {
  font-style: italic; font-size: 15px !important; line-height: 1.5;
  color: var(--ink) !important; border-left: 2px solid var(--accent);
  padding-left: 11px; margin-bottom: 12px !important;
}

/* Подробности: нативный <details>, стрелка поворачивается при раскрытии.
   Кнопка прижата к низу карточки — во всей строке они на одной линии. */
.pcard__more { margin: 0 0 14px; }
.pcard__more summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--accent); padding: 4px 0;
}
.pcard__more summary::-webkit-details-marker { display: none; }
.pcard__more summary:hover { opacity: .82; }
.pcard__more summary .arr { transition: transform .2s var(--ease); display: inline-block; }
.pcard__more[open] summary .arr { transform: rotate(180deg); }
.pcard__body { padding-top: 8px; border-top: 1px solid var(--line); margin-top: 6px; }
.pcard__body p { font-size: 13.5px !important; line-height: 1.62; margin-bottom: 10px; }

/* Раскрытая карточка не подпрыгивает под курсором: подъём при наведении мешает
   читать длинный текст. */
.pcard:has(.pcard__more[open]):hover { transform: none; }
.pcard__stack { margin-top: 12px; }
.pcard__stack small {
  display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; margin-bottom: 7px;
}
.pcard__stack ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.pcard__stack li {
  font-size: 12px; color: var(--muted); background: var(--chip, transparent);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; white-space: nowrap;
}

.pcard--bot h3 { font-size: 19px; }
.pcard--bot p { font-size: 14px; }

/* Пока JS не отрисовал карточки */
.grid:empty::after { content: "Загрузка…"; color: var(--faint); font-size: 14px; }
noscript .card-note { display: block; color: var(--warn); font-size: 14px; padding: 12px 0; }

/* ============ ЗАКРЫТАЯ ЗОНА ============ */
.gate {
  margin-top: clamp(48px, 7vh, 72px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 44px); position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center;
}
.gate::before {
  content: ""; position: absolute; top: -140px; left: -120px; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-weak), transparent 72%); pointer-events: none;
}
.gate > * { position: relative; }
.gate h2 { font-size: clamp(26px, 3vw, 32px); letter-spacing: -0.02em; margin-bottom: 14px; }
.gate p { color: var(--muted); font-size: 15.5px; line-height: 1.65; max-width: 54ch; }
.gate ul { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; color: var(--muted); font-size: 14.5px; }
.gate li { display: flex; gap: 10px; align-items: baseline; }
.gate li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; position: relative; top: -2px; }

.keybox { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.keybox label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.keybox .row { display: flex; gap: 8px; }
.keybox input {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 16px; letter-spacing: .12em;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
}
.keybox input::placeholder { color: var(--faint); letter-spacing: .06em; font-family: var(--font); font-size: 14px; }
.keybox small { display: block; margin-top: 12px; color: var(--faint); font-size: 12.5px; line-height: 1.5; }

/* ============ ОБО МНЕ ============ */
.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: 44px; align-items: start; }
.about h2 { font-size: clamp(26px, 3vw, 32px); letter-spacing: -0.02em; margin-bottom: 16px; }
.about .lead { font-size: 17px; line-height: 1.6; max-width: 56ch; }
.about .lead + p { margin-top: 14px; color: var(--muted); font-size: 15px; line-height: 1.65; max-width: 58ch; }
.facts { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 20px; }
.fact { display: flex; gap: 16px; padding: 12px 0; font-size: 14.5px; }
.fact + .fact { border-top: 1px solid var(--line); }
.fact .k { color: var(--faint); min-width: 92px; }
.fact .v { color: var(--ink); }

/* ============ КОНТАКТЫ ============ */
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.contact {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  color: var(--ink); transition: border-color .2s, transform .28s var(--ease);
}
.contact:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.contact .k { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.contact .v { font-size: 15px; word-break: break-word; }

/* ============ ПОДВАЛ ============ */
/* ---------- правовые страницы (политика) ---------- */
.legal { max-width: 760px; padding: clamp(40px, 7vh, 72px) 0 24px; }
.legal h1 { font-size: clamp(30px, 4vw, 40px); line-height: 1.12; margin-bottom: 18px; }
.legal h2 { font-size: 20px; margin: 34px 0 10px; }
.legal p, .legal li { font-size: 15px; line-height: 1.7; color: var(--muted); }
.legal p { margin-bottom: 12px; }
.legal b { color: var(--ink); font-weight: 600; }
.legal ul { margin: 0 0 14px 20px; padding: 0; display: grid; gap: 8px; }
.legal__lead { font-size: 16.5px !important; color: var(--ink) !important; border-left: 2px solid var(--accent); padding-left: 14px; }
.legal__back { margin-top: 36px; }

.foot { margin-top: clamp(56px, 8vh, 88px); border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--faint); font-size: 13px; line-height: 1.6; }
.foot__in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot p { max-width: 62ch; }

/* ============ ПОЯВЛЕНИЕ ============ */
.rise { animation: rise .7s var(--ease) both; }
.rise[data-d="1"] { animation-delay: .08s }
.rise[data-d="2"] { animation-delay: .16s }
.rise[data-d="3"] { animation-delay: .24s }
.rise[data-d="4"] { animation-delay: .32s }
.rise[data-d="5"] { animation-delay: .42s }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; }
  .pcard, .contact, .btn { transition: none; }
  html { scroll-behavior: auto; }
}

/* ============ АДАПТИВ ============ */
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .gate { grid-template-columns: 1fr; gap: 26px; }
  .about { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 720px) {
  .menu { display: none; }
  .btn .txt-s { display: inline; }
  .top__in { height: 56px; gap: 10px; }
  .brand { font-size: 17px; }
  .brand .brand__tail { display: none; }
  .top__act { gap: 6px; }
  .btn.ghost { padding: 8px 10px; }
  .btn .txt-l { display: none; }
  .hero h1 .thin { font-size: .62em; }
  .grid { grid-template-columns: 1fr; }
  .pcard { padding: 20px 18px 16px; }
  .pcard:hover { transform: none; }
  .hero__lead { font-size: 16px; }
  .kpi { padding: 14px 16px 14px; }
  .keybox .row { flex-direction: column; }
}

@media (max-width: 480px) {
  /* Встроенный браузер Telegram на Android даёт около 360 px: шапка в прежнем
     виде туда не влезала и кнопка входа уезжала за край (09.09.2026). Ссылку владельца
     прячем — она остаётся в подвале. */
  .top__in { gap: 8px; }
  .brand { font-size: 15px; }
  .top__act { gap: 4px; }
  .brand__full { display: none; }
  .brand__short { display: inline; }
  .btn { padding: 8px 11px; font-size: 13px; }
}
