/* ============================================================
   STORYTIME WRITERS — Global Styles
   Aesthetic: Literary Midnight / Parchment Editorial
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,600&family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,500&family=IBM+Plex+Mono:wght@300;400;500&display=swap');

/* ── TOKENS ───────────────────────────────────────────────── */
:root {
  --ink:         #1a1209;
  --ink-light:   #4a3f2f;
  --paper:       #f8f4ec;
  --paper-dark:  #ede8dc;
  --paper-mid:   #e5dfd3;
  --gold:        #b8890a;
  --gold-light:  #d4a92a;
  --gold-pale:   #f0e4bc;
  --forest:      #2d4a3e;
  --forest-mid:  #3d6355;
  --forest-pale: #e2ede9;
  --muted:       #8b7355;
  --border:      #d4ccbb;
  --shadow-sm:   0 1px 3px rgba(26,18,9,0.08);
  --shadow-md:   0 4px 16px rgba(26,18,9,0.10);
  --shadow-lg:   0 12px 40px rgba(26,18,9,0.14);
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Lora', Georgia, serif;
  --font-mono:    'IBM Plex Mono', monospace;
  --nav-h:        64px;
  --max-w:        1200px;
  --story-w:      720px;
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
ul { list-style: none; }

/* ── TEXTURE OVERLAY ──────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ── NAVIGATION ───────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 2rem;
  backdrop-filter: blur(8px);
  background: rgba(248,244,236,0.92);
}
.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-right { justify-content: flex-end; }
.nav-logo {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
}
.nav-logo span { color: var(--gold); }
.nav-logo small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.48rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  transition: color 0.2s;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.nav-link:hover, .nav-link.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.nav-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;
}
.nav-avatar:hover { border-color: var(--gold); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--forest);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-gold {
  background: var(--gold);
  color: var(--paper);
}
.btn-gold:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(184,137,10,0.3);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-light);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-pale);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
}
.btn-ghost:hover { color: var(--gold); background: var(--gold-pale); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.65rem; }
.btn-lg { padding: 0.75rem 1.8rem; font-size: 0.78rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ── TAGS ─────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  background: var(--paper-dark);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tag:hover, .tag.active {
  background: var(--forest-pale);
  border-color: var(--forest-mid);
  color: var(--forest);
}
.tag.genre-fiction    { background: #eee8f8; border-color: #c4b8e8; color: #5a3fa0; }
.tag.genre-fantasy    { background: #e8f4ee; border-color: #a8d4b8; color: #2d6845; }
.tag.genre-romance    { background: #fce8ee; border-color: #f0b8c8; color: #a03060; }
.tag.genre-thriller   { background: #f8ece0; border-color: #e0b890; color: #8b4010; }
.tag.genre-scifi      { background: #e0eef8; border-color: #98c4e0; color: #1a5080; }
.tag.genre-horror     { background: #f0e8e8; border-color: #d0a0a0; color: #802020; }
.tag.genre-mystery    { background: #eee8e0; border-color: #c8b898; color: #604820; }
.tag.genre-drama      { background: #e8e8f0; border-color: #b8b8d0; color: #404070; }
.tag.genre-comedy     { background: #fef8e0; border-color: #e0d090; color: #706020; }
.tag.genre-historical { background: #f4ede0; border-color: #d4b888; color: #6a4010; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.story-card {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.story-card-body { padding: 1.5rem; flex: 1; }
.story-card-footer {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--paper-mid);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.story-card-prompt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.story-card-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  color: var(--ink);
  transition: color 0.15s;
}
.story-card:hover .story-card-title { color: var(--forest); }
.story-card-excerpt {
  font-size: 0.9rem;
  color: var(--ink-light);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1rem;
}
.story-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.story-card-meta-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.story-card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.story-card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.55rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  cursor: pointer;
}
.action-btn:hover { background: var(--paper-dark); color: var(--ink); }
.action-btn.active { color: var(--gold); }
.action-btn.liked { color: #c0392b; }
.action-btn.bookmarked { color: var(--forest); }
.action-btn svg { width: 14px; height: 14px; }

/* ── GRID ─────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.5rem; }

/* ── HERO ─────────────────────────────────────────────────── */
.hero {
  padding: 5rem 0 3rem;
  text-align: center;
  position: relative;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.hero-eyebrow::before, .hero-eyebrow::after {
  content: '';
  width: 40px;
  height: 1px;
  background: var(--gold);
  opacity: 0.5;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 300;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}
.hero-title em { font-style: italic; color: var(--forest); }
.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}
.hero-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0;
}
.hero-divider::before, .hero-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.hero-divider span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── PROMPTS ──────────────────────────────────────────────── */
.prompts-section {
  padding: 3rem 0;
  background: var(--paper-dark);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.section-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--ink);
}
.prompt-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.prompt-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
  cursor: default;
}
.prompt-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}
.prompt-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.prompt-card:hover::before { transform: scaleX(1); }
.prompt-number {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 700;
  color: var(--paper-mid);
  line-height: 1;
  position: absolute;
  top: 0.5rem;
  right: 1rem;
}
.prompt-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.prompt-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--ink);
}
.prompt-desc {
  font-size: 0.85rem;
  color: var(--ink-light);
  line-height: 1.6;
}
.prompt-write-btn {
  margin-top: 1.1rem;
}

/* ── FILTER BAR ───────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.filter-bar-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.5rem;
  white-space: nowrap;
}
.filter-sort {
  margin-left: auto;
  padding: 0.3rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-light);
  cursor: pointer;
}
.filter-sort:focus { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 0.45rem;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--forest-mid);
  box-shadow: 0 0 0 3px rgba(61,99,85,0.12);
}
.form-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.form-error {
  font-size: 0.78rem;
  color: #c0392b;
  margin-top: 0.35rem;
  display: none;
}
.form-error.visible { display: block; }

/* ── AUTH PAGE ────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.4s ease both;
}
.auth-logo {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.25rem;
}
.auth-logo span { color: var(--gold); }
.auth-tagline {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2rem;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 2rem;
}
.auth-tab {
  padding: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--muted);
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--ink);
  color: var(--paper);
}
.role-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.role-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--paper);
}
.role-option.selected {
  border-color: var(--forest);
  background: var(--forest-pale);
}
.role-icon { font-size: 1.75rem; margin-bottom: 0.4rem; }
.role-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.role-desc {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-light);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s;
}
.google-btn:hover {
  border-color: var(--gold);
  background: var(--gold-pale);
  color: var(--ink);
}
.google-btn svg { width: 18px; height: 18px; }

/* ── STORY PAGE ───────────────────────────────────────────── */
.story-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 3rem;
  padding: 3rem 0;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  position: relative;
  z-index: 1;
}
.story-main {}
.story-header { margin-bottom: 2.5rem; }
.story-prompt-ref {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
}
.story-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 1rem;
}
.story-byline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.story-byline-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.story-byline-info a { color: var(--forest); }
.story-byline-info a:hover { text-decoration: underline; }
.story-byline-dot { color: var(--border); }
.story-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink);
  margin-bottom: 2.5rem;
}
.story-content p { margin-bottom: 1.4em; }
.story-content p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 4.2em;
  font-weight: 700;
  float: left;
  line-height: 0.75;
  margin: 0.05em 0.1em 0 0;
  color: var(--gold);
}
.story-content blockquote {
  border-left: 3px solid var(--gold);
  padding: 0.75rem 0 0.75rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ink-light);
}
.story-action-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--paper-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 2.5rem;
}
.story-action-bar .spacer { flex: 1; }
.big-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.big-action-btn svg { width: 20px; height: 20px; }
.big-action-btn:hover { border-color: var(--gold); color: var(--gold); background: var(--gold-pale); }
.big-action-btn.active { border-color: currentColor; }
.big-action-btn.liked { color: #c0392b; border-color: #c0392b; background: #fef0ee; }
.big-action-btn.bookmarked { color: var(--forest); border-color: var(--forest); background: var(--forest-pale); }
.big-action-btn.starred { color: var(--gold); border-color: var(--gold); background: var(--gold-pale); }

/* ── STORY SIDEBAR ────────────────────────────────────────── */
.story-sidebar { display: flex; flex-direction: column; gap: 1.5rem; }
.sidebar-widget {
  background: var(--paper-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}
.sidebar-widget-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.author-widget-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  margin-bottom: 0.75rem;
}
.author-widget-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.author-widget-bio {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}
.author-widget-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.author-stat { text-align: center; }
.author-stat-n {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  display: block;
}
.author-stat-l {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ── COMMENTS ─────────────────────────────────────────────── */
.comments-section { margin-bottom: 3rem; }
.comments-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.comment {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--paper-mid);
}
.comment-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.comment-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.comment-author { color: var(--ink); font-weight: 500; }
.comment-text { font-size: 0.9rem; line-height: 1.6; color: var(--ink-light); }
.comment-form { margin-bottom: 2rem; }

/* ── PROFILE PAGE ─────────────────────────────────────────── */
.profile-header {
  background: var(--paper-dark);
  border-bottom: 1px solid var(--border);
  padding: 3rem 0 0;
}
.profile-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: flex-end;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  width: 120px; height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--paper);
  box-shadow: var(--shadow-md);
}
.profile-avatar-edit {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  border: 2px solid var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  transition: background 0.2s;
}
.profile-avatar-edit:hover { background: var(--forest); }
.profile-info { flex: 1; padding-bottom: 1.5rem; }
.profile-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--forest-pale);
  color: var(--forest);
  border: 1px solid var(--forest-mid);
  margin-bottom: 0.6rem;
}
.profile-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.profile-bio {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 500px;
  margin-bottom: 1rem;
}
.profile-stats {
  display: flex;
  gap: 2rem;
}
.profile-stat-n {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
}
.profile-stat-l {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.profile-actions { margin-top: auto; padding-bottom: 1.5rem; display: flex; gap: 0.75rem; }
.profile-tabs {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
}
.profile-tab {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.85rem 1.25rem;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.profile-tab.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}
.profile-body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

/* ── ACTIVITY HISTOGRAM ───────────────────────────────────── */
.histogram-wrap {
  background: var(--paper-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
}
.histogram-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}
.histogram-grid {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
  overflow-x: auto;
}
.histogram-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--paper-mid);
  min-width: 10px;
}
.histogram-cell[data-level="1"] { background: #c6e6c6; }
.histogram-cell[data-level="2"] { background: #7cc47c; }
.histogram-cell[data-level="3"] { background: #3d9b3d; }
.histogram-cell[data-level="4"] { background: var(--forest); }
.histogram-months {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  overflow-x: auto;
}

/* ── FEATURED STORIES ─────────────────────────────────────── */
.featured-section { margin-bottom: 2.5rem; }
.featured-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}
.featured-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── SUBMIT PAGE ──────────────────────────────────────────── */
.submit-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  position: relative;
  z-index: 1;
}
.submit-sidebar-card {
  background: var(--paper-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
}
.char-counter {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  text-align: right;
  margin-top: 0.3rem;
}
.char-counter.warn { color: var(--gold); }
.char-counter.danger { color: #c0392b; }
.tag-selector { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.prompt-select-grid { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.prompt-select-opt {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.prompt-select-opt.selected {
  border-color: var(--gold);
  background: var(--gold-pale);
}
.prompt-select-radio {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
  transition: all 0.2s;
  position: relative;
}
.prompt-select-opt.selected .prompt-select-radio {
  border-color: var(--gold);
  background: var(--gold);
}
.prompt-select-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--paper);
}
.prompt-select-text strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.2rem;
}
.prompt-select-text span { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.preview-area {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink);
  min-height: 300px;
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
}

/* ── TOAST ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease both;
  max-width: 320px;
}
.toast.success { background: var(--forest); }
.toast.error { background: #8b1a1a; }
.toast.warning { background: var(--gold); color: var(--ink); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,18,9,0.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease both;
}
.modal {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.3s ease both;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
}
.modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem;
}
.modal { position: relative; }

/* ── LOADING ──────────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem;
  gap: 1rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; line-height: 1.6; max-width: 320px; margin: 0 auto; }

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0;
}
.page-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-light);
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover, .page-btn.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ── FOOTER ───────────────────────────────────────────────── */
.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding: 3rem 0 2rem;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 2rem;
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.footer-logo span { color: var(--gold); }
.footer-desc { font-size: 0.82rem; color: rgba(248,244,236,0.55); line-height: 1.6; }
.footer-col-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(248,244,236,0.5);
  margin-bottom: 0.85rem;
}
.footer-links { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-link {
  font-size: 0.85rem;
  color: rgba(248,244,236,0.75);
  transition: color 0.15s;
}
.footer-link:hover { color: var(--gold); }
.footer-bottom {
  border-top: 1px solid rgba(248,244,236,0.1);
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(248,244,236,0.35);
  letter-spacing: 0.08em;
  display: flex;
  justify-content: space-between;
}

/* ── ANIMATIONS ───────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp  { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
.animate-fade-up {
  animation: fadeUp 0.5s ease both;
}
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .prompt-cards { grid-template-columns: 1fr; }
  .story-layout { grid-template-columns: 1fr; }
  .story-sidebar { order: -1; }
  .submit-layout { grid-template-columns: 1fr; }
  .profile-header-inner { flex-direction: column; align-items: flex-start; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .nav { grid-template-columns: auto 1fr auto; }
  .nav-logo { text-align: left; }
}
@media (max-width: 640px) {
  .nav { padding: 0 1rem; }
  .nav-left .nav-link { display: none; }
  .hero { padding: 3rem 0 2rem; }
  .feed-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .histogram-grid { grid-template-columns: repeat(26, 1fr); }
  .profile-tabs { overflow-x: auto; }
  .story-action-bar { flex-wrap: wrap; }
}

/* ── UTILITY ──────────────────────────────────────────────── */
.text-gold  { color: var(--gold); }
.text-muted { color: var(--muted); }
.text-forest{ color: var(--forest); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
