/* Nebula Press — an indie sci-fi publisher, 12 titles.
   Design system: dark space, literary serif (Spectral) + bibliographic mono
   (Fragment Mono). Catalog-as-constellation: horizontal shelf rows, books as
   CSS 3D volumes, a perpetual parallax starfield behind everything. */

:root {
  --space: #0B0D17;
  --space-deep: #05060B;
  --starlight: #E6E8F0;
  --starlight-dim: #A9AEC4;
  --indigo: #5E60CE;
  --gold: #F0A202;
  --cyan: #48BFE3;

  --serif: 'Spectral', Georgia, serif;
  --mono: 'Fragment Mono', 'Courier New', monospace;

  /* modular type scale, ratio ~1.25 */
  --step-1: clamp(0.78rem, 0.74rem + 0.2vw, 0.86rem);
  --step0: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
  --step1: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem);
  --step2: clamp(1.5rem, 1.3rem + 0.8vw, 1.95rem);
  --step3: clamp(1.9rem, 1.6rem + 1.4vw, 2.75rem);
  --step4: clamp(2.6rem, 2rem + 3vw, 4.4rem);
  --step5: clamp(3.4rem, 2.4rem + 5vw, 6.4rem);

  --space-2: 0.5rem;
  --space-3: 0.85rem;
  --space-4: 1.4rem;
  --space-5: 2.3rem;
  --space-6: 3.8rem;
  --space-7: 6.2rem;
  --space-8: 10rem;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--space);
  color: var(--starlight);
  font-family: var(--serif);
  font-size: var(--step0);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: var(--space);
}

/* film-grain overlay — breaks up the flat digital dark and gives the
   space background a little physicality; static, so it costs nothing
   under prefers-reduced-motion */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

a { color: inherit; }
::selection { background: var(--indigo); color: var(--starlight); }

.mono { font-family: var(--mono); }

/* ---------------- layout shell ---------------- */

.shell {
  position: relative;
  z-index: 1;
}

.wrap {
  max-width: 78rem;
  margin: 0 auto;
  padding-inline: clamp(1.25rem, 4vw, 3.5rem);
}

/* ---------------- nav ---------------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--space-4) clamp(1.25rem, 4vw, 3.5rem);
  pointer-events: none;
}
.nav::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 7rem;
  background: linear-gradient(180deg, rgba(5,6,11,0.92) 0%, rgba(5,6,11,0.55) 55%, transparent 100%);
  pointer-events: none;
}
.nav > * { pointer-events: auto; position: relative; }

.nav-mark {
  font-family: var(--mono);
  font-size: var(--step-1);
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--starlight);
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  background: rgba(5, 6, 11, 0.35);
  padding: 0.4em 0.7em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.nav-mark strong { font-weight: 600; }
.nav-mark span { color: var(--starlight-dim); font-size: 0.85em; }
.nav-mark:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 3px; }

.nav-links {
  list-style: none;
  display: flex;
  gap: var(--space-4);
  margin: 0;
  padding: 0.4em 0.7em;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  background: rgba(5, 6, 11, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.nav-links a {
  text-decoration: none;
  color: var(--starlight-dim);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.25s, border-color 0.25s;
}
.nav-links a:hover, .nav-links a:focus-visible { color: var(--gold); border-color: var(--gold); }
.nav-links a:focus-visible { outline: none; }
@media (max-width: 640px) {
  .nav { gap: var(--space-3); }
  .nav-mark { flex: 0 0 auto; font-size: 0.66rem; }
  .nav-links {
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.62rem;
    padding: 0 0.6em;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-mask-image: linear-gradient(90deg, black calc(100% - 14px), transparent 100%);
    mask-image: linear-gradient(90deg, black calc(100% - 14px), transparent 100%);
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ---------------- hero ---------------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--space-7);
  padding-bottom: var(--space-6);
}

.hero-kicker {
  font-family: var(--mono);
  font-size: var(--step-1);
  letter-spacing: 0.22em;
  color: var(--cyan);
  margin: 0 0 var(--space-4);
  text-transform: uppercase;
}

.hero h1 {
  font-size: var(--step5);
  font-weight: 300;
  line-height: 0.98;
  margin: 0 0 var(--space-5);
  letter-spacing: -0.01em;
  max-width: 16ch;
}
.hero h1 em { font-style: italic; color: var(--gold); }

.hero-statement {
  max-width: 56ch;
  font-size: var(--step1);
  font-weight: 300;
  color: var(--starlight);
  margin: 0 0 var(--space-5);
}
.hero-statement + .hero-statement { margin-top: -1.2rem; color: var(--starlight-dim); font-size: var(--step0); }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-6);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--starlight-dim);
  border-top: 1px solid rgba(230, 232, 240, 0.15);
  padding-top: var(--space-3);
  max-width: 46rem;
}
.hero-meta dt { color: var(--cyan); display: inline; }
.hero-meta dd { margin: 0; display: inline; }
.hero-meta div { display: flex; gap: 0.5em; }

.scroll-cue {
  position: absolute;
  bottom: var(--space-5);
  left: clamp(1.25rem, 4vw, 3.5rem);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--starlight-dim);
  display: flex;
  align-items: center;
  gap: 0.6em;
}
.scroll-cue::after {
  content: '';
  width: 1px; height: 34px;
  background: linear-gradient(var(--cyan), transparent);
  animation: cue-fall 2.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .scroll-cue::after { animation: none; } }
@keyframes cue-fall { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

/* ---------------- section chrome ---------------- */

.section { padding-block: var(--space-7); position: relative; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: var(--step3);
  font-weight: 300;
  margin: 0;
  letter-spacing: -0.01em;
}
.section-tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--starlight-dim);
  text-align: right;
  max-width: 30ch;
}
.section-tag b { color: var(--gold); font-weight: 400; }

.imprint-head {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: var(--cyan);
  text-transform: uppercase;
  margin: var(--space-6) 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.imprint-head::after { content: ''; flex: 1; height: 1px; background: rgba(72, 191, 227, 0.25); }
.imprint-head:first-of-type { margin-top: 0; }

/* ---------------- shelf rows ---------------- */

.shelf {
  display: flex;
  gap: var(--space-5);
  overflow-x: auto;
  overflow-y: visible;
  padding: 1.5rem clamp(1.25rem, 4vw, 3.5rem) 2.5rem;
  margin: 0 calc(-1 * clamp(1.25rem, 4vw, 3.5rem));
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--indigo) transparent;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, black 24px, black calc(100% - 24px), transparent 100%);
}
.shelf::before, .shelf::after { content: none; }
.shelf::-webkit-scrollbar { height: 6px; }
.shelf::-webkit-scrollbar-thumb { background: var(--indigo); }
.shelf::-webkit-scrollbar-track { background: transparent; }

.shelf-floor {
  position: relative;
}
.shelf-floor::after {
  content: '';
  position: absolute;
  left: clamp(1.25rem, 4vw, 3.5rem);
  right: clamp(1.25rem, 4vw, 3.5rem);
  bottom: 1.9rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(230,232,240,0.22) 8%, rgba(230,232,240,0.22) 92%, transparent);
}

/* ---------------- volume (3D book) ---------------- */

.volume-slot {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 168px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.volume {
  --w: 168px;
  --h: 252px;
  width: var(--w);
  height: var(--h);
  perspective: 1100px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  display: block;
  opacity: 0;
  transform: translateY(28px);
}
.volume-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: left center;
  transform: rotateY(-13deg);
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.volume:hover .volume-inner,
.volume:focus-visible .volume-inner {
  transform: rotateY(-42deg);
}
.volume:active .volume-inner { transform: rotateY(-34deg) scale(0.99); }

.face { position: absolute; top: 0; left: 0; height: 100%; backface-visibility: hidden; }
.face.front {
  width: 100%;
  box-shadow: 6px 14px 30px rgba(0,0,0,0.55);
  overflow: hidden;
}
.face.front svg { display: block; width: 100%; height: 100%; }
.face.spine {
  width: var(--depth, 20px);
  transform-origin: left center;
  transform: rotateY(-90deg);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(0,0,0,0.35));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.5);
}
.spine-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--starlight);
  white-space: nowrap;
  overflow: hidden;
  max-height: 78%;
  text-overflow: ellipsis;
}
.spine-num {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--gold);
}

.volume:focus-visible { outline: none; }
.volume:focus-visible .face.front { box-shadow: 0 0 0 2px var(--gold), 6px 14px 30px rgba(0,0,0,0.55); }

.volume-caption {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--starlight-dim);
  line-height: 1.5;
  width: var(--w, 168px);
}
.volume-caption .t { color: var(--starlight); display: block; font-size: 0.76rem; }
.volume-caption .price { color: var(--gold); }

/* forthcoming volumes: no hover-open needed, static tilt, wireframe look */
.volume-slot.forthcoming .volume { cursor: default; }
.volume-slot.forthcoming .volume-inner { transform: rotateY(-13deg); transition: transform 0.5s ease; }
.volume-slot.forthcoming .volume:hover .volume-inner { transform: rotateY(-20deg); }
.volume-slot.forthcoming .face.front svg { filter: saturate(0.9); }
.season-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--cyan);
  letter-spacing: 0.1em;
}

/* ---------------- new & notable intro copy ---------------- */

.lede {
  max-width: 62ch;
  color: var(--starlight-dim);
  font-size: var(--step0);
  margin: 0 0 var(--space-5);
}

/* ---------------- about / submissions ---------------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 780px) { .about-grid { grid-template-columns: 1fr; } }

.about-copy p {
  max-width: 62ch;
  color: var(--starlight);
  font-size: var(--step1);
  font-weight: 300;
  margin: 0 0 var(--space-4);
}
.about-copy p:last-child { margin-bottom: 0; }

.submissions {
  font-family: var(--mono);
  font-size: 0.85rem;
  border: 1px solid rgba(230,232,240,0.18);
  padding: var(--space-5);
  background: rgba(11,13,23,0.5);
}
.submissions h3 {
  margin: 0 0 var(--space-4);
  font-family: var(--serif);
  font-size: var(--step2);
  font-weight: 300;
  color: var(--starlight);
}
.submissions dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.6em 1.2em; }
.submissions dt { color: var(--cyan); letter-spacing: 0.04em; }
.submissions dd { margin: 0; color: var(--starlight-dim); }
.submissions .addr {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed rgba(230,232,240,0.2);
  color: var(--starlight-dim);
  line-height: 1.7;
}
.submissions .addr strong { color: var(--starlight); }

/* ---------------- footer ---------------- */

.site-footer {
  border-top: 1px solid rgba(230,232,240,0.14);
  padding-block: var(--space-5) var(--space-6);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--starlight-dim);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.site-footer a { color: var(--starlight-dim); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--gold); }

/* ---------------- modal ---------------- */

.excerpt-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 11, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.excerpt-backdrop.open { opacity: 1; pointer-events: auto; }

.excerpt-modal {
  background: var(--space-deep);
  border: 1px solid rgba(230,232,240,0.16);
  max-width: 42rem;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  padding: clamp(1.6rem, 4vw, 3rem);
  position: relative;
  transform: translateY(18px) scale(0.98);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.excerpt-backdrop.open .excerpt-modal { transform: translateY(0) scale(1); }

.excerpt-close {
  position: absolute;
  top: 1.1rem; right: 1.1rem;
  background: none;
  border: 1px solid rgba(230,232,240,0.3);
  color: var(--starlight);
  width: 2.75rem; height: 2.75rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1;
}
.excerpt-close:hover, .excerpt-close:focus-visible { border-color: var(--gold); color: var(--gold); outline: none; }

.excerpt-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--starlight-dim);
  display: flex;
  gap: 1.2em;
  flex-wrap: wrap;
  padding-right: 3.1rem;
  margin-bottom: var(--space-3);
}
.excerpt-meta .imprint { color: var(--cyan); }

.excerpt-modal h3 {
  font-size: var(--step3);
  font-weight: 400;
  margin: 0 0 0.2em;
  max-width: 22ch;
}
.excerpt-modal .by {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--gold);
  margin: 0 0 var(--space-4);
  letter-spacing: 0.04em;
}
.excerpt-modal .pitch {
  color: var(--starlight-dim);
  font-style: italic;
  max-width: 55ch;
  margin: 0 0 var(--space-4);
  padding-left: var(--space-3);
  border-left: 2px solid var(--indigo);
}
.excerpt-body { max-width: 62ch; }
.excerpt-body p { margin: 0 0 1.1em; }
.excerpt-body p:first-of-type::first-letter {
  font-family: var(--serif);
  font-size: 3.6em;
  font-weight: 600;
  float: left;
  line-height: 0.82;
  padding: 0.05em 0.08em 0 0;
  color: var(--gold);
}
.excerpt-buy {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid rgba(230,232,240,0.14);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--starlight-dim);
  display: flex;
  justify-content: space-between;
}
.excerpt-buy .price { color: var(--gold); font-size: 1rem; }

/* ---------------- reveal helper (JS toggles .in-view) ---------------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2,0.7,0.2,1); }
.reveal.in-view { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .volume, .reveal { opacity: 1 !important; transform: none !important; }
  .volume-inner { transition: none !important; }
  .excerpt-backdrop, .excerpt-modal { transition: none !important; }
}

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

@media (max-width: 640px) {
  .hero { padding-top: 8.5rem; }
  .section { padding-block: var(--space-6); }
  .volume-slot { width: 136px; }
  .volume { --w: 136px; --h: 204px; }
  .about-grid { gap: var(--space-5); }
  .section-tag { text-align: left; max-width: 40ch; }
}
