:root {
  --paper: #f1ede4;
  --paper-2: #e9e4d8;
  --ink: #1b1a17;
  --muted: #6b665c;
  --line: #d3ccbd;
  --accent: #e5481f;
  --sans: "Onest", -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --pad: clamp(18px, 4vw, 56px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: #fff; }

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 8px 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

.label {
  font: 500 11px/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- шапка ---------- */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 22px var(--pad);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 19px; letter-spacing: -.02em; text-decoration: none;
  justify-self: start;
}
.logo__sun { width: 26px; height: 26px; fill: var(--accent); stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.logo__sun circle { stroke: none; }
.logo__rays { transform-origin: 16px 16px; transition: transform .9s var(--ease); }
.logo:hover .logo__rays { transform: rotate(90deg); }

.nav { display: flex; gap: 28px; font-size: 15px; }
.nav a { text-decoration: none; position: relative; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -3px; height: 1.5px;
  background: var(--accent); transition: right .3s var(--ease);
}
.nav a:hover::after { right: 0; }

.clock { justify-self: end; font: 400 13px/1 var(--mono); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.clock__dot { width: 7px; height: 7px; border-radius: 50%; background: #3f9a54; box-shadow: 0 0 0 0 rgba(63,154,84,.5); animation: ping 2.4s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(63,154,84,0); } 100% { box-shadow: 0 0 0 0 rgba(63,154,84,0); } }

/* ---------- первый экран ---------- */
.hero { padding: clamp(48px, 9vw, 130px) var(--pad) clamp(40px, 6vw, 90px); }
.hero__title {
  font-weight: 500;
  font-size: clamp(40px, 7.4vw, 118px);
  line-height: .98;
  letter-spacing: -.045em;
  max-width: 13.5em;
}
.mark { position: relative; white-space: nowrap; }
.mark svg {
  position: absolute; left: -2%; bottom: -.08em; width: 104%; height: .22em; overflow: visible;
  fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round;
}
.mark path { stroke-dasharray: 320; stroke-dashoffset: 320; animation: draw 1.1s .5s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.hero__cols {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  margin-top: clamp(36px, 5vw, 72px);
  font-size: 18px;
  color: #34322d;
}
.hero__cols p:nth-child(1) { grid-column: 1 / span 4; }
.hero__cols p:nth-child(2) { grid-column: 6 / span 4; }
.hero__status { grid-column: 1 / -1; font-size: 15px; color: var(--muted); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill {
  display: inline-block; padding: 5px 11px 6px; border: 1.5px solid var(--ink); border-radius: 999px;
  font-size: 14px; color: var(--ink); font-weight: 500;
}

/* ---------- заголовки секций ---------- */
.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 24px; flex-wrap: wrap;
  padding: 18px 0 26px; border-top: 1.5px solid var(--ink);
}
.section-head h2 { font-weight: 500; font-size: clamp(28px, 3.4vw, 44px); letter-spacing: -.03em; line-height: 1; }
.section-head sup { font: 400 14px var(--mono); color: var(--muted); vertical-align: super; letter-spacing: 0; }
.section-head__note { color: var(--muted); font-size: 15px; max-width: 28em; }

/* ---------- сетка работ ---------- */
.works { padding: 0 var(--pad) clamp(60px, 8vw, 120px); }
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(12, 1fr);
  column-gap: 24px; row-gap: clamp(40px, 5vw, 64px);
}
.tile { position: relative; min-width: 0; }
.tile--a { grid-column: span 7; }
.tile--b { grid-column: span 5; margin-top: clamp(0px, 6vw, 90px); }
.tile--c { grid-column: span 4; }
.tile--d { grid-column: span 4; margin-top: clamp(0px, 3vw, 44px); }
.tile--e { grid-column: span 4; }
.tile--f { grid-column: 1 / span 8; }
.grid__aside {
  grid-column: 10 / span 3; align-self: end;
  font-size: 16px; color: #3b3832; border-left: 1.5px solid var(--accent); padding-left: 18px;
}
.arrow-link { display: inline-flex; gap: 8px; margin-top: 14px; font-weight: 500; text-decoration: none; }
.arrow-link span { transition: transform .25s var(--ease); }
.arrow-link:hover span { transform: translateX(5px); }

.tile__link { display: block; text-decoration: none; outline: none; }
.tile__media {
  display: block; position: relative; overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  transition: border-color .3s, transform .45s var(--ease);
}
.tile__media img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center;
  transition: transform .8s var(--ease);
}
.tile__link:hover .tile__media,
.tile__link:focus-visible .tile__media { border-color: var(--ink); transform: translateY(-4px); }
.tile__link:hover .tile__media img { transform: scale(1.025); }
.tile__link:focus-visible .tile__media { outline: 2px solid var(--accent); outline-offset: 4px; }
.tile.is-hidden .tile__media { visibility: hidden; }

.tile__meta {
  display: grid; grid-template-columns: 36px 1fr auto; column-gap: 10px; row-gap: 4px;
  padding-top: 14px;
}
.tile__num { font: 500 12px/1.9 var(--mono); color: var(--muted); transition: color .2s; }
.tile__link:hover .tile__num { color: var(--accent); }
.tile__name { font-weight: 500; font-size: 20px; letter-spacing: -.02em; line-height: 1.25; }
.tile__desc { grid-column: 2 / -1; color: var(--muted); font-size: 15px; }
.tile__tags { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tile__tags span {
  font: 400 11.5px/1 var(--mono); padding: 5px 7px; border: 1px solid var(--line); border-radius: 3px; color: #4b4740;
}
.tile__ext {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink); border-radius: 50%;
  text-decoration: none; font-size: 16px;
  opacity: 0; transform: scale(.85); transition: opacity .2s, transform .25s var(--ease), background .2s;
}
.tile:hover .tile__ext, .tile__ext:focus-visible { opacity: 1; transform: none; }
.tile__ext:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (hover: none) { .tile__ext { opacity: 1; transform: none; } }

/* ---------- как работаю ---------- */
.about { padding: 0 var(--pad) clamp(60px, 8vw, 120px); }
.steps {
  list-style: none; margin: 0; padding: 0; counter-reset: s;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.steps li { counter-increment: s; padding-top: 14px; border-top: 1px solid var(--line); }
.steps li::before { content: "0" counter(s); font: 500 12px var(--mono); color: var(--accent); }
.steps h3 { font-weight: 500; font-size: 21px; letter-spacing: -.02em; margin: 14px 0 8px; }
.steps p { color: #45423b; font-size: 16px; }
.about__stack { margin-top: 48px; max-width: 46em; font-size: 18px; display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; }

/* ---------- контакты ---------- */
.contact {
  background: var(--ink); color: var(--paper);
  padding: clamp(56px, 8vw, 120px) var(--pad);
}
.contact__title { font-weight: 500; font-size: clamp(34px, 5.6vw, 84px); line-height: 1; letter-spacing: -.04em; max-width: 12em; }
.contact__list { list-style: none; margin: clamp(36px, 5vw, 64px) 0 0; padding: 0; display: grid; gap: 0; max-width: 900px; }
.contact__list li {
  display: grid; grid-template-columns: 140px 1fr; align-items: baseline; gap: 16px;
  padding: 18px 0; border-top: 1px solid #3a3833;
}
.contact__list .label { color: #9c968a; }
.contact__list a {
  font-size: clamp(22px, 3vw, 38px); letter-spacing: -.02em; text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  transition: background-size .35s var(--ease), color .2s;
  justify-self: start; overflow-wrap: anywhere;
}
.contact__list a:hover { background-size: 100% 2px; color: #fff; }

.foot {
  display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 22px var(--pad) 28px; font-size: 14px; color: var(--muted);
}
.foot__up { text-decoration: none; }
.foot__up:hover { color: var(--accent); }

/* ---------- просмотрщик ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  background: var(--paper);
  transform-origin: 0 0;
  will-change: transform, clip-path;
}
.viewer[hidden] { display: none; }
.viewer__bar {
  flex: 0 0 48px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 0 10px 0 6px; border-bottom: 1px solid var(--ink); background: var(--paper);
}
.viewer__back, .viewer__close, .viewer__ext {
  font: 500 14px var(--sans); color: var(--ink); background: none; border: 0; cursor: pointer;
  padding: 8px 10px; border-radius: 4px; text-decoration: none;
}
.viewer__back { justify-self: start; }
.viewer__back span { display: inline-block; transition: transform .25s var(--ease); }
.viewer__back:hover span { transform: translateX(-4px); }
.viewer__back:hover, .viewer__ext:hover, .viewer__close:hover { background: var(--paper-2); }
.viewer__title { font: 500 13px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer__actions { justify-self: end; display: flex; align-items: center; gap: 4px; }
.viewer__close { width: 36px; height: 36px; padding: 8px; display: grid; place-items: center; }
.viewer__close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.viewer__stage { position: relative; flex: 1 1 auto; overflow: hidden; background: #fff; }
.viewer__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.viewer__cover {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: top center; pointer-events: none;
  transition: opacity .35s ease;
}
.viewer__cover.is-gone { opacity: 0; }
.viewer.is-animating .viewer__bar { transition: none; }

html.is-locked, html.is-locked body { overflow: hidden; }

/* ---------- адаптив ---------- */
@media (max-width: 1000px) {
  .tile--a, .tile--b { grid-column: span 6; }
  .tile--c, .tile--d, .tile--e { grid-column: span 6; margin-top: 0; }
  .tile--f { grid-column: span 6; }
  .grid__aside { grid-column: span 6; align-self: center; }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }
  .hero__cols p:nth-child(1) { grid-column: 1 / span 6; }
  .hero__cols p:nth-child(2) { grid-column: 7 / span 6; }
}
@media (max-width: 700px) {
  body { font-size: 16px; }
  .top { grid-template-columns: 1fr auto; padding-top: 16px; padding-bottom: 16px; }
  .nav { display: none; }
  .clock { font-size: 12px; }
  .hero__cols { grid-template-columns: 1fr; gap: 16px; font-size: 17px; }
  .hero__cols p:nth-child(1), .hero__cols p:nth-child(2), .hero__status { grid-column: 1; }
  .grid { grid-template-columns: 1fr; row-gap: 44px; }
  .tile--a, .tile--b, .tile--c, .tile--d, .tile--e, .tile--f, .grid__aside { grid-column: 1; margin-top: 0; }
  .steps { grid-template-columns: 1fr; }
  .contact__list li { grid-template-columns: 1fr; gap: 6px; }
  .viewer__title { display: none; }
  .viewer__bar { grid-template-columns: 1fr auto; }
  .viewer__ext { font-size: 0; }
  .viewer__ext span { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .mark path { stroke-dashoffset: 0; }
}
