/*
 * «Журнал с обложками»: офсет в две краски. Внутренние страницы — бумага и
 * чёрная краска; каждая обложка — поле цвета типа и одна краска поверх
 * (--ground / --ink задаются на элементе .cover). Прямые углы, линейки,
 * купоны с пунктирной линией отреза.
 */

@font-face {
  font-family: "Unbounded";
  src: url("fonts/unbounded-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded";
  src: url("fonts/unbounded-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #fbfbf8;
  --paper-shade: #ecebe6;
  --black: #121212;
  --muted: #55544f;
  --accent: #1d2bff;
  --danger: #b3001b;
  --display: "Unbounded", "Arial Black", sans-serif;
  --text: "Golos Text", "Segoe UI", Roboto, sans-serif;
  --gutter: 16px;
  --wide: 1200px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scrollbar-color: var(--black) var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--black);
  font: 400 1.0625rem/1.6 var(--text);
  caret-color: var(--accent);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--black); color: var(--paper); }
.cover ::selection { background: var(--ink); color: var(--ground); }

h1, h2, h3 { font-family: var(--display); line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.cover :focus-visible, .cover:focus-visible { outline-color: var(--ink); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: var(--gutter); top: -100px; z-index: 10; padding: 10px 14px; background: var(--black); color: var(--paper); }
.skip-link:focus { top: 8px; }

.lead { font-size: 1.2rem; line-height: 1.5; }
.nowrap { white-space: nowrap; }
.fine-print { color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

/* --- Masthead and colophon --- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
  border-bottom: 3px solid var(--black);
}
.masthead-title {
  font: 800 clamp(1rem, 4.2vw, 1.4rem)/1 var(--display);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-decoration: none;
}
.masthead-nav { display: flex; align-items: center; gap: 18px; font-weight: 600; font-size: 0.95rem; }
.masthead-nav form { margin: 0; }

.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 20px var(--gutter) 28px;
  border-top: 3px solid var(--black);
  font-size: 0.85rem;
}

.flash { margin: 0; padding: 12px var(--gutter); background: var(--black); color: var(--paper); font-weight: 600; }

/* --- Controls --- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 24px;
  border: 2px solid var(--black);
  border-radius: 0;
  background: var(--black);
  color: var(--paper);
  font: 600 0.9rem/1.2 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}
.button:hover { background: var(--accent); border-color: var(--accent); }
.button:disabled { opacity: 0.3; cursor: not-allowed; }
.button:disabled:hover { background: var(--black); border-color: var(--black); }
.button-quiet { background: transparent; color: var(--black); }
.button-quiet:hover { background: var(--black); border-color: var(--black); color: var(--paper); }
.button-danger { background: var(--danger); border-color: var(--danger); }
.button-danger:hover { background: var(--black); border-color: var(--black); }

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

/* --- Covers: two inks, nothing else --- */

.cover { background: var(--ground); color: var(--ink); }
.cover a { color: inherit; }
.cover .cover-cta { color: var(--ground); }

.cover-dateline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
}

.cover-lines { margin: 0; padding: 0; list-style: none; font-weight: 600; }
.cover-lines li { padding: 8px 0; border-bottom: 1px solid var(--ink); }

.cover-cta {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 24px;
  background: var(--ink);
  color: var(--ground);
  font: 600 0.9rem/1.2 var(--display);
  text-decoration: none;
  transition: transform 200ms var(--ease-out);
}

/* Catalog and intro: the issue cover beside its contents page. */
.issue { display: grid; border-bottom: 3px solid var(--black); }
.issue-cover {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: min(130vw, 720px);
  padding: 18px var(--gutter) 24px;
  text-decoration: none;
}
.issue-title {
  font-weight: 800;
  font-size: clamp(2.8rem, 12.5vw, 6.5rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin-top: auto;
  hyphens: auto;
}
a.issue-cover:hover .cover-cta { transform: translateX(6px); }
.issue-cover .cover-cta { align-self: flex-start; }
.issue-contents { padding: 32px var(--gutter) 40px; }
.issue-contents h2 { font-size: clamp(1.5rem, 5vw, 2rem); margin-bottom: 16px; }
.scales { margin: 24px 0; }
.scales div { padding: 14px 0; border-top: 1px solid var(--black); }
.scales div:last-child { border-bottom: 1px solid var(--black); }
.scales dt { font-weight: 700; }
.scales dd { margin: 2px 0 0; color: var(--muted); }

/* Newsstand rack and the account shelf. */
.newsstand { max-width: var(--wide); margin: 0 auto; padding: 48px var(--gutter) 64px; }
.newsstand h2 { font-size: clamp(1.6rem, 5vw, 2.4rem); margin-bottom: 10px; }
.rack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.mini-cover {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 3 / 4;
  padding: 12px;
  background: var(--ground);
  color: var(--ink);
  text-decoration: none;
  transition: transform 220ms var(--ease-out);
}
/* Two inks, no shadows: a cover lifts off the rack, it doesn't glow. */
.mini-cover:hover { transform: translateY(-5px); }
.mini-cover[aria-current="page"] { outline: 3px solid var(--black); outline-offset: 4px; }
.mini-cover-flag {
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--ink);
  font: 700 0.62rem/1.2 var(--display);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
/* Sized to the cover itself, not the viewport: the same cover sits in a
   4-column rack on the home page and on a narrower account shelf. 25cqi
   fits the widest code (ENTJ/ENTP) inside the padding. */
.mini-cover-code { margin: 10px 0 auto; font: 800 25cqi/0.9 var(--display); letter-spacing: -0.03em; white-space: nowrap; }
.mini-cover-poles { font-size: 0.74rem; font-weight: 600; line-height: 1.3; border-top: 1.5px solid var(--ink); padding-top: 8px; }
.shelf-date { display: block; margin-top: 8px; color: var(--muted); font-size: 0.85rem; }

/* --- Result and type cover --- */

.result-cover { padding: 18px var(--gutter) 32px; }
.result-cover { container-type: inline-size; }
.cover-code { margin: 28px 0 6px; font-weight: 400; }
/* Sized to the column: 27cqi fits the widest code (ENTP); app.js then
   fits each code exactly, capped by the viewport height. */
.cover-code-letters {
  display: inline-block;
  font: 900 min(27cqi, 36vh)/0.86 var(--display);
  letter-spacing: -0.03em;
  margin-left: -0.05em;
  white-space: nowrap;
}
.cover-poles { font: 500 clamp(0.95rem, 3vw, 1.35rem)/1.35 var(--display); letter-spacing: -0.01em; margin: 10px 0 28px; }
.cover-cta-row { margin: 0; }

.cover-scales { display: grid; gap: 22px; margin: 0; padding: 0; list-style: none; }
.cover-scale { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: end; }
.cover-scale-pole { font-size: 0.95rem; line-height: 1.25; }
.cover-scale-pole b { font: 700 1rem/1 var(--display); font-variant-numeric: tabular-nums; }
.cover-scale-pole:last-of-type { text-align: right; }
.cover-scale-pole.is-lead { font-weight: 700; }
.cover-scale-track {
  grid-column: 1 / -1;
  position: relative;
  height: 14px;
  border: 2px solid var(--ink);
}
/* The midline: where 50/50 would sit. */
.cover-scale-track::after {
  content: "";
  position: absolute;
  left: calc(50% - 1px);
  top: -7px;
  bottom: -7px;
  width: 2px;
  background: var(--ink);
}
/* Ink starts at the midline and reaches out to the leading pole: a 63/37
   axis fills a quarter of the bar on the 63 side, a 50/50 axis stays empty. */
.cover-scale-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 50%;
  background: var(--ink);
  transform: scaleX(var(--s));
  transform-origin: right;
  animation: settle 1100ms var(--ease-out) 250ms both;
}
.leans-right .cover-scale-fill { left: 50%; transform-origin: left; }
.cover-scale-note { grid-column: 1 / -1; font-size: 0.82rem; font-weight: 700; text-align: center; }

/* The ink leaves the neutral midline and settles on the person's value. */
@keyframes settle {
  from { transform: scaleX(0); }
  to { transform: scaleX(var(--s)); }
}

.share { border-bottom: 1px solid var(--black); }
.share-native { margin: 16px var(--gutter) 0; }
.share-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 16px var(--gutter);
  list-style: none;
}
.share-links a, .share-links button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--black);
  background: transparent;
  color: var(--black);
  font: 600 0.9rem/1 var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.share-links a:hover, .share-links button:hover { background: var(--black); color: var(--paper); }

/* --- Long read --- */

.feature { max-width: calc(68ch + 2 * var(--gutter)); margin: 40px auto; padding: 0 var(--gutter); }
.feature > p:first-child { font-size: 1.25rem; line-height: 1.5; }
.feature h2 { font-size: 1.45rem; margin: 2em 0 0.6em; }
.feature h3 { font-size: 1.1rem; margin: 1.6em 0 0.5em; }
.feature ul { margin: 0 0 1em; padding-left: 1.1em; }
.feature li { margin-bottom: 0.4em; }
.feature li::marker { content: "— "; }
.feature-pending { color: var(--muted); font-size: 1.2rem; }

.feature-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  max-width: calc(68ch + 2 * var(--gutter));
  margin: 0 auto 56px;
  padding: 24px var(--gutter) 0;
  border-top: 3px solid var(--black);
}
.feature-end .fine-print { flex-basis: 100%; margin: 8px 0 0; }

/* --- Coupons: forms and offers cut out of the page --- */

.coupon {
  max-width: 520px;
  margin: 32px var(--gutter);
  padding: 24px 20px;
  border: 2px dashed var(--black);
  background: var(--paper);
}
.coupon h1, .coupon h2 { font-size: clamp(1.4rem, 5vw, 1.8rem); margin-bottom: 12px; }
.coupon p:last-child { margin-bottom: 0; }
.coupon-lead { color: var(--muted); }
.coupon-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 16px; }
.coupon-foot { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 4px; font-size: 0.95rem; }
.coupon-page { padding: 24px 0 48px; }
.coupon-notice { margin-inline: 0; }

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 4px; }
.field > span { font-weight: 600; font-size: 0.95rem; }
.field small { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.field input {
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 2px solid var(--black);
  border-radius: 0;
  background: transparent;
  color: var(--black);
  font: inherit;
  font-size: 1.05rem;
}
.field input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 2px 0 var(--accent); }
.field input[aria-invalid="true"] { border-bottom-color: var(--danger); }
.checkbox { display: flex; gap: 12px; align-items: flex-start; font-size: 0.92rem; line-height: 1.45; }
.checkbox input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--black); }
.form-error { margin: -8px 0 0; color: var(--danger); font-weight: 600; font-size: 0.92rem; }
.form .button { justify-self: start; }

/* --- Plain pages --- */

.section-page { max-width: calc(68ch + 2 * var(--gutter)); margin: 0 auto; padding: 40px var(--gutter) 64px; }
.section-page h1 { font-size: clamp(2rem, 7vw, 3.2rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 24px; }
.shelf { margin-bottom: 24px; }
.danger-zone { margin-top: 64px; padding-top: 16px; border-top: 1px solid var(--black); }
.danger-zone summary { font-weight: 600; cursor: pointer; }
.danger-zone[open] summary { margin-bottom: 12px; }

/* --- Questionnaire --- */

.questionnaire { max-width: calc(68ch + 2 * var(--gutter)); margin: 0 auto; padding: 32px var(--gutter) 72px; }
.questionnaire-head h1 { font-size: clamp(1.7rem, 6vw, 2.6rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 12px; }
.questionnaire-head p { color: var(--muted); }

.progress {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding: 14px 0 12px;
  background: var(--paper);
}
.progress-text { font-weight: 600; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.progress-track { display: block; height: 12px; border: 2px solid var(--black); }
.progress-bar { display: block; height: 100%; background: var(--black); transform: scaleX(0); transform-origin: left; transition: transform 400ms var(--ease-out); }
.note { color: var(--muted); font-size: 0.9rem; }

.question { margin: 0; padding: 28px 0 24px; border: 0; border-bottom: 1px solid var(--black); min-width: 0; }
.question legend { float: left; width: 100%; padding: 0; font-weight: 600; font-size: 1.2rem; line-height: 1.4; transition: color 200ms ease-out; }
.question.done legend { color: var(--muted); }
.scale { clear: both; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; gap: 8px; padding-top: 18px; }
.scale-option { position: relative; display: block; cursor: pointer; }
.scale-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.scale-box {
  display: block;
  height: 44px;
  border: 2px solid var(--black);
  background: var(--paper);
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out;
}
/* Extremes are bigger: the strength of the answer is visible in the form. */
.scale-option:nth-child(1) .scale-box, .scale-option:nth-child(5) .scale-box { height: 56px; }
.scale-option:nth-child(3) .scale-box { height: 34px; }
.scale-option:hover .scale-box { box-shadow: inset 0 0 0 2px var(--black); }
.scale-option input:checked + .scale-box { background: var(--black); box-shadow: inset 0 0 0 4px var(--paper); }
.scale-option input:focus-visible + .scale-box { outline: 3px solid var(--accent); outline-offset: 3px; }
.scale-ends { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; color: var(--muted); font-size: 0.82rem; }

.quiz-nav { display: flex; gap: 12px; margin-top: 28px; }
.quiz-nav [data-nav="next"], .quiz-nav [data-nav="finish"] { margin-left: auto; }

/* --- Wider screens --- */

@media (min-width: 700px) {
  :root { --gutter: 32px; }
  .rack { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .mini-cover { padding: 16px; }

  .coupon { margin-inline: auto; padding: 32px; }
  .cover-scales { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 48px; }
}

@media (min-width: 960px) {
  .issue { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  /* One left edge for the whole site: masthead, covers, share row, article,
     rack and colophon all start on the same vertical, like pages set on one grid. */
  :root { --edge: max(40px, calc((100vw - var(--wide)) / 2)); }
  .masthead, .colophon, .flash { padding-inline: var(--edge); }
  .issue-cover { min-height: 640px; padding: 28px 40px 40px var(--edge); }
  .issue-contents { padding: 40px var(--edge) 40px 40px; align-self: center; }
  .newsstand { max-width: none; padding-inline: var(--edge); }
  .result-cover { padding: 28px var(--edge) 48px; }
  .share-links { max-width: none; padding-inline: var(--edge); }
  .share-native { margin-inline: var(--edge); }
  .type-issue .feature, .type-issue .feature-end { margin-left: var(--edge); padding-inline: 0; max-width: 68ch; }
}

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