/* Портфолио: светлая «бумага», чернильный текст, моно-подписи. Акцент проекта — в --a на карточке. */
:root {
  --bg: #f3f1ec;
  --paper: #fbfaf7;
  --ink: #141413;
  --muted: #5f5b53;
  --line: #d9d5cc;
  --accent: #c8361b;
  --radius: 14px;
  --font: 'Geologica', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1240px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: .02em; }
.label { margin: 0 0 18px; color: var(--muted); text-transform: uppercase; }
.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 16px; z-index: 10; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; }

/* шапка */
.top { display: flex; align-items: center; justify-content: space-between; height: 84px; }
.mark { font-weight: 500; text-decoration: none; letter-spacing: -.01em; font-size: 18px; }
.mark span { color: var(--accent); margin: 0 2px; }
.top-nav { display: flex; gap: 28px; }
.top-nav a { text-decoration: none; color: var(--muted); padding: 12px 0; transition: color .3s; }
.top-nav a:hover { color: var(--ink); }

/* первый экран */
.hero { padding: clamp(48px, 10vw, 140px) 0 clamp(64px, 10vw, 120px); }
.hero-title {
  margin: 0;
  font-weight: 300;
  font-size: clamp(2.6rem, 8.4vw, 7.6rem);
  line-height: 1.02;
  letter-spacing: -.045em;
}
.hero-title em { font-style: normal; font-weight: 700; position: relative; white-space: nowrap; }
.hero-title em::after {
  content: ''; position: absolute; left: 0; right: .2em; bottom: .06em; height: .08em;
  background: var(--accent); transform-origin: left; transform: scaleX(0);
  transition: transform 1.2s var(--ease) .5s;
}
.hero-title.is-in em::after { transform: scaleX(1); }
.hero-grid {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(32px, 6vw, 96px);
  margin-top: clamp(40px, 6vw, 80px); padding-top: 32px; border-top: 1px solid var(--line);
}
.hero-lead { margin: 0; max-width: 34em; font-size: clamp(17px, 1.5vw, 20px); color: var(--muted); }
.hero-facts { list-style: none; margin: 0; padding: 0; }
.hero-facts li { display: flex; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hero-facts li span { color: var(--accent); }

/* проекты */
.work { border-top: 1px solid var(--line); }
.project { border-bottom: 1px solid var(--line); padding: clamp(56px, 8vw, 112px) 0; }
.project-in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.project:nth-child(even) .project-in { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.project:nth-child(even) .project-media { order: -1; }
.project-meta { position: sticky; top: 32px; }
.project-num { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 28px; }
.project-num i { width: 10px; height: 10px; border-radius: 50%; background: var(--a); }
.project-name {
  margin: 0; font-weight: 700; letter-spacing: -.04em; line-height: 1;
  font-size: clamp(2.4rem, 5.2vw, 4.6rem);
}
.project-niche { margin: 14px 0 0; color: var(--muted); }
.project-lead { margin: 28px 0 0; font-size: 19px; line-height: 1.55; }
.project-features { list-style: none; margin: 28px 0 0; padding: 0; font-size: 15px; color: var(--muted); }
.project-features li { position: relative; padding: 10px 0 10px 22px; border-top: 1px solid var(--line); }
.project-features li::before { content: '—'; position: absolute; left: 0; color: var(--ink); }
.project-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 1px solid var(--ink); text-decoration: none; font-weight: 500; font-size: 15px;
  transition: background .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease);
}
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { background: var(--a); border-color: var(--a); color: #fff; }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn svg { width: 14px; height: 14px; transition: transform .35s var(--ease); }
.btn:hover svg { transform: translate(2px, -2px); }

/* превью: браузерное окно с длинным скриншотом + телефон */
.project-media { position: relative; padding-bottom: clamp(40px, 6vw, 72px); }
.browser {
  display: block; position: relative; border-radius: var(--radius); background: var(--paper);
  border: 1px solid var(--line); box-shadow: 0 30px 60px -30px rgba(20, 20, 19, .35); overflow: hidden;
  text-decoration: none; transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.browser:hover { transform: translateY(-6px); box-shadow: 0 40px 80px -30px rgba(20, 20, 19, .45); }
.browser-bar { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.browser-bar b { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.browser-bar span { margin-left: 12px; color: var(--muted); font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.browser-view { aspect-ratio: 16 / 10; overflow: hidden; background: #111; }
.browser-view img {
  width: 100%; height: auto; transform: translateY(0);
  transition: transform 1.4s var(--ease);
}
.browser:hover .browser-view img, .browser:focus-visible .browser-view img {
  transform: translateY(calc(-1 * var(--shift, 0px)));
  transition: transform var(--dur, 20s) cubic-bezier(.3, 0, .7, 1);
}
.browser-hint {
  position: absolute; left: 14px; bottom: 14px; padding: 6px 12px; border-radius: 999px;
  background: rgba(20, 20, 19, .72); color: #fff; backdrop-filter: blur(6px); font-size: 11px;
  transition: opacity .4s;
}
.browser:hover .browser-hint { opacity: 0; }
.phone {
  position: absolute; right: clamp(-8px, -1vw, 0px); bottom: 0; width: clamp(110px, 22%, 190px);
  border-radius: 22px; border: 6px solid var(--ink); background: var(--ink); overflow: hidden;
  box-shadow: 0 24px 48px -20px rgba(20, 20, 19, .5);
}
.phone img { width: 100%; aspect-ratio: 375 / 760; object-fit: cover; object-position: top; border-radius: 16px; }

/* как сделано */
.how { padding: clamp(72px, 10vw, 140px) 0; }
.section-title { margin: 0 0 clamp(36px, 5vw, 64px); font-weight: 300; letter-spacing: -.04em; font-size: clamp(2.2rem, 5vw, 4.2rem); line-height: 1.05; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--ink); }
.how-grid article { padding: 28px 28px 8px 0; }
.how-grid article + article { padding-left: 28px; border-left: 1px solid var(--line); }
.how-grid h3 { margin: 0 0 12px; font-weight: 500; font-size: 22px; letter-spacing: -.02em; }
.how-grid p:not(.label) { margin: 0; color: var(--muted); font-size: 15px; }
code { font-family: var(--mono); font-size: .9em; background: var(--paper); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); }
.stack { margin-top: clamp(56px, 7vw, 96px); }
.stack-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.stack-list li { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px; background: var(--paper); }

/* подвал */
.foot { padding: clamp(56px, 8vw, 112px) 0 32px; border-top: 1px solid var(--line); }
.foot-big { margin: 0; font-weight: 300; letter-spacing: -.04em; line-height: 1.08; font-size: clamp(1.9rem, 4.6vw, 3.8rem); }
.foot-row { display: flex; justify-content: space-between; align-items: center; margin-top: clamp(48px, 7vw, 96px); color: var(--muted); }
.to-top { text-decoration: none; padding: 12px 0; }
.to-top:hover { color: var(--ink); }

/* появление */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .hero-grid, .project-in, .project:nth-child(even) .project-in { grid-template-columns: 1fr; }
  .project:nth-child(even) .project-media { order: 0; }
  .project-meta { position: static; }
  .how-grid { grid-template-columns: 1fr; }
  .how-grid article, .how-grid article + article { padding: 24px 0; border-left: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top-nav { gap: 18px; }
  .project-lead { font-size: 17px; }
  .phone { width: 30%; border-width: 4px; border-radius: 16px; }
  .phone img { border-radius: 12px; }
  .browser-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .browser, .browser-view img, .hero-title em::after { transition: none; }
  .hero-title em::after { transform: scaleX(1); }
  .browser:hover, .browser:hover .browser-view img, .browser:focus-visible .browser-view img { transform: none; transition: none; }
}
