/* ==========================================================================
   SCRAPPY WORLDS — shared stylesheet
   Design tokens live at the top. Change a value here, it updates everywhere.
   ========================================================================== */

:root {
  /* colour */
  --bg-base:      #1b1712;
  --bg-panel:     #26221b;
  --bg-panel-2:   #2f2a21;
  --text-main:    #ede6d6;
  --text-muted:   #9c917c;
  --text-faint:   #6d6555;
  --rust:         #b24a2c;
  --rust-bright:  #d0623f;
  --verdigris:    #6e8266;
  --line:         #3a342a;

  /* type */
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body:    'Spectral', Georgia, serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* layout */
  --measure: 66ch;
  --radius: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .fade-in { animation: fadeIn 0.6s ease-out both; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at top, rgba(178,74,44,0.06), transparent 60%);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--rust-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--rust-bright);
  outline-offset: 3px;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-main);
  margin: 0;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- signature element: the riveted seam ---------- */
.seam {
  border: none;
  height: 14px;
  margin: 0;
  background-image:
    radial-gradient(circle, var(--text-faint) 1.6px, transparent 1.8px);
  background-size: 28px 14px;
  background-position: center;
  background-repeat: repeat-x;
  opacity: 0.55;
  position: relative;
}
.seam::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--line);
  transform: translateY(-50%);
  z-index: -1;
}

/* ---------- site header ---------- */
.site-header {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.wordmark {
  font-size: 22px;
  letter-spacing: 0.08em;
}
.wordmark a { color: var(--text-main); }
.wordmark a:hover { text-decoration: none; color: var(--rust-bright); }
.site-header nav a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 18px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.site-header nav a:hover { color: var(--rust-bright); }

/* ---------- hero ---------- */
.hero {
  padding: 64px 0 0;
  text-align: center;
}
.hero h1 {
  font-size: clamp(40px, 8vw, 76px);
  line-height: 0.95;
}
.hero .tagline {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 15px;
}
.hero-seam { margin-top: 48px; }

/* ---------- worlds shelf ---------- */
.section {
  padding: 56px 0;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
}

.crate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.crate {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: block;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.crate:hover {
  text-decoration: none;
  border-color: var(--rust);
  transform: translateY(-2px);
}
.crate-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--rust-bright);
  letter-spacing: 0.08em;
}
.crate h3 {
  margin-top: 8px;
  font-size: 24px;
}
.crate p {
  color: var(--text-muted);
  font-size: 15px;
  margin: 10px 0 0;
}
.crate.locked {
  opacity: 0.55;
  cursor: default;
}
.crate.locked:hover { border-color: var(--line); transform: none; }
.crate.locked .crate-tag { color: var(--text-faint); }

/* ---------- story listing rows ---------- */
.story-row {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.story-row:last-child { border-bottom: none; }
.story-code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--rust-bright);
  flex: 0 0 auto;
}
.story-info h3 { font-size: 20px; text-transform: none; letter-spacing: 0; }
.story-info h3 a { color: var(--text-main); }
.story-info h3 a:hover { color: var(--rust-bright); }
.story-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 4px;
}
.story-blurb {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 6px;
  max-width: 60ch;
}

/* ---------- reading view ---------- */
.reader {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 48px 24px 96px;
}
.reader .back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.reader .back-link:hover { color: var(--rust-bright); }
.reader h1 {
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.05;
}
.reader .story-meta { margin: 14px 0 40px; }

.part-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--rust-bright);
  letter-spacing: 0.15em;
  text-align: center;
  margin: 56px 0 28px;
}

.scene-break {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: center;
  margin: 40px 0;
}

.prose p { margin: 0 0 1.1em; text-align: justify; text-justify: inter-word; hyphens: auto; }
.prose { font-size: 19px; }

.story-source { display: none; }

.reader footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-faint);
}

/* ---------- site footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  text-align: center;
}
.site-footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .prose { font-size: 17px; }
  .story-row { flex-direction: column; gap: 4px; }
}
