/* History Inside — общий стиль сайта.
   Основа взята из брендбука: Lora + Manrope, тёплая бумага, терракота. */

@font-face {
  font-family: Lora;
  src: url(../fonts/lora.ttf) format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Manrope;
  src: url(../fonts/manrope.ttf) format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --linen: #f3efee;
  --ink: #2c2524;
  --clay: #9c4b42;
  --clay-dark: #803d36;
  --muted: #665952;
  --line: #ded5d2;
  --danger: #a32c1f;
  --ok: #3d5a41;
  --serif: Lora, Georgia, serif;
  --sans: Manrope, "Segoe UI", sans-serif;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 500 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1 0 auto; }

img { display: block; width: 100%; object-fit: cover; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; }
h1, h2, h3, p, figure, dl, dd, ol, ul { margin: 0; }

.wrap { width: min(1272px, calc(100% - 104px)); margin-inline: auto; }

/* ------------------------------------------------------------ шапка --- */

.topbar { border-bottom: 1px solid var(--line); }
.topbar .wrap {
  min-height: 77px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 27px;
  text-decoration: none;
}
.brand .mark { font-size: 21px; color: var(--clay); }
.wordmark { font: 500 1em/1.05 var(--serif); letter-spacing: -.063em; white-space: nowrap; }

/* знак книги из брендбука */
.mark { display: inline-block; width: 1em; height: .84em; position: relative; flex: none; }
.mark::before, .mark::after {
  content: "";
  position: absolute;
  top: .035em;
  width: .47em;
  height: .61em;
  border: .062em solid currentColor;
}
.mark::before { left: 0; border-radius: .06em .18em .02em .08em; transform: skewY(15deg); transform-origin: left top; }
.mark::after { right: 0; border-radius: .18em .06em .08em .02em; transform: skewY(-15deg); transform-origin: right top; }

.navigation { display: flex; align-items: center; justify-content: center; gap: 26px; font-size: 13px; font-weight: 750; }
.navigation a { text-decoration: none; white-space: nowrap; }
.navigation a:hover, .navigation a[aria-current] { color: var(--clay); }
.topbar .button { justify-self: end; }

/* ---------------------------------------------------------- кнопки ----- */

.button {
  display: inline-flex;
  min-height: 47px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 17px;
  border-radius: var(--radius);
  background: var(--clay);
  border: 1px solid var(--clay);
  color: var(--paper);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { background: var(--clay-dark); border-color: var(--clay-dark); }
.button:disabled { opacity: .55; cursor: default; }
.button.quiet { color: var(--ink); background: var(--paper); border-color: var(--line); }
.button.quiet:hover { color: var(--clay); border-color: var(--clay); }
.text-link { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; font-size: 14px; font-weight: 800; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ------------------------------------------------------------ герой ---- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(35px, 5vw, 82px);
  padding: 56px 0 62px;
}
.hero h1 { max-width: 620px; margin: 12px 0 20px; font: 500 clamp(49px, 4.55vw, 72px)/1.01 var(--serif); letter-spacing: -.065em; text-wrap: balance; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--clay); }
.lead { max-width: 435px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; margin-top: 24px; }
.hero-art img { height: clamp(270px, 34vw, 472px); object-position: 50% 49%; }
.hero-art figcaption, .book-photo figcaption, .editor-shot figcaption { color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 8px; }

/* --------------------------------------------------------- секции ----- */

.occasions, .how, .questions { padding: 42px 0 55px; border-top: 1px solid var(--line); }
.heading { font: 500 clamp(32px, 3.1vw, 46px)/1.06 var(--serif); letter-spacing: -.045em; text-wrap: balance; }
.section-intro { font-size: 15px; color: var(--muted); margin: 8px 0 24px; }

.occasion-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.occasion h3 { margin: 11px 0 4px; font: 500 clamp(20px, 2.1vw, 30px)/1.13 var(--serif); letter-spacing: -.045em; }
.occasion p { max-width: 255px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.occasion img { aspect-ratio: 1.38; background: var(--linen); }
.occasion .baby { object-position: center 12%; }
.occasion .wedding { object-position: center 0; }
.occasion .archive { object-position: center 41%; filter: grayscale(1); }
.occasion { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.occasion img { transition: opacity .18s ease; }
.occasion:hover img { opacity: .9; }
.occasion:hover h3, .occasion:hover .occasion-more { color: var(--clay); }
.occasion-more {
  display: inline-flex; align-items: center; gap: 5px; margin-top: auto; padding-top: 9px;
  font-size: 12px; font-weight: 800; color: var(--clay);
}

.book-band { background: var(--linen); }
.book-layout { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); align-items: center; gap: clamp(32px, 6.6vw, 102px); padding: 48px 0; }
.book-photo img { height: clamp(255px, 31vw, 426px); object-position: center 59%; }
.book-copy .section-intro { max-width: 465px; margin-bottom: 20px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.specs div { min-width: 0; padding: 13px 10px 14px 0; border-bottom: 1px solid var(--line); }
.specs div:nth-child(even) { padding-left: 15px; border-left: 1px solid var(--line); }
.specs dt { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.specs dd { margin: 0; font: 500 clamp(18px, 2vw, 28px)/1.17 var(--serif); letter-spacing: -.036em; }

.how { display: grid; grid-template-columns: minmax(255px, .62fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 80px); padding-top: 55px; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 20px 0 16px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 28px 1fr; gap: 11px; align-items: start; padding: 11px 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(step); width: 25px; height: 25px; display: grid; place-items: center; background: var(--linen); color: var(--clay); border-radius: 50%; font-size: 12px; font-weight: 800; }
.steps strong { display: block; font-size: 14px; font-weight: 800; }
.steps p { color: var(--muted); font-size: 13px; line-height: 1.45; margin-top: 3px; }
.editor-shot a:hover img { border-color: var(--clay); }
.editor-shot img { height: auto; border: 1px solid var(--line); }

.questions { display: grid; grid-template-columns: minmax(235px, .65fr) minmax(0, 1fr); gap: clamp(24px, 6vw, 95px); align-items: start; }
.questions .heading { font-size: clamp(30px, 2.9vw, 42px); }
.question { border-bottom: 1px solid var(--line); padding: 0 0 11px; margin-bottom: 11px; }
.question summary {
  cursor: pointer; min-height: 40px; padding: 7px 0; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  list-style: none;
}
.question summary::-webkit-details-marker { display: none; }
.question summary::after {
  content: ""; flex: 0 0 auto; width: 9px; height: 9px; margin-right: 3px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-3px) rotate(45deg);
  transition: transform .2s ease;
}
.question[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.question summary:hover::after { border-color: var(--clay); }
.question p { max-width: 600px; color: var(--muted); font-size: 14px; padding: 3px 0 7px; }

/* --------------------------------------------------------- подвал ----- */

.footer { border-top: 1px solid var(--line); padding: 26px 0 34px; color: var(--muted); font-size: 13px; }
.footer-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer .brand { color: var(--ink); font-size: 22px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--clay); text-decoration: underline; }
.footer-legal { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.55; }

/* --------------------------------------------------- текстовые стр. --- */

.page { padding: 46px 0 60px; }
.page-head { max-width: 720px; margin-bottom: 30px; }
.page-head h1 { font: 500 clamp(38px, 4.4vw, 62px)/1.02 var(--serif); letter-spacing: -.06em; margin: 10px 0 14px; }
.page-head p { color: var(--muted); font-size: 16px; }
.login-card { max-width: 420px; margin: clamp(6px, 4vh, 40px) auto 0; padding: 34px 36px 38px; background: var(--linen); border-radius: 6px; }
.login-card .page-head { margin-bottom: 24px; }
.login-card .page-head h1 { font-size: clamp(27px, 2.4vw, 33px); margin: 8px 0 10px; }
.login-card .page-head p { font-size: 15px; }
.prose { max-width: 760px; font-size: 15px; line-height: 1.72; }
.prose > * + * { margin-top: 14px; }
.prose h2 { font: 500 26px/1.2 var(--serif); letter-spacing: -.03em; margin-top: 34px; }
.prose h3 { font-size: 16px; font-weight: 800; margin-top: 24px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose a { color: var(--clay); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 800; }

.notice { border-left: 3px solid var(--clay); background: var(--linen); padding: 14px 18px; font-size: 14px; }

/* ---------------------------------------------------------- формы ----- */

.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;      /* не полагаемся на системный цвет поля */
  color: var(--ink);
  font-size: 15px;
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--clay); outline: none; }
.field small { color: var(--muted); font-size: 12px; }

.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 700; min-height: 18px; }
.form-note { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* --------------------------------------------------------- модалка ---- */

dialog.sheet {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(44, 37, 36, .28);
}
dialog.sheet::backdrop { background: rgba(44, 37, 36, .45); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px 0; }
.sheet-head h2 { font: 500 26px/1.15 var(--serif); letter-spacing: -.035em; }
.sheet-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sheet-close { border: 0; background: none; font-size: 22px; line-height: 1; padding: 4px 8px; color: var(--muted); }
.sheet-body { padding: 18px 24px 24px; overflow: auto; max-height: calc(100vh - 170px); }
.sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 24px 22px; border-top: 1px solid var(--line); }
.price-line { display: flex; align-items: baseline; gap: 8px; }
.price-line b { font: 500 26px/1 var(--serif); }
.price-line span { color: var(--muted); font-size: 13px; }

.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--clay); transition: width .25s ease; }

/* --------------------------------------------------------- статус ----- */

.status-card { max-width: 720px; border: 1px solid var(--line); border-radius: 6px; padding: 26px; }
.status-steps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.status-steps li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; color: var(--muted); font-size: 14px; }
.status-steps li::before { content: ""; width: 14px; height: 14px; margin-top: 5px; border: 2px solid var(--line); border-radius: 50%; }
.status-steps li[data-done="true"] { color: var(--ink); font-weight: 700; }
.status-steps li[data-done="true"]::before { border-color: var(--clay); background: var(--clay); }
.status-steps li[data-current="true"]::before { border-color: var(--clay); box-shadow: 0 0 0 4px #9c4b4222; }

/* -------------------------------------------------------- кабинет ----- */

.cabinet-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: var(--paper); border-radius: 100px; padding: 7px 13px; font-size: 12px; font-weight: 800; }
.filters button[aria-pressed="true"] { background: var(--clay); border-color: var(--clay); color: var(--paper); }

.orders { width: 100%; border-collapse: collapse; font-size: 14px; }
.orders th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.orders td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.orders tr:hover td { background: #faf7f5; }
.orders .num { font-weight: 800; white-space: nowrap; }
.orders button.open { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 5px 10px; font-size: 12px; font-weight: 700; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 100px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.kind-badge { display: inline-block; margin-left: 7px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 100px; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--clay); }
.pill[data-status="new"] { background: #fbeee9; color: #8c3a2c; }
.pill[data-status="check"] { background: #fdf2e0; color: #7a4a13; }
.pill[data-status="approved"] { background: #eaf0e5; color: #35543d; }
.pill[data-status="print"] { background: #e8eef6; color: #2f4a66; }
.pill[data-status="shipped"] { background: #eee9f6; color: #453a63; }
.pill[data-status="done"] { background: #e6efe8; color: #2c4a33; }
.pill[data-status="cancel"] { background: #f2eeee; color: #6b5550; }

.order-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }
.detail-block { border: 1px solid var(--line); border-radius: 6px; padding: 18px; }
.detail-block h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.detail-list { display: grid; gap: 8px; font-size: 14px; }
.detail-list div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; }
.detail-list dt, .detail-list span:first-child { color: var(--muted); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo-grid a { display: block; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.book-preview { display: grid; gap: 10px; }
.book-spread { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; background: #faf4e9; }
.book-spread > div { position: relative; aspect-ratio: 1; overflow: hidden; }
.book-spread > div + div { border-left: 1px solid var(--line); }
.book-spread img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-spread .empty { display: grid; place-items: center; color: var(--muted); font-size: 12px; }

/* раскладка страницы как в редакторе: 1, 2, 3 или 4 кадра */
.page-grid { position: absolute; inset: 6%; display: grid; gap: 3px; grid-template-columns: 1fr; }
.page-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.page-grid[data-count="3"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.page-grid[data-count="3"] .page-cell:first-child { grid-row: span 2; }
.page-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.page-cell { overflow: hidden; border-radius: 2px; background: var(--linen); display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.page-cell img { position: static; width: 100%; height: 100%; object-fit: cover; }
.spread-caption { font-size: 11px; color: var(--muted); margin-top: 4px; }
.spread-period { font: 500 12px var(--serif); color: var(--clay); }

/* ------------------------------------------------ как мы работаем ------ */

.process-band { border-top: 1px solid var(--line); padding: 42px 0 52px; }
.process-head { max-width: 730px; }
.process-head .section-intro { margin-bottom: 0; }

.process { list-style: none; margin: 28px 0 0; padding: 0; }
.process li {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 132px;
  gap: clamp(14px, 3vw, 40px);
  align-items: start;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.process li:last-child { border-bottom: 1px solid var(--line); }
.process-num { font: 500 30px/1 var(--serif); color: var(--clay); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.process-body h3 { font: 500 23px/1.2 var(--serif); letter-spacing: -.02em; }
.process-body p { margin-top: 7px; max-width: 620px; color: var(--muted); font-size: 15px; }
.process-time { justify-self: end; text-align: right; padding-top: 7px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.process-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 26px; }
.process-foot .form-note { margin: 0; }

/* ------------------------------------------------ сборка дизайнером ----- */

.designer-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: clamp(28px, 5vw, 72px); align-items: start; }
#request-form { max-width: 560px; }
.designer-side h2 { font: 500 23px/1.15 var(--serif); letter-spacing: -.02em; margin-bottom: 6px; }
.designer-side .steps li:first-child { border-top: 0; padding-top: 4px; }
.designer-price { margin-top: 18px; padding: 15px 17px; background: var(--linen); border-radius: 6px; font-size: 14px; color: var(--muted); }
.designer-price b { color: var(--ink); font-variant-numeric: tabular-nums; }
.optional { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600; opacity: .75; }

/* --------------------------------------------------------- утилиты ---- */

.skip { position: absolute; z-index: 2; top: 8px; left: 8px; transform: translateY(-160%); background: var(--paper); padding: 8px; border: 1px solid var(--clay); }
.skip:focus { transform: none; }
[hidden] { display: none !important; }
.center-note { padding: 60px 0; text-align: center; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- адаптив ---- */

@media (max-width: 980px) {
  .wrap { width: calc(100% - 60px); }
  .topbar .wrap { gap: 16px; }
  .navigation { gap: 16px; }
  .hero { gap: 29px; }
  .hero h1 { font-size: clamp(44px, 5.75vw, 57px); }
  .occasion-grid { gap: 14px; }
  .order-detail { grid-template-columns: 1fr; }
  .designer-layout { grid-template-columns: 1fr; gap: 30px; }
}

@media (max-width: 700px) {
  .wrap { width: calc(100% - 32px); }
  .topbar .wrap { grid-template-columns: 1fr auto; min-height: 64px; }
  .topbar .navigation { display: none; }
  .brand { font-size: 23px; }
  .brand .mark { font-size: 17px; }
  .button { min-height: 44px; padding-inline: 12px; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 30px 0 31px; }
  .hero h1 { font-size: clamp(46px, 10.6vw, 64px); margin: 10px 0 13px; text-wrap: wrap; }
  .hero .lead { font-size: 14px; }
  .hero-actions { gap: 5px 13px; margin-top: 15px; }
  .hero-art img { height: clamp(200px, 64vw, 355px); }
  .occasions, .how, .questions { padding: 30px 0 37px; }
  .occasion-grid { grid-template-columns: 1fr 1fr; gap: 20px 12px; }
  .occasion h3 { margin-top: 7px; }
  .occasion p { font-size: 12px; }
  .book-layout, .how, .questions { grid-template-columns: 1fr; gap: 19px; }
  .book-layout { padding: 32px 0; }
  .book-copy { order: -1; }
  .book-photo img { height: clamp(214px, 73vw, 380px); }
  .form-row { grid-template-columns: 1fr; }
  .process li { grid-template-columns: 42px minmax(0, 1fr); gap: 12px; padding: 18px 0; }
  .process-num { font-size: 21px; }
  .process-time { grid-column: 2; justify-self: start; text-align: left; padding-top: 8px; }
  .login-card { padding: 24px 20px 26px; }
  .sheet-head, .sheet-body, .sheet-foot { padding-inline: 16px; }
  .orders th:nth-child(3), .orders td:nth-child(3),
  .orders th:nth-child(4), .orders td:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
