:root {
  --color-bg: #f6f1e7;
  --color-ink: #262220;
  --color-primary: #c08a2e; /* gold - matches &primary& / .title */
  --color-secondary: #5f7259; /* olive - matches |secondary| / .body */
  --color-muted: #a79c89;
  --color-card: #fffdf9;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-story: 'EB Garamond', serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
}

/* --- Site chrome --------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(38, 34, 32, 0.08);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
}
.brand span {
  color: var(--color-secondary);
  font-weight: 400;
}

.search-form input {
  font-family: var(--font-body);
  border: 1px solid var(--color-muted);
  background: var(--color-card);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  min-width: 220px;
}

.site-footer {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.8rem;
  padding: 3rem 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- App shell ------------------------------------------------------------ */

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  min-height: 50vh;
}

.loading,
.empty,
.error {
  font-family: var(--font-display);
  color: var(--color-muted);
  text-align: center;
  width: 100%;
  padding: 4rem 0;
}
.error {
  color: #a94442;
}

.story-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.story-list a {
  display: block;
  background: var(--color-card);
  border-radius: 14px;
  padding: 1.25rem;
  font-family: var(--font-display);
  color: var(--color-ink);
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(38, 34, 32, 0.08);
}

/* --- Story card: the signature element ------------------------------------
   A 9:16 "story frame" so browsing on the website still evokes the format
   the content was actually authored for (Instagram stories). */

.story {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.story-page {
  width: 300px;
  aspect-ratio: 9 / 16;
  background: var(--color-card);
  border-radius: 22px;
  box-shadow: 0 8px 24px rgba(38, 34, 32, 0.12);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-story);
}

.page-nav {
  width: 100%;
  max-width: 300px;
  margin: 1rem auto 0;
  display: flex;
  justify-content: space-between;
}
.page-nav a {
  font-family: var(--font-display);
  color: var(--color-secondary);
  text-decoration: none;
  font-size: 1.5rem;
}

/* --- Blocks (rendered by renderer.js) -------------------------------------- */

.block-text {
  text-align: center;
  line-height: 1.5;
}
.text--title {
  font-size: 1.5rem;
  font-style: italic;
  color: var(--color-primary);
}
.text--scientific {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--color-secondary);
}
.text--body {
  font-size: 1.05rem;
  color: var(--color-secondary);
}
.text--footer {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--color-muted);
}

.block-image img,
.block-asset-image img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border-radius: 10px;
}

/* --- Micro-language inline styles (parser.js) ------------------------------ */

.primary {
  color: var(--color-primary);
}
.secondary {
  color: var(--color-secondary);
}
.short-ref,
.internal-link {
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
