/* ===========================================================================
   "Gde mi je nestao asteroid?!" — promo page
   ---------------------------------------------------------------------------
   Scene: every artwork layer is the same 7016x4962 canvas, laid out as
   identical cover-cropped images. They therefore stay registered with each
   other no matter how the scene is framed. Parallax = per-layer translate
   driven by --px / --py (set by js/parallax.js) times the layer depth --d.
   =========================================================================== */

:root {
  /* palette, pulled from the artwork */
  --void: #020e11;
  --void-soft: #06191e;
  --panel: #0b262c;
  --panel-2: #082026;
  --line: #1c4a53;
  --ink: #e9f3f0;
  --ink-2: #a3bfbc;
  --amber: #f8b75b;
  --coral: #e4683a;
  --teal: #58a3ad;

  --display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* how far the nearest layer travels, and the overscan that hides its edges */
  --amp: clamp(12px, 3.4vw, 46px);
  --overscan: 1.08;

  /* horizontal crop bias: keeps Solla and Čudni in frame on narrow screens.
     js/parallax.js recomputes the exact value from the real stage box. */
  --pos-x: 70%;
}

@media (min-aspect-ratio: 3/4)    { :root { --pos-x: 78%; } }
@media (min-aspect-ratio: 1/1)    { :root { --pos-x: 92%; } }
@media (min-aspect-ratio: 11/10)  { :root { --pos-x: 100%; } }
/* at 1.41 and wider the whole canvas fits, so there is nothing to bias */
@media (min-aspect-ratio: 142/100) { :root { --pos-x: 50%; } }

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
  text-rendering: optimizeSpeed;
}

img { max-width: 100%; height: auto; display: block; }

::selection { background: var(--amber); color: #14211f; }

a { color: var(--amber); }

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

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 20;
  padding: .6rem 1rem;
  background: var(--amber);
  color: #14211f;
  border-radius: 8px;
}
.skip:focus { left: 12px; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 52px);
}

/* very wide monitors: let the columns breathe instead of floating in whitespace */
@media (min-width: 1600px) {
  .wrap { max-width: min(1320px, 88vw); }
}

h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.75rem, 3.9vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 1.1rem;
}
h2::after {
  content: "";
  display: block;
  width: 58px;
  height: 4px;
  margin-top: .7rem;
  border-radius: 4px;
  background: var(--coral);
}

/* --------------------------------------------------------------------------
   1. hero scene
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  isolation: isolate;
  /* Capped on phones: a full-height hero would only ever show a sliver of
     the wide artwork, so the scene gets a shorter, wider frame there. */
  height: min(100svh, 700px);
  min-height: 460px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

@media (min-width: 760px) {
  .hero { height: min(100svh, 1020px); min-height: 560px; }
}

.stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--void);
}

.layer {
  position: absolute;
  inset: 0;
  scale: var(--overscan);
  translate:
    calc(var(--px, 0) * var(--d, 0) * var(--amp))
    calc(var(--py, 0) * var(--d, 0) * var(--amp));
  will-change: translate;
}

.layer picture,
.layer img {
  width: 100%;
  height: 100%;
}

.layer img {
  object-fit: cover;
  object-position: var(--pos-x) 50%;
}

/* depth of each layer, in units of --amp (0 = fixed) */
.layer--plate   { --d: 0; }
.layer--stars   { --d: .14; }
.layer--sibiling{ --d: .26; }
.layer--skeetara{ --d: .30; }
.layer--glow    { --d: .38; }
.layer--solla   { --d: .52; }
.layer--choodny { --d: .66; }

/* Scrim: a pool of the void colour under the copy, so the words never fight
   the artwork. Three stacked washes: a corner pool, a bottom ramp, a left ramp.
   The stops are variables because a short hero needs them higher up. */
.scrim {
  --pool: radial-gradient(130% 85% at 4% 104%,
    rgba(2, 14, 17, .78) 0%,
    rgba(2, 14, 17, .38) 46%,
    rgba(2, 14, 17, 0) 78%);
  --ramp: linear-gradient(to top,
    rgba(2, 14, 17, .95) 0%,
    rgba(2, 14, 17, .84) 12vh,
    rgba(2, 14, 17, .52) 24vh,
    rgba(2, 14, 17, .22) 32vh,
    rgba(2, 14, 17, 0) 40vh);
  --side: linear-gradient(to right,
    rgba(2, 14, 17, .62) 0%,
    rgba(2, 14, 17, 0) 62%);
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--pool), var(--ramp), var(--side);
}

/* Phones frame the wide artwork as a tall narrow slice, so the copy lands on
   the planetoid's mid-tones: there the pool is deeper. */
@media (max-width: 620px) {
  .scrim {
    --pool: radial-gradient(150% 105% at 0% 108%,
      rgba(2, 14, 17, .90) 0%,
      rgba(2, 14, 17, .62) 50%,
      rgba(2, 14, 17, 0) 86%);
    --ramp: linear-gradient(to top,
      rgba(2, 14, 17, .96) 0%,
      rgba(2, 14, 17, .88) 12vh,
      rgba(2, 14, 17, .58) 22vh,
      rgba(2, 14, 17, .28) 30vh,
      rgba(2, 14, 17, 0) 38vh);
    --side: linear-gradient(to right,
      rgba(2, 14, 17, .80) 0%,
      rgba(2, 14, 17, .45) 30%,
      rgba(2, 14, 17, 0) 72%);
  }
}

/* Short heroes (16:9 laptops, landscape phones): the copy sits higher relative
   to the frame, so the left column gets a deeper wash up to the eyebrow. */
@media (min-width: 621px) and (max-aspect-ratio: 2/1) {
  .scrim {
    --side: linear-gradient(to right,
      rgba(2, 14, 17, .80) 0%,
      rgba(2, 14, 17, .52) 26%,
      rgba(2, 14, 17, .18) 48%,
      rgba(2, 14, 17, 0) 68%);
  }
}

/* --- living details: the scene breathes while it stands still --- */
.layer--stars img    { animation: twinkle 9s ease-in-out infinite alternate; }
.layer--glow img     { animation: breathe 12s ease-in-out infinite alternate; }
.layer--choodny img  { animation: bob 15s ease-in-out infinite alternate; }
.layer--skeetara img { animation: drift 52s ease-in-out infinite alternate; }

@keyframes twinkle { from { opacity: .78; } to { opacity: 1; } }
@keyframes breathe { from { scale: 1; opacity: .82; } to { scale: 1.03; opacity: 1; } }
@keyframes bob     { from { translate: 0 .35%; } to { translate: 0 -.35%; } }
@keyframes drift   { from { translate: .5% 0; } to { translate: -.5% .2%; } }

.hero-copy {
  position: relative;
  z-index: 2;
  padding: 0 clamp(20px, 5vw, 52px) clamp(56px, 9vh, 104px);
  max-width: 760px;
  text-shadow: 0 2px 18px rgba(2, 14, 17, .7);
}

.eyebrow {
  display: inline-block;
  margin: 0 0 .55rem;
  padding: .3rem .7rem;
  background: rgba(2, 14, 17, .86);
  border-radius: 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: .84rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--teal);
}

.hero h1 {
  margin: 0 0 .6rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.5rem, 7.6vw, 5.4rem);
  line-height: .96;
  letter-spacing: -0.015em;
  rotate: -1.2deg;
  text-shadow: 0 6px 40px rgba(2, 14, 17, .8);
}
.hero h1 em {
  font-style: normal;
  color: var(--amber);
}

.tagline {
  margin: 0 0 1.4rem;
  max-width: 34ch;
  font-size: clamp(1.02rem, 2.3vw, 1.3rem);
  color: var(--ink-2);
}

.byline {
  margin: 0 0 1.5rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--coral);
}

/* --- buttons --- */
.cta { margin: 0; display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .78rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  transition: translate .18s ease, background .18s ease,
              border-color .18s ease, color .18s ease;
}
.btn:hover { translate: 0 -2px; }

.btn--primary { background: var(--amber); color: #17211f; }
.btn--primary:hover { background: #ffc975; }

.btn--ghost {
  border-color: rgba(233, 243, 240, .34);
  color: var(--ink);
  background: rgba(2, 14, 17, .35);
}
.btn--ghost:hover { border-color: var(--amber); color: var(--amber); }

.btn--insta {
  border-color: rgba(228, 104, 58, .55);
  color: #f4a97f;
}
.btn--insta:hover { background: var(--coral); border-color: var(--coral); color: #1c0e08; }

.cue {
  position: absolute;
  z-index: 2;
  right: clamp(16px, 4vw, 40px);
  bottom: clamp(16px, 3vh, 34px);
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(233, 243, 240, .28);
  border-radius: 999px;
  color: var(--ink-2);
  animation: cue 2.8s ease-in-out infinite;
}
.cue:hover { color: var(--amber); border-color: var(--amber); }
.cue svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

@keyframes cue {
  0%, 100% { translate: 0 0; opacity: .75; }
  50% { translate: 0 6px; opacity: 1; }
}

/* --------------------------------------------------------------------------
   2. buy
   -------------------------------------------------------------------------- */

.buy {
  position: relative;
  padding-block: clamp(52px, 8vw, 104px);
  background:
    radial-gradient(90% 120% at 82% 0%, rgba(30, 65, 73, .55) 0%, rgba(2, 14, 17, 0) 62%),
    var(--void-soft);
  border-block: 1px solid var(--line);
}

.buy__grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(26px, 5vw, 62px);
  align-items: start;
}

.buy__cover img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  rotate: -1.6deg;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .07);
  transition: rotate .3s ease, translate .3s ease;
}
.buy__cover:hover img { rotate: 0deg; translate: 0 -4px; }

/* the printed cover carries the studio mark, so the credit sits right under it */
.cover__credit {
  margin: .7rem 0 0;
  text-align: center;
  font-size: .82rem;
  letter-spacing: .04em;
  color: var(--ink-2);
}

.lede { margin: 0 0 1.4rem; color: var(--ink-2); }

.stores {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  gap: 12px;
}

.store {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "name price" "note price";
  align-items: center;
  gap: 2px 18px;
  padding: 1rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  text-decoration: none;
  color: var(--ink);
  transition: translate .18s ease, border-color .18s ease, background .18s ease;
}
.store:hover {
  translate: 0 -3px;
  border-color: rgba(248, 183, 91, .7);
  background: linear-gradient(180deg, #103038, var(--panel-2));
}

.store__name { grid-area: name; font-family: var(--display); font-weight: 700; font-size: 1.2rem; }
.store__note { grid-area: note; font-size: .9rem; color: var(--ink-2); }
.store__price {
  grid-area: price;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--amber);
  white-space: nowrap;
}
.store__price small { font-size: .62em; letter-spacing: .06em; color: var(--ink-2); }

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 26px;
}
@media (min-width: 760px) {
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.facts div { border-top: 1px solid var(--line); padding-top: .6rem; }
.facts dt {
  font-size: .76rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal);
}
/* the ISBN must never break in the middle of a digit group, so it gets its own row */
.facts div:last-child { grid-column: 1 / -1; }
.facts dd { margin: .15rem 0 0; max-width: 34ch; font-size: .98rem; }
.facts div:last-child dd { white-space: nowrap; }
.facts .muted { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   3. o knjizi
   -------------------------------------------------------------------------- */

.about { padding-block: clamp(52px, 8vw, 104px); }

.synopsis {
  margin: 0 0 2.6rem;
  max-width: 66ch;
  font-size: clamp(1.05rem, 2.1vw, 1.32rem);
  line-height: 1.7;
  color: #d5e6e2;
}
.synopsis__hook {
  display: block;
  margin-bottom: .9rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.12em;
  line-height: 1.35;
  color: var(--amber);
}

.cast {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.cast li {
  padding: 1.1rem 1.3rem;
  border-left: 3px solid var(--coral);
  border-radius: 0 14px 14px 0;
  background: var(--panel-2);
}
.cast h3 {
  margin: 0 0 .35rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--teal);
}
.cast p { margin: 0; max-width: 46ch; font-size: .98rem; color: var(--ink-2); }

/* on a wide monitor two cards would otherwise stretch into long thin lines */
@media (min-width: 1300px) {
  .cast li { padding: 1.6rem 1.8rem; }
  .cast h3 { font-size: 1.4rem; }
  .cast p { font-size: 1.06rem; line-height: 1.7; }
}

/* --------------------------------------------------------------------------
   4. o autorki
   -------------------------------------------------------------------------- */

.author {
  padding-block: clamp(52px, 8vw, 104px);
  background: var(--void-soft);
  border-top: 1px solid var(--line);
}

.author__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 260px);
  gap: clamp(26px, 5vw, 56px);
  align-items: start;
}
.author p { margin: 0 0 1.05rem; max-width: 68ch; color: #d5e6e2; }
.author em { color: var(--ink); font-style: italic; }
.debut {
  font-family: var(--display);
  font-weight: 700;
  color: var(--amber);
}

.author__side {
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}
.author__side-title {
  margin: 0 0 .8rem;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--teal);
}
.author__side .btn { width: 100%; justify-content: center; }

/* --------------------------------------------------------------------------
   5. footer
   -------------------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 26px 0 44px;
  color: var(--ink-2);
  font-size: .92rem;
}
.foot__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px 30px;
  align-items: center;
}
.foot__brand {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.foot__brand span { font-weight: 400; color: var(--ink-2); font-size: .95em; }
.foot__nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot__nav a { color: var(--ink-2); text-decoration: none; }
.foot__nav a:hover { color: var(--amber); }
.foot__legal { margin: 0; grid-column: 1 / -1; font-size: .85rem; opacity: .8; }

/* --------------------------------------------------------------------------
   responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .buy__grid,
  .author__grid { grid-template-columns: minmax(0, 1fr); }
  .buy__cover { max-width: 240px; }
  .author__side { max-width: 340px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .hero { min-height: 520px; }
  .hero h1 { rotate: -0.8deg; }
  .hero-copy { padding-bottom: clamp(48px, 12vh, 90px); max-width: none; }
  .cue { display: none; }
  .foot__grid { grid-template-columns: minmax(0, 1fr); }
  .store { grid-template-columns: 1fr auto; grid-template-areas: "name price" "note note"; }
}

@media (max-height: 560px) {
  .hero { height: auto; min-height: 420px; padding-block: 40px; }
}

/* --------------------------------------------------------------------------
   motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .layer { translate: none; }
  .layer img { animation: none; }
  .cue { animation: none; }
  .btn:hover, .store:hover, .buy__cover:hover img { translate: none; }
  .buy__cover img { rotate: -1.6deg; }
}
