:root {
  --bg: #F2EDE4;
  --surface: #FAF7F1;
  --text: #1D1B18;
  --muted: #696257;
  --accent: #A13B18;
  --border: rgba(29, 27, 24, .14);
  --ink: #1C1A17;
  --ink-text: #EEE8DC;
  --ink-muted: #A49C8E;
  --ink-accent: #E8845A;
  --serif: 'Literata', Georgia, 'Times New Roman', serif;
  --sans: 'Onest', 'Segoe UI', system-ui, sans-serif;
  --gut: clamp(20px, 4vw, 48px);
  --r: 10px;
  --r-phone: 30px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --section: clamp(4.5rem, 10vw, 9rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .08 0 0 0 0 .05 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 400; }
p, dl, dd, ol, ul { margin: 0; padding: 0; }
::selection { background: var(--accent); color: var(--surface); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1240px, 100% - 2 * var(--gut)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; padding: 10px 14px; background: var(--text); color: var(--surface); border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }

/* Шапка */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding-block: 22px;
  font-size: .9375rem;
}
.brand { font-weight: 600; text-decoration: none; letter-spacing: -.01em; }
.top nav { display: flex; gap: 28px; }
.top nav a, .brand { padding-block: 8px; }
.top nav a { text-decoration: none; color: var(--muted); background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: color .25s, background-size .35s var(--ease); }
.top nav a:hover { color: var(--text); background-size: 100% 1px; }
.clock { justify-self: end; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Первый экран */
.hero { padding-top: clamp(3rem, 9vw, 7.5rem); }
.hero-kicker { color: var(--muted); font-size: .9375rem; margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.hero-title {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 350;
  font-size: clamp(2.9rem, 8.4vw, 7.6rem);
  line-height: .98;
  letter-spacing: -.035em;
}
.hero-title em { font-style: italic; font-weight: 300; color: var(--accent); }
.ln { display: block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; }
.ln > span { display: block; animation: rise 1s var(--ease) both; animation-delay: calc(var(--i) * 110ms + 120ms); }
.ln:nth-child(2) { padding-left: clamp(0px, 9vw, 9rem); }
@keyframes rise { from { transform: translateY(108%); } }

.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 34rem) auto;
  justify-content: space-between;
  align-items: end;
  gap: 24px 48px;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}
.hero-text { color: var(--muted); font-size: clamp(1.0625rem, 1.4vw, 1.1875rem); }
.hero-link {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 1px solid var(--text); border-radius: 999px;
  text-decoration: none; font-weight: 500;
  transition: background-color .3s, color .3s;
}
.hero-link span { transition: transform .35s var(--ease); }
.hero-link:hover { background: var(--text); color: var(--surface); }
.hero-link:hover span { transform: translateY(3px); }
.hero-link:active { transform: scale(.98); }

/* Телефоны, разложенные на столе */
.desk {
  list-style: none;
  display: flex;
  justify-content: center;
  margin: clamp(3.5rem, 8vw, 6rem) auto 0;
  padding: 0 0 40px;
}
.desk li {
  flex: 0 0 auto;
  width: clamp(150px, 15.5vw, 205px);
  margin-inline: calc(clamp(150px, 15.5vw, 205px) * -0.06);
  transform: translateY(var(--y)) rotate(var(--r));
  animation: deal .9s var(--ease) both;
  animation-delay: calc(var(--d) * 70ms + 520ms);
  transition: transform .45s var(--ease);
  position: relative;
}
@keyframes deal { from { opacity: 0; transform: translateY(calc(var(--y) + 60px)) rotate(0deg); } }
.desk a { display: block; text-decoration: none; }
.desk img {
  border-radius: 22px;
  border: 5px solid var(--ink);
  background: var(--ink);
  box-shadow: 0 2px 4px rgba(40, 28, 16, .12), 0 24px 40px -18px rgba(40, 28, 16, .45);
}
.desk span {
  display: block; margin-top: 14px; text-align: center;
  font-size: .875rem; color: var(--muted);
  transition: color .3s;
}
.desk li:hover, .desk li:focus-within { transform: translateY(calc(var(--y) - 14px)) rotate(0deg); z-index: 2; }
.desk li:hover span, .desk li:focus-within span { color: var(--text); }

/* Работы */
.works { padding-top: var(--section); }
.works-head {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap;
  gap: 12px 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--text);
}
.works-head h2 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.02em; }
.works-head p { color: var(--muted); max-width: 30rem; }

.work { padding-block: clamp(3.5rem, 8vw, 7rem); }
.work + .work { border-top: 1px solid var(--border); }

.work-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 20rem);
  gap: 20px clamp(24px, 4vw, 56px);
  align-items: start;
}
.work-num {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(3.5rem, 8vw, 7rem);
  line-height: .8;
  color: var(--accent);
  letter-spacing: -.04em;
}
.work-title h3 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5.4vw, 4.6rem);
  line-height: 1;
  letter-spacing: -.03em;
}
.lede { margin-top: 18px; font-size: clamp(1.125rem, 1.6vw, 1.3125rem); line-height: 1.45; max-width: 34rem; }
.meta { display: grid; gap: 14px; padding-top: 8px; font-size: .9375rem; }
.meta div { padding-top: 10px; border-top: 1px solid var(--border); }
.meta dt { color: var(--muted); font-size: .8125rem; }

/* Скриншоты */
.shots {
  position: relative;
  margin: clamp(2.5rem, 5vw, 4rem) 0 0;
  padding-right: clamp(40px, 13%, 170px);
  padding-bottom: clamp(48px, 9%, 110px);
}
.work--flip .shots { padding-right: 0; padding-left: clamp(40px, 13%, 170px); }
.browser {
  display: block;
  text-decoration: none;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(40, 28, 16, .06), 0 40px 70px -40px rgba(40, 28, 16, .5);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.bar {
  display: flex; justify-content: space-between; align-items: center;
  height: 40px; padding: 0 16px;
  font-size: .8125rem; color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.bar span { transition: transform .35s var(--ease), color .3s; }
.browser:hover { transform: translateY(-4px); box-shadow: 0 1px 2px rgba(40, 28, 16, .06), 0 50px 80px -40px rgba(40, 28, 16, .55); }
.browser:hover .bar span { transform: translate(2px, -2px); color: var(--accent); }
.phone {
  position: absolute;
  right: 0;
  bottom: 0;
  width: clamp(120px, 21%, 260px);
  border-radius: var(--r-phone);
  border: 6px solid var(--ink);
  background: var(--ink);
  box-shadow: 0 2px 4px rgba(40, 28, 16, .15), 0 40px 60px -30px rgba(40, 28, 16, .6);
}
.work--flip .phone { right: auto; left: 0; }

/* Что есть и почему */
.work-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 40px clamp(32px, 6vw, 96px);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.story { align-self: start; position: sticky; top: 32px; }
.story p { font-family: var(--serif); font-size: clamp(1.25rem, 1.9vw, 1.5rem); line-height: 1.4; letter-spacing: -.01em; }
.visit {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; margin-top: 24px;
  font-weight: 500; text-decoration: none; color: var(--accent);
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 8px) / 100% 1px no-repeat;
  transition: background-size .4s var(--ease);
}
.visit span { transition: transform .35s var(--ease); }
.visit:hover { background-size: 0 1px; background-position-x: 100%; }
.visit:hover span { transform: translate(3px, -3px); }

.cols, .features dl > div {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr);
  gap: 6px 32px;
}
.cols { font-size: .8125rem; color: var(--muted); padding-bottom: 12px; }
.features dl > div { padding-block: 18px; border-top: 1px solid var(--border); }
.features dt { font-weight: 600; line-height: 1.4; }
.features dd { color: var(--muted); }

/* Цифры */
.figures { background: var(--ink); color: var(--ink-text); padding-block: var(--section); margin-block: clamp(1rem, 3vw, 2rem); }
.figures-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 4vw, 4rem);
  align-items: end;
}
.fig { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid rgba(238, 232, 220, .16); }
.fig strong { font-family: var(--serif); font-weight: 300; font-size: clamp(3rem, 7vw, 5.5rem); line-height: .9; letter-spacing: -.04em; }
.fig small { font-size: .35em; letter-spacing: 0; font-weight: 400; color: var(--ink-muted); }
.fig span { color: var(--ink-muted); max-width: 18rem; }
.fig--big { grid-row: span 2; align-self: stretch; align-content: end; }
.fig--big strong { font-size: clamp(6rem, 17vw, 14rem); color: var(--ink-accent); font-style: italic; }
.figures-grid .fig:nth-child(4) { grid-column: 2 / span 2; }

/* Как работаю */
.how {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 40px clamp(32px, 6vw, 96px);
  padding-block: var(--section);
  border-top: 1px solid var(--text);
}
.how h2 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.02em; line-height: 1.05; }
.how-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 40px 48px; counter-reset: how; }
.how-list li { counter-increment: how; padding-top: 18px; border-top: 1px solid var(--border); }
.how-list h3 { font-family: var(--serif); font-size: 1.375rem; letter-spacing: -.01em; margin-bottom: 10px; }
.how-list h3::before { content: counter(how) ". "; color: var(--accent); font-style: italic; }
.how-list p { color: var(--muted); }
.stack { grid-column: 2; color: var(--muted); font-size: .9375rem; }

/* Связаться */
.contact { background: var(--surface); border-block: 1px solid var(--border); padding-block: var(--section); }
.contact-inner { display: grid; gap: 20px; }
.contact h2 { font-family: var(--serif); font-weight: 350; font-size: clamp(2.6rem, 7vw, 6rem); line-height: 1; letter-spacing: -.035em; max-width: 14ch; }
.contact p { color: var(--muted); font-size: 1.1875rem; max-width: 34rem; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.contact-links a {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  border-radius: 999px; text-decoration: none; font-weight: 500;
  border: 1px solid var(--text);
  transition: background-color .3s, color .3s, transform .2s;
}
.contact-links a:first-child { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.contact-links a:hover { background: var(--text); border-color: var(--text); color: var(--surface); }
.contact-links a:active { transform: scale(.98); }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; padding-block: 28px 36px; color: var(--muted); font-size: .875rem; }

/* Появление при прокрутке: базовое состояние видимое, прячем только при работающем JS */
.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--stagger, 0ms); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* Адаптив */
@media (max-width: 1000px) {
  .work-head { grid-template-columns: auto minmax(0, 1fr); }
  .meta { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .work-body, .how { grid-template-columns: 1fr; }
  .story { position: static; }
  .stack { grid-column: auto; }
}
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr auto; }
  .top nav { display: none; }
  .ln:nth-child(2) { padding-left: 0; }
  .hero-foot { grid-template-columns: 1fr; }
  .hero-link { justify-self: start; }
  .desk {
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: calc(-1 * var(--gut));
    padding: 24px var(--gut) 40px;
    scrollbar-width: none;
  }
  .desk::-webkit-scrollbar { display: none; }
  .desk li { width: 46vw; margin-inline: 0 -2vw; scroll-snap-align: center; }
  .work-head { grid-template-columns: 1fr; gap: 12px; }
  .work-num { font-size: 3rem; }
  .meta { grid-template-columns: 1fr; gap: 10px; }
  .shots, .work--flip .shots { padding: 0 0 56px; }
  .phone, .work--flip .phone { width: 31%; right: 10px; left: auto; border-width: 4px; border-radius: 18px; }
  .cols { display: none; }
  .features dl > div { grid-template-columns: 1fr; }
  .figures-grid { grid-template-columns: 1fr 1fr; }
  .fig--big { grid-row: auto; grid-column: 1 / -1; }
  .figures-grid .fig:nth-child(4) { grid-column: auto; }
  .how-list { grid-template-columns: 1fr; gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
