/* ============================================================
   site.css — shared portfolio styles
   Canonical home: email-dev.com/portfolio/assets/css/site.css
   Reused by the hub (index.html) and every case page.
   Per-page brand accent: set on <body style="--grad:…; --coral:…">.
   Per-card brand accent on the hub: inline on .case-thumb.
   ============================================================ */

:root {
  /* ---- Shared neutrals (lifted from the email's dark-mode tokens) ---- */
  --ink: #0f1115;
  --panel: #1a1d24;
  --panel-2: #14171d;
  --line: #2a2e38;
  --text: #f4f5f7;
  --muted: #b4b8c2;
  --faint: #7a8192;

  /* ---- Brand accent (DEFAULT; pages/cards override) ---- */
  --grad: linear-gradient(135deg, #3a1c71 0%, #d76d77 55%, #ffaf7b 100%);
  --coral: #e08a8f;
  --coral-strong: #d76d77;

  /* ---- Type ---- */
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  /* ---- Layout ---- */
  --maxw: 920px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--coral); text-decoration: none; }
a:hover { color: #fff; }

:focus-visible { outline: 2px solid var(--coral-strong); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ---------- TOP BAR ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15,17,21,0.82);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand .mark { font-family: var(--display); font-weight: 700; letter-spacing: 5px; font-size: 18px; color: var(--text); }
.brand .role { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--faint); }
.topnav { display: flex; gap: 22px; font-family: var(--mono); font-size: 13px; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: #fff; }
.topnav .arr { color: var(--coral-strong); }

/* ---------- HERO (case page) ---------- */
.hero { padding: 88px 0 64px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--coral-strong); margin: 0 0 22px; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(40px, 7vw, 68px); line-height: 1.02; letter-spacing: -1.5px; margin: 0 0 22px; }
.lede { font-size: clamp(18px, 2.4vw, 21px); line-height: 1.55; color: var(--muted); max-width: 620px; margin: 0 0 32px; }
.lede strong { color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin: 0 0 36px; }
.chip { font-family: var(--mono); font-size: 12px; letter-spacing: 0.3px; color: var(--muted); border: 1px solid var(--line); border-radius: 100px; padding: 7px 14px; background: var(--panel-2); }
.actions { display: flex; flex-wrap: wrap; gap: 14px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 15px; padding: 13px 24px; border-radius: 8px; transition: transform .15s ease, filter .15s ease; }
.btn-primary { background-image: var(--grad); color: #16101f; }
.btn-primary:hover { filter: brightness(1.08); color: #16101f; }
.btn-ghost { border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--coral-strong); color: #fff; }
.btn:active { transform: translateY(1px); }

/* ---------- SECTIONS ---------- */
section { padding: 56px 0; border-top: 1px solid var(--line); }
.hero, .intro, .cases { border-top: none; }
.sec-label { font-family: var(--mono); font-size: 12px; letter-spacing: 3px; text-transform: uppercase; color: var(--faint); margin: 0 0 14px; }
h2 { font-family: var(--display); font-weight: 600; font-size: clamp(26px, 3.6vw, 34px); letter-spacing: -0.5px; margin: 0 0 18px; line-height: 1.12; }
.sec-intro { color: var(--muted); max-width: 640px; margin: 0 0 8px; }
.sec-intro strong { color: var(--text); font-weight: 600; }

/* ---------- FAULT CARDS (case page) ---------- */
.faults { display: flex; flex-direction: column; gap: 20px; margin-top: 36px; }
.fault { position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 26px 28px 26px 32px; }
.fault::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background-image: var(--grad); }
.fault .tag { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--coral); border: 1px solid var(--line); border-radius: 5px; padding: 4px 9px; margin: 0 0 16px; }
.fault h3 { font-family: var(--display); font-weight: 600; font-size: 21px; margin: 0 0 18px; letter-spacing: -0.3px; }
.qa { margin: 0 0 14px; }
.qa .k { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--faint); display: block; margin: 0 0 4px; }
.qa p { margin: 0; color: var(--muted); }
.qa.fix p { color: var(--text); }
.qa code, .inline-code { font-family: var(--mono); font-size: 0.86em; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--coral); }
pre { margin: 18px 0 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: #d7dbe4; }
pre .c { color: var(--faint); }
pre .t { color: var(--coral); }

/* ---------- PROOF GRID (case page) ----------
   .shot is a <button> that opens a native popover with the full render.
   One screenshot per frame: the tile crops it (object-fit:cover, top),
   the popover shows it whole. No JS — the popover is the platform's. */
.proof-grid { display: grid; gap: 18px; margin-top: 36px; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); }
figure { margin: 0; }

.shot {
  /* button reset */
  appearance: none; -webkit-appearance: none;
  font: inherit; color: inherit; text-align: inherit;
  cursor: pointer; padding: 0; width: 100%;
  /* tile (geometry kept from the original) */
  aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--panel-2);
  display: grid; place-items: center; position: relative;
  transition: border-color .15s ease, transform .15s ease;
}
.shot:hover, .shot:focus-visible { border-color: var(--coral-strong); transform: translateY(-2px); }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.shot .ph { font-family: var(--mono); font-size: 12px; letter-spacing: 1px; color: var(--faint); text-transform: uppercase; }
.shot .expand {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 11px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .4px; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.78), transparent);
  opacity: 0; transition: opacity .15s ease;
}
.shot:hover .expand, .shot:focus-visible .expand { opacity: 1; }

figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
figcaption .mode { color: var(--coral); }

/* ---------- PROOF POPOVER (native, no JS) ---------- */
.proof-pop {
  border: none; border-radius: 16px; padding: 0;
  width: 100%; max-width: min(460px, 94vw); max-height: 92vh; overflow: hidden;
  background: var(--panel); color: var(--text);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.8), 0 0 0 1px var(--line);
}
.proof-pop::backdrop { background: rgba(8,9,12,.72); }
.pop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; letter-spacing: .3px; color: var(--muted);
}
.pop-close {
  appearance: none; -webkit-appearance: none; background: transparent; border: none;
  cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1;
  padding: 2px 8px; border-radius: 6px;
}
.pop-close:hover { color: var(--text); background: var(--panel-2); }
.pop-body { padding: 18px; display: flex; justify-content: center; max-height: 74vh; overflow: auto; }
.pop-cap { padding: 0 18px 16px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: center; }
.pop-cap a { color: var(--coral); }
.pop-cap a:hover { color: #fff; }

.shot-full { width: 100%; display: block; border-radius: 8px; }            /* desktop frames */
.device {                                                                  /* mobile frames */
  width: 290px; max-width: 100%; height: min(520px, 70vh); overflow-y: auto;
  border: 9px solid #161922; border-radius: 28px; background: var(--ink);
  box-shadow: 0 0 0 1px var(--line); -webkit-overflow-scrolling: touch;
}
.device img { width: 100%; display: block; }

@media (prefers-reduced-motion: no-preference) {
  .proof-pop {
    opacity: 0; transform: scale(.97);
    transition: opacity .18s ease, transform .18s ease,
                overlay .18s ease allow-discrete, display .18s ease allow-discrete;
  }
  .proof-pop:popover-open { opacity: 1; transform: scale(1); }
  @starting-style { .proof-pop:popover-open { opacity: 0; transform: scale(.97); } }
}

/* ---------- TESTED (case page) ---------- */
.tested p { color: var(--muted); max-width: 660px; }
.tested strong { color: var(--text); font-weight: 600; }
.toollist { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.toollist li { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 6px 11px; background: var(--panel-2); }

/* ============================================================
   HUB / INDEX  (the portfolio landing — list of cases)
   ============================================================ */
.intro { padding: 92px 0 8px; }
.intro .who { font-family: var(--display); font-weight: 700; font-size: clamp(38px, 6.5vw, 62px); letter-spacing: -1.2px; margin: 0 0 18px; line-height: 1.02; }
.intro .tagline { font-size: clamp(18px, 2.4vw, 21px); color: var(--muted); max-width: 600px; margin: 0; line-height: 1.5; }
.intro .tagline strong { color: var(--text); font-weight: 600; }

.cases { padding: 44px 0 56px; }
.case-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 28px; }

.case-card {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; color: var(--text);
  transition: transform .18s ease, border-color .18s ease;
}
a.case-card:hover { transform: translateY(-3px); border-color: var(--coral-strong); color: var(--text); }

.case-thumb { 
  aspect-ratio: 16 / 10; 
  display: block; /* Убираем grid, если там теперь только картинка */
  position: relative; 
  overflow: hidden; /* Чтобы скругления карточки не резались углами картинки */
  background: var(--panel-2); /* Легкий фон, пока картинка грузится */
}

/* Настройки для picture и img, чтобы изображение вело себя адаптивно */
.case-thumb picture,
.case-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Картинка заполнит область 16/10 без деформации */
  object-position: top center; /* Скриншот письма лучше центрировать по верху */
}
.case-thumb .label { font-family: var(--display); font-weight: 700; letter-spacing: 6px; color: #fff; font-size: 22px; }

.case-body { padding: 20px 22px 24px; }
.case-num { font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--faint); display: block; margin: 0 0 8px; }
.case-card h3 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0 0 6px; letter-spacing: -0.3px; }
.case-desc { color: var(--muted); font-size: 15px; line-height: 1.5; margin: 0 0 14px; }
.case-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.case-tags span { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 3px 8px; }

/* coming-soon placeholder card */
.case-card.is-soon { border-style: dashed; }
.case-card.is-soon .case-thumb { background: var(--panel-2); }
.case-card.is-soon .case-thumb .label { color: var(--faint); }
.badge-soon { position: absolute; top: 12px; right: 12px; font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink); background: var(--coral); border-radius: 100px; padding: 4px 10px; }

/* ---------- FOOTER ---------- */
footer { border-top: 1px solid var(--line); padding: 40px 0 64px; color: var(--faint); font-size: 14px; }
footer .flinks { margin-top: 10px; display: flex; gap: 18px; flex-wrap: wrap; }
footer .flinks a { color: var(--muted); font-family: var(--mono); font-size: 13px; }

/* ---------- MOTION / A11Y ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero > *, .intro > * { animation: rise .6s ease both; }
  .hero .eyebrow, .intro .who { animation-delay: .04s; }
  .hero h1 { animation-delay: .08s; }
  .hero .lede, .intro .tagline { animation-delay: .14s; }
  .hero .chips { animation-delay: .20s; }
  .hero .actions { animation-delay: .26s; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

/* ---------- MOBILE ----------
   One consolidated breakpoint. Triggers at 640px because the horizontal
   header (brand + nav) runs out of room and overflows just under ~600px. */
@media (max-width: 640px) {
  body { font-size: 16px; }

  /* kill any horizontal overflow that pushes the page left */
  html, body { overflow-x: hidden; }
  .wrap { padding: 0 20px; }

  /* HEADER: stack brand over links, centered, AUTO height (the actual fix).
     The base rule locks height:60px — that's what was clipping the rows.
     height:auto + vertical padding lets the stacked content breathe. */
  .topbar .wrap {
    flex-direction: column;
    justify-content: center;
    height: auto;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
    text-align: center;
  }
  .brand { flex-direction: column; align-items: center; gap: 4px; }
  .topnav { justify-content: center; flex-wrap: wrap; gap: 20px; font-size: 12px; }

  /* section rhythm on small screens */
  .hero { padding: 56px 0 48px; }
  .intro { padding: 56px 0 8px; }
  .fault { padding: 22px 20px 22px 24px; }
}