/* ===== Firesco — дизайн-студия ===== */
:root {
  --bg: #0f0d0a;
  --bg-soft: #16130f;
  --text: #efe9df;
  --muted: #8f887b;
  --accent: #a89474; /* тёплый беж, как у референса */
  --border: #26221c;
  --serif: 'Georgia', 'Times New Roman', serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: #0f0d0a; }
.container { width: min(1280px, calc(100% - 48px)); margin: 0 auto; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; }
h1 em { font-style: italic; color: var(--accent); }

/* Зерно поверх всего */
.grain {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%,100%{transform:translate(0,0)} 10%{transform:translate(-5%,-8%)} 30%{transform:translate(3%,-4%)}
  50%{transform:translate(-7%,5%)} 70%{transform:translate(6%,8%)} 90%{transform:translate(-3%,3%)}
}

/* Кастомный курсор */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 95; pointer-events: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); mix-blend-mode: difference;
  transform: translate(-100px, -100px); transition: width .2s, height .2s, opacity .3s;
  opacity: 0;
}
.cursor.on { opacity: 1; }
.cursor.grow { width: 56px; height: 56px; }
@media (hover: none) { .cursor { display: none; } }

/* Прелоадер */
#loader { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; align-items: center; justify-content: center; transition: opacity .7s ease, visibility .7s ease; }
#loader.done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; }
.loader-word { font-family: var(--serif); font-style: italic; font-size: clamp(1.2rem, 2.5vw, 1.8rem); color: var(--muted); margin-bottom: 8px; }
#loaderPercent { font-family: var(--serif); font-size: clamp(4rem, 12vw, 9rem); font-weight: 300; letter-spacing: -0.04em; color: var(--accent); }

/* Шапка */
header { position: fixed; top: 0; left: 0; right: 0; z-index: 50; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; transition: transform .35s ease; }
header.hidden { transform: translateY(-110%); }

.burger { display: none; background: none; border: 0; cursor: pointer; width: 28px; height: 20px; position: relative; }
.burger span { position: absolute; left: 0; width: 100%; height: 2px; background: var(--text); transition: .3s; }
.burger span:nth-child(1) { top: 0; } .burger span:nth-child(2) { bottom: 0; }
.burger.open span:nth-child(1) { top: 9px; transform: rotate(45deg); }
.burger.open span:nth-child(2) { bottom: 9px; transform: rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 40; background: var(--bg-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  opacity: 0; visibility: hidden; transition: .35s ease;
}
.mobile-menu.open { opacity: 1; visibility: visible; }
.mobile-menu a { font-family: var(--serif); font-size: 32px; color: var(--text); text-decoration: none; }
.mobile-menu a:hover { color: var(--accent); }

/* ===== Первый экран: «Тлеющий монолит» ===== */
.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 24px 40px;
  isolation: isolate;
}

/* фоновые слои — тёплое свечение */
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero-glow {
  position: absolute; border-radius: 50%;
  filter: blur(90px); will-change: transform;
}
.hero-glow--a {
  width: 70vmax; height: 70vmax; left: 50%; top: 58%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(168,116,52,.34), rgba(94,52,20,.16) 45%, transparent 70%);
  animation: breathe 9s ease-in-out infinite alternate;
}
.hero-glow--b {
  width: 44vmax; height: 44vmax; right: -12vmax; bottom: -14vmax;
  background: radial-gradient(circle, rgba(236,180,110,.16), transparent 65%);
  animation: breatheB 12s ease-in-out infinite alternate-reverse;
}
@keyframes breathe { to { opacity: .55; } }
@keyframes breatheB { to { opacity: .5; transform: scale(1.07); } }
.hero-ring {
  position: absolute; left: 50%; top: 46%;
  width: min(120vh, 92vw); aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(168,148,116,.18);
  border-radius: 50%;
}

/* центральная панель-«монолит» */
.hero-stage {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
}
.hero-panel {
  position: relative;
  width: clamp(300px, 34vw, 560px);
  height: min(76svh, 780px);
  overflow: hidden;
  border-radius: 2px;
  outline: 1px solid rgba(239,233,223,.1);
  clip-path: inset(46% 8% 46% 8%);
  transform: scale(1.08);
  transition: clip-path 1.4s cubic-bezier(.77,0,.18,1), transform 1.8s cubic-bezier(.22,1,.36,1);
  will-change: clip-path, transform;
}
body.ready .hero-panel { clip-path: inset(0 0 0 0); transform: scale(1); }
.panel-layer { position: absolute; inset: -12%; will-change: transform; }
.panel-layer--deep { background: linear-gradient(200deg, #2a2018 0%, #171208 55%, #0b0805 100%); }
.panel-layer--ember {
  background:
    radial-gradient(60% 45% at 50% 78%, rgba(255,166,66,.85), rgba(196,98,26,.5) 42%, transparent 72%),
    radial-gradient(38% 30% at 62% 62%, rgba(255,220,150,.5), transparent 70%);
  filter: blur(14px);
  mix-blend-mode: screen;
  animation: flicker 6s ease-in-out infinite alternate;
}
@keyframes flicker {
  0% { opacity: .85; transform: scale(1) translateY(0); }
  50% { opacity: 1; transform: scale(1.04) translateY(-1.5%); }
  100% { opacity: .9; transform: scale(1.02) translateY(-.5%); }
}
.panel-layer--arc {
  inset: 0;
  background: repeating-conic-gradient(from 210deg at 50% 118%,
    rgba(239,233,223,.09) 0deg 2deg, transparent 2deg 11deg);
  -webkit-mask-image: radial-gradient(85% 70% at 50% 100%, #000 30%, transparent 75%);
  mask-image: radial-gradient(85% 70% at 50% 100%, #000 30%, transparent 75%);
}
.panel-layer--veil {
  inset: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .12; mix-blend-mode: overlay;
  box-shadow: inset 0 0 120px rgba(0,0,0,.65);
}
.panel-meta {
  position: absolute; left: 14px; bottom: 12px;
  font-size: 10px; letter-spacing: .22em;
  color: rgba(239,233,223,.55);
}

/* гигантская типографика поверх панели */
.hero-type {
  position: relative; z-index: 2;
  margin-top: auto; padding: 14svh 0 150px;
  font-family: var(--serif);
  text-transform: uppercase;
  line-height: .84;
  letter-spacing: -.03em;
  color: var(--text);
  pointer-events: none;
}
.hero-type .line { display: block; overflow: hidden; }
.hero-type i {
  display: block; font-style: normal;
  font-size: clamp(4.2rem, 17vw, 16.5rem);
  transform: translateY(112%);
  transition: transform 1.1s cubic-bezier(.22,1,.36,1);
  will-change: transform;
}
body.ready .hero-type .line:nth-child(1) i { transition-delay: .35s; transform: translateY(0); }
body.ready .hero-type .line:nth-child(2) i { transition-delay: .5s; transform: translateY(0); }
.hero-type .o {
  font-style: italic;
  color: transparent;
  background: radial-gradient(120% 120% at 50% 80%, #ffd9a0, var(--accent) 55%, #6e5a3c);
  -webkit-background-clip: text; background-clip: text;
}

.hero-kicker {
  position: absolute; z-index: 3;
  top: 96px; left: 24px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .28em;
  color: rgba(239,233,223,.72);
  opacity: 0; transform: translateY(14px);
  transition: opacity .8s ease .95s, transform .8s ease .95s;
}
body.ready .hero-kicker { opacity: 1; transform: none; }

.hero-foot {
  position: absolute; z-index: 3;
  left: 24px; right: 24px; bottom: 40px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  opacity: 0; transform: translateY(16px);
  transition: opacity .9s ease 1.2s, transform .9s ease 1.2s;
}
body.ready .hero-foot { opacity: 1; transform: none; }
.hero-note { font-size: 14px; color: var(--muted); max-width: 34em; }
.hero-cta {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 30px; border-radius: 999px;
  border: 1px solid rgba(168,148,116,.5);
  color: var(--text); text-decoration: none;
  font-family: var(--serif); font-style: italic; font-size: 18px;
  background: rgba(15,13,10,.35);
  backdrop-filter: blur(6px);
  transition: background .3s, border-color .3s, color .3s, transform .3s;
}
.hero-cta:hover { background: var(--accent); border-color: var(--accent); color: #14100a; transform: translateY(-2px); }
.hero-cta span { transition: transform .3s; }
.hero-cta:hover span { transform: translateX(4px); }
.hero-scroll {
  font-size: 20px; color: var(--accent); text-decoration: none;
  animation: nudge 2.2s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateY(6px); } }

/* статичная версия без движения */
@media (prefers-reduced-motion: reduce) {
  .hero-panel, .hero-type i, .hero-kicker, .hero-foot {
    transition: none !important;
    clip-path: none; transform: none;
    opacity: 1;
  }
  .panel-layer--ember, .hero-glow--a, .hero-glow--b, .hero-scroll, .grain { animation: none !important; }
  .work-visual img, .work-cue, .work-desc, .lightbox, .lightbox-inner, .lightbox-close { transition: none !important; }
  .work-visual img { transform: none !important; }
}

/* адаптив первого экрана */
@media (max-width: 900px) {
  .hero { padding: 0 20px 32px; }
  .hero-panel { width: min(72vw, 420px); height: 54svh; align-self: flex-start; margin-top: 120px; }
  .panel-meta { top: 12px; bottom: auto; }
  .hero-kicker { top: 84px; left: 20px; font-size: 11px; }
  .hero-foot { left: 20px; right: 20px; bottom: 32px; flex-wrap: wrap; align-items: flex-start; }
  .hero-note { order: 2; font-size: 13px; }
  .hero-cta { order: 1; width: 100%; justify-content: center; }
  .hero-scroll { display: none; }
}

/* детерминированный финальный кадр (для скриншотов превью) */
body.static .hero-panel, body.static .hero-type i,
body.static .hero-kicker, body.static .hero-foot {
  transition: none !important;
  clip-path: none; transform: none; opacity: 1;
}
body.static .panel-layer--ember, body.static .hero-glow--a,
body.static .hero-glow--b, body.static .hero-scroll, body.static .grain { animation: none !important; }

/* Бегущая строка */
.marquee { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; padding: 18px 0; }
.marquee-track { display: flex; gap: 64px; white-space: nowrap; width: max-content; animation: slide 22s linear infinite; }
.marquee-track span { font-family: var(--serif); font-style: italic; font-size: clamp(1.2rem, 2.6vw, 2rem); color: var(--muted); }
@keyframes slide { to { transform: translateX(-50%); } }

/* Секции */
section { padding: 120px 0; }
.section-label { font-size: 13px; text-transform: uppercase; letter-spacing: .25em; color: var(--accent); margin-bottom: 48px; }
.big { font-family: var(--serif); font-size: clamp(1.6rem, 3.4vw, 2.8rem); line-height: 1.3; max-width: 22em; }
.facts { color: var(--muted); max-width: 34em; margin-top: 32px; font-size: 17px; }

/* Услуги */
.services-list { list-style: none; border-top: 1px solid var(--border); }
.services-list li { display: flex; gap: 40px; padding: 40px 0; border-bottom: 1px solid var(--border); align-items: baseline; transition: padding-left .3s ease; }
.services-list li:hover { padding-left: 16px; }
.services-list .idx { font-size: 13px; color: var(--accent); min-width: 32px; }
.services-list h3 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin-bottom: 8px; }
.services-list p { color: var(--muted); max-width: 40em; }

.logo { color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 22px; letter-spacing: .02em; }
nav ul { display: flex; gap: 32px; list-style: none; }

/* Проекты */
.works-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.work { cursor: pointer; }
.work-visual { aspect-ratio: 4 / 3; background: var(--bg-soft); border: 1px solid var(--border); position: relative; overflow: hidden; }
.work-visual img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.001); transition: transform .8s cubic-bezier(.2,.6,.2,1), filter .5s ease;
  filter: saturate(.96);
}
.work:hover .work-visual img, .work:focus-visible .work-visual img { transform: scale(1.06); filter: saturate(1.05); }
/* лёгкий параллакс внутри изображения (двигает JS) */
.work-visual .parallax-wrap { position: absolute; inset: -6% 0; will-change: transform; }
.work-visual .parallax-wrap img { height: 112%; }

/* подпись «СМОТРЕТЬ ПРОЕКТ» */
.work-cue {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  transform: translate(-50%, -50%) translateY(12px);
  font-size: 11px; letter-spacing: .3em; color: var(--text);
  background: rgba(15,13,10,.72); backdrop-filter: blur(4px);
  padding: 12px 22px; border: 1px solid rgba(239,233,223,.25); border-radius: 999px;
  opacity: 0; transition: opacity .35s ease, transform .35s ease; pointer-events: none; white-space: nowrap;
}
.work:hover .work-cue, .work:focus-visible .work-cue { opacity: 1; transform: translate(-50%, -50%); }

.work figcaption { font-family: var(--serif); font-size: 18px; margin-top: 16px; }
.work-head { display: flex; align-items: baseline; gap: 14px; }
.work-num { font-family: 'Inter', sans-serif; font-size: 12px; letter-spacing: .2em; color: var(--accent); }
.work-year { margin-left: auto; font-family: 'Inter', sans-serif; font-size: 13px; color: var(--muted); }
.work-cat { display: block; font-family: 'Inter', sans-serif; font-size: 13px; color: var(--muted); margin-top: 6px; }
.work-desc { font-family: 'Inter', sans-serif; font-size: 14px; color: var(--muted); margin-top: 8px; max-width: 34em;
  opacity: .85; transform: translateY(4px); transition: opacity .4s ease, transform .4s ease; }
.work:hover .work-desc { opacity: 1; transform: none; }
.w2 { margin-top: 48px; } .w4 { margin-top: 48px; } .w6 { margin-top: 48px; }

/* Лайтбокс проекта */
.lightbox { position: fixed; inset: 0; z-index: 96; background: rgba(15,13,10,.94); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 32px;
  opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility .4s ease; }
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-inner { width: min(1180px, 100%); max-height: calc(100vh - 64px); overflow: auto;
  display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 36px;
  transform: translateY(20px) scale(.98); transition: transform .45s cubic-bezier(.2,.6,.2,1); }
.lightbox.open .lightbox-inner { transform: none; }
.lightbox-media { border: 1px solid var(--border); overflow: hidden; align-self: start; background: var(--bg-soft); }
.lightbox-media img { width: 100%; height: auto; display: block; }
.lightbox-meta h3 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); margin: 10px 0 6px; }
.lightbox-meta > p:last-of-type { color: var(--muted); font-size: 15px; margin-top: 14px; max-width: 30em; }
.lightbox-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 24px; }
.lightbox-thumbs button { border: 1px solid var(--border); padding: 0; background: none; cursor: pointer; overflow: hidden; aspect-ratio: 4 / 3; transition: border-color .25s; }
.lightbox-thumbs button.on, .lightbox-thumbs button:hover { border-color: var(--accent); }
.lightbox-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox-close { position: fixed; top: 20px; right: 28px; z-index: 2; background: none; border: 1px solid var(--border);
  color: var(--text); width: 46px; height: 46px; border-radius: 50%; font-size: 26px; cursor: pointer; transition: .25s; line-height: 1; }
.lightbox-close:hover { border-color: var(--accent); color: var(--accent); transform: rotate(90deg); }

@media (max-width: 900px) {
  .lightbox-inner { grid-template-columns: 1fr; gap: 20px; }
}

/* Процесс */
.process-list { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; counter-reset: step; }
.process-list li { border-top: 1px solid var(--border); padding-top: 24px; counter-increment: step; }
.process-list li::before { content: '0' counter(step); font-size: 13px; color: var(--accent); letter-spacing: .2em; }
.process-list h3 { font-size: 22px; margin: 12px 0 10px; }
.process-list p { font-size: 15px; color: var(--muted); }

/* FAQ */
.faq-list { max-width: 820px; }
details { border-bottom: 1px solid var(--border); }
summary { cursor: pointer; list-style: none; font-family: var(--serif); font-size: clamp(1.2rem, 2.4vw, 1.7rem); padding: 28px 0; display: flex; justify-content: space-between; align-items: center; transition: color .2s; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '+'; font-size: 28px; color: var(--accent); transition: transform .3s; }
details[open] summary::after { transform: rotate(45deg); }
summary:hover { color: var(--accent); }
details p { color: var(--muted); padding-bottom: 28px; max-width: 40em; }

/* Футер */
.footer { border-top: 1px solid var(--border); padding: 120px 0 48px; background: var(--bg-soft); }
.footer-label { font-size: 13px; text-transform: uppercase; letter-spacing: .25em; color: var(--muted); margin-bottom: 24px; }
.footer-cta { font-family: var(--serif); font-size: clamp(2rem, 7vw, 5.5rem); color: var(--text); text-decoration: none; letter-spacing: -0.02em; transition: color .25s; }
.footer-cta:hover { color: var(--accent); }
.footer-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 80px; color: var(--muted); font-size: 14px; }
.copy-mail { background: none; border: 1px solid var(--border); color: var(--muted); padding: 10px 20px; border-radius: 999px; cursor: pointer; font-size: 14px; transition: .25s; }
.copy-mail:hover { border-color: var(--accent); color: var(--accent); }
.copy-mail.ok { color: var(--accent); border-color: var(--accent); }

/* Появление при скролле */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s ease; }
.reveal.vis { opacity: 1; transform: none; }

/* Адаптив */
@media (max-width: 900px) {
  nav { display: none; }
  .burger { display: block; }
  section { padding: 80px 0; }
  .works-grid { grid-template-columns: 1fr; }
  .w2, .w4, .w6 { margin-top: 0; }
  .process-list { grid-template-columns: 1fr 1fr; }
  .hero-bottom { flex-direction: column; align-items: flex-start; gap: 16px; }
}
@media (max-width: 560px) {
  .process-list { grid-template-columns: 1fr; }
  .services-list li { flex-direction: column; gap: 12px; }
}

nav a { color: var(--text); text-decoration: none; font-size: 14px; opacity: .7; transition: opacity .2s, color .2s; }
nav a:hover { opacity: 1; color: var(--accent); }

/* Статический режим (?static): фиксируем высоту hero для полностраничных скриншотов */
body.static .hero { min-height: 900px; height: 900px; }
body.static .hero-panel { height: min(76%, 780px); }
body.static .hero-type { padding: 120px 0 150px; }
