/* ──────────────────────────────────────────────────────────────────────────────
   PhiloMedia — base.css  (Redesign v2)
   Aesthetic direction: Dark editorial luxury — think Criterion Collection meets
   a premium streaming platform. Deep ink backgrounds, gold accents, refined
   serif typography, subtle grain texture, glass cards.
────────────────────────────────────────────────────────────────────────────── */

/* ─── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --ink:           #0d0e14;
  --ink-soft:      #13141c;
  --ink-muted:     #1c1e28;
  --ink-border:    #252733;
  --text-primary:  #e8e6df;
  --text-secondary:#9b99a1;
  --text-muted:    #5c5a64;

  /* Accent — antique gold */
  --gold:          #c9a84c;
  --gold-soft:     #e2c77a;
  --gold-dim:      rgba(201, 168, 76, 0.12);

  /* Semantic */
  --surface:       rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.06);
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:     0 8px 32px rgba(0,0,0,0.5);
  --shadow-lg:     0 20px 60px rgba(0,0,0,0.6);
  --glow-gold:     0 0 40px rgba(201,168,76,0.15);

  /* Typography */
  --font-display:  'Cormorant Garamond', Georgia, serif;
  --font-body:     'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     20px;

  /* Transitions */
  --ease-out:      cubic-bezier(0.16, 1, 0.3, 1);
  --transition:    0.25s var(--ease-out);
}

/* ─── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

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

body {
  background-color: var(--ink);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  /* Subtle grain texture overlay */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
}

/* ─── Typography Scale ──────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--gold-soft); }
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: rgba(201, 168, 76, 0.28);
  color: var(--text-primary);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.skip-link,
.sr-only {
  position: absolute;
}

.skip-link {
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.18);
  color: var(--text-primary);
  border: 1px solid rgba(201, 168, 76, 0.28);
  transition: top var(--transition);
}

.skip-link:focus {
  top: 0.8rem;
}

.sr-only {
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 14, 20, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  padding: 0 max(2.5rem, env(safe-area-inset-right)) 0 max(2.5rem, env(safe-area-inset-left));
  padding-top: env(safe-area-inset-top);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-primary) !important;
  letter-spacing: 0.05em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity var(--transition);
}
.logo::before {
  content: '◈';
  color: var(--gold);
  font-size: 1rem;
}
.logo:hover { opacity: 0.85; }

/* Header h1 when not a link (details page) */
header h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.header-context {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-context::before {
  content: '';
  width: 18px;
  height: 1px;
  background: rgba(201, 168, 76, 0.45);
}

nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.nav-auth-slot {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: 0.45rem;
  padding-left: 0.55rem;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-locale {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-right: 0.35rem;
  padding-right: 0.55rem;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-locale-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.nav-locale-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.nav-locale-btn.is-active {
  color: var(--gold-soft);
  border-color: rgba(201, 168, 76, 0.35);
  background: var(--gold-dim);
}

nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  text-decoration: none;
}

nav a::after {
  content: '';
  position: absolute;
  left: 0.8rem;
  right: 0.8rem;
  bottom: 0.3rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 168, 76, 0.95), transparent);
  opacity: 0;
  transform: scaleX(0.55);
  transition: opacity var(--transition), transform var(--transition);
}

nav a:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.nav-logout-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.4rem 0.85rem;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.nav-logout-button:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

nav a:hover::after {
  opacity: 0.55;
  transform: scaleX(1);
}

nav a[aria-current="page"] {
  color: var(--gold-soft);
  background: rgba(201, 168, 76, 0.09);
  box-shadow:
    inset 0 0 0 1px rgba(201, 168, 76, 0.22),
    inset 0 -1px 0 rgba(201, 168, 76, 0.2),
    0 0 0 1px transparent;
}

nav a[aria-current="page"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.nav-user-chip,
.nav-muted-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.3rem 0.68rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1;
}

.nav-user-chip {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-transform: none;
  text-decoration: none;
}

.nav-user-chip::after {
  display: none;
}

.nav-user-chip:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.09);
}

.nav-muted-chip {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ─── Main Layout ───────────────────────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 3rem max(2rem, env(safe-area-inset-right)) 3rem max(2rem, env(safe-area-inset-left));
}

/* ─── Quote Section (Home) ──────────────────────────────────────────────────── */
#quote-section {
  position: relative;
  background: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3.5rem 3rem;
  margin-bottom: 4rem;
  overflow: hidden;
  text-align: center;
  box-shadow: var(--shadow-md), var(--glow-gold);
}

#quote-section::before {
  content: '\201C';
  position: absolute;
  top: -0.5rem;
  left: 1.5rem;
  font-family: var(--font-display);
  font-size: 12rem;
  color: var(--gold-dim);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

#quote-container {
  position: relative;
  z-index: 1;
}

#quote-section h2 {
  font-size: 0.7rem;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.85rem;
}

#quote-section-lead {
  position: relative;
  z-index: 1;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 38rem;
  margin: 0 auto 1.5rem;
  text-wrap: pretty;
}

#quote-text {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 680px;
  margin: 0 auto 1.25rem;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

#quote-author {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ─── Section Title ─────────────────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
}

/* ─── Media Grid ────────────────────────────────────────────────────────────── */
.results-grid,
#highlights,
#search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
}

#highlights,
#search-results {
  margin-top: 1.5rem;
}

/* ─── Card ──────────────────────────────────────────────────────────────────── */
.media-card-shell {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
  position: relative;
}

a.result-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  width: 100%;
  border-radius: var(--radius-md);
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
}

a.result-card-link:hover .result-card {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.result-card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--ink-muted);
  overflow: hidden;
}

.result-card-poster .poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease-out);
}

a.result-card-link:hover .poster-img {
  transform: scale(1.04);
}

/* Gold shimmer overlay on hover */
.result-card-poster::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(201, 168, 76, 0.08) 100%
  );
  opacity: 0;
  transition: opacity var(--transition);
}
a.result-card-link:hover .result-card-poster::after {
  opacity: 1;
}

.result-card-poster .no-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.result-card-body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex-grow: 1;
}

.result-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}

.result-card .media-type {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.result-card .user-rating {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.result-card .date,
.result-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.result-card .overview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  right: 0.65rem;
  z-index: 3;
  pointer-events: none;
}

.result-card-actions.has-watched-action {
  grid-template-columns: 1fr auto 1fr;
}

.result-card-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  width: auto;
  height: auto;
  border: none;
  background: none;
  color: rgba(245, 243, 238, 0.82);
  border-radius: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.75),
    0 0 18px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  pointer-events: auto;
  transition:
    color var(--transition),
    opacity var(--transition),
    transform var(--transition);
}

.result-card-action span {
  display: inline-block;
  transform: translateY(-1px);
}

.result-card-action:hover {
  color: #ffffff;
  transform: scale(1.08);
}

.result-card-action-watchlist {
  justify-self: start;
}

.result-card-action-watched {
  justify-self: center;
  color: rgba(209, 236, 224, 0.72);
}

.result-card-action-favorite {
  justify-self: end;
}

.result-card-action.is-active {
  color: var(--gold-soft);
}

.result-card-action-watchlist.is-active {
  color: #f0dfb0;
}

.result-card-action-favorite.is-active {
  color: #ffd86f;
}

.result-card-action-watched.is-active {
  color: #86d8b2;
}

.result-card-action:disabled {
  cursor: wait;
  opacity: 0.78;
}

/* ─── Search Page ───────────────────────────────────────────────────────────── */
.search-section {
  display: grid;
  justify-items: center;
  text-align: center;
  max-width: 880px;
  margin: 0 auto 2.8rem;
}

#search-form {
  display: flex;
  gap: 0.75rem;
  max-width: 580px;
  width: 100%;
  margin: 0.65rem auto 0;
}

#search-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  background: var(--ink-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input::placeholder { color: var(--text-muted); }
#search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

#search-form button {
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  background: var(--gold);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}
#search-form button:hover {
  background: var(--gold-soft);
  transform: translateY(-1px);
}

.search-discovery {
  display: grid;
  gap: 1.25rem;
  max-width: 860px;
  width: 100%;
  margin: 1.4rem auto 0;
}

.search-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.search-provider-cluster {
  flex: 1 1 100%;
}

.filter-cluster {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
}

.filter-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  max-width: 100%;
}

.lens-chip-extras {
  display: contents;
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  border-radius: 999px;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  max-width: 100%;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition),
    transform var(--transition);
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: rgba(201, 168, 76, 0.3);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.filter-chip.is-active {
  color: var(--gold-soft);
  border-color: rgba(201, 168, 76, 0.32);
  background: rgba(201, 168, 76, 0.09);
  box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.12);
}

.filter-chip.lens-expand-chip {
  border-color: transparent;
  background: transparent;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
  flex: 0 0 auto;
}

.filter-chip.lens-expand-chip:hover {
  color: var(--gold-soft);
  border-color: rgba(201, 168, 76, 0.28);
  background: rgba(201, 168, 76, 0.06);
}

.lens-active-summary {
  margin: 0.15rem 0 0;
  max-width: 38rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.ghost-button {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  border-radius: 999px;
  min-height: 44px;
  padding: 0.65rem 1rem;
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition);
}

.ghost-button:hover {
  color: var(--text-primary);
  border-color: rgba(201, 168, 76, 0.28);
  background: rgba(255, 255, 255, 0.03);
}

.results-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin: 0 0 1rem;
}

.results-meta .section-title {
  margin-bottom: 0.3rem;
}

.results-meta .section-subtitle {
  margin-bottom: 0;
}

.results-meta-copy {
  min-width: 0;
}

.sort-control {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  margin-left: auto;
}

.sort-control span {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sort-control select {
  appearance: none;
  min-width: 170px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%),
    var(--ink-muted);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  padding: 0.72rem 2.2rem 0.72rem 0.95rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.sort-control select:focus {
  border-color: rgba(201, 168, 76, 0.36);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.search-section .section-subtitle {
  max-width: 680px;
  margin-bottom: 0.95rem;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Library Page ─────────────────────────────────────────────────────────── */
.library-shell {
  max-width: 1080px;
}

.library-hero {
  margin-bottom: 2rem;
}

.library-toolbar {
  display: grid;
  gap: 1.15rem;
  margin-bottom: 2.5rem;
  padding: 1.25rem 1.35rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.library-search-field {
  display: grid;
  gap: 0.55rem;
}

#library-search {
  width: 100%;
  background: var(--ink-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

#library-search::placeholder {
  color: var(--text-muted);
}

#library-search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.library-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.library-filter-group {
  justify-items: start;
}

.library-toolbar .filter-chip-row {
  justify-content: flex-start;
}

.library-section + .library-section {
  margin-top: 2rem;
}

.library-cta-button {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border-radius: 999px;
  min-height: 44px;
  padding: 0.7rem 1rem;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    color var(--transition);
}

.library-cta-button:hover,
.library-cta-button:hover {
  border-color: rgba(201, 168, 76, 0.28);
  background: rgba(201, 168, 76, 0.08);
  color: var(--gold-soft);
}

.library-cta-button {
  margin-top: 0.25rem;
  align-self: flex-start;
}

/* ─── Profile Page ─────────────────────────────────────────────────────────── */
.profile-shell {
  max-width: 1080px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.8rem 0 2rem;
}

.profile-avatar-column {
  display: grid;
  gap: 0.85rem;
  justify-items: center;
}

.profile-avatar {
  width: 108px;
  height: 108px;
  border-radius: 28px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(201, 168, 76, 0.2), transparent 58%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
}

.profile-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-avatar-fallback {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-primary);
}

.profile-avatar-tools {
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  width: min(180px, 100%);
}

.profile-avatar-tools .ghost-button {
  width: 100%;
}

.profile-avatar-feedback {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

.profile-avatar-feedback[data-tone="success"] {
  color: #8fd3b0;
}

.profile-avatar-feedback[data-tone="error"] {
  color: #f49ca6;
}

.profile-copy {
  min-width: 0;
}

.profile-eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.55rem;
}

.profile-summary {
  max-width: 62ch;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.25rem;
}

.profile-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold-soft);
  border: 1px solid rgba(201, 168, 76, 0.2);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.profile-action-link:hover {
  background: rgba(201, 168, 76, 0.18);
  border-color: rgba(201, 168, 76, 0.3);
}

.profile-action-link-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.profile-action-link-secondary:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(201, 168, 76, 0.22);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.profile-stat-card {
  padding: 1.2rem 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.profile-stat-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}

.profile-stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.55rem;
}

.profile-stat-caption {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.95fr);
  gap: 1.5rem;
}

.profile-panel {
  padding: 1.3rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.activity-list {
  display: grid;
  gap: 0.85rem;
}

.activity-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition), transform var(--transition);
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-1px);
}

.activity-poster-wrap {
  width: 60px;
}

.activity-poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.activity-poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-muted);
  color: var(--text-muted);
  font-size: 0.68rem;
  text-align: center;
}

.activity-copy {
  min-width: 0;
}

.activity-kicker {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.35rem;
}

.activity-copy h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-primary);
  margin: 0 0 0.15rem;
}

.activity-copy p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.activity-age {
  font-size: 0.76rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.profile-overview {
  display: grid;
  gap: 0.85rem;
}

.profile-overview-card {
  display: block;
  padding: 1rem 1.05rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.profile-overview-card:hover {
  border-color: rgba(201, 168, 76, 0.2);
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-1px);
}

.profile-overview-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.profile-overview-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.55rem;
}

.profile-overview-description {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.contribute-shell {
  max-width: 1040px;
}

.contribute-panel {
  padding: 1.45rem;
}

.contribution-form {
  display: grid;
  gap: 1.4rem;
}

.contribution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.contribution-field {
  display: grid;
  gap: 0.45rem;
}

.contribution-field-wide {
  grid-column: 1 / -1;
}

.contribution-field label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contribution-field input,
.contribution-field textarea {
  width: 100%;
  background: var(--ink-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: inherit;
  padding: 0.85rem 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.contribution-field textarea {
  resize: vertical;
  min-height: 120px;
}

.contribution-field input::placeholder,
.contribution-field textarea::placeholder {
  color: var(--text-muted);
}

.contribution-field input:focus,
.contribution-field textarea:focus {
  outline: none;
  border-color: rgba(201, 168, 76, 0.42);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
  background: rgba(255, 255, 255, 0.035);
}

.contribute-section-meta {
  margin-top: 0.4rem;
}

.contribution-mode-tabs {
  justify-content: flex-start;
  gap: 0.7rem;
}

.contribution-existing-panel {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.contribution-help-text {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.contribution-inline-feedback {
  min-height: 1.3rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.contribution-inline-feedback[data-tone="success"] {
  color: #8fd3b0;
}

.contribution-inline-feedback[data-tone="error"] {
  color: #f49ca6;
}

.contribution-profile-preview {
  display: grid;
  gap: 0.95rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201, 168, 76, 0.18);
  background: rgba(255, 255, 255, 0.025);
}

.contribution-profile-preview-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.contribution-profile-preview-identity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.95rem;
  align-items: center;
  min-width: 0;
}

.contribution-profile-sigil {
  flex-shrink: 0;
}

.contribution-profile-preview-eyebrow {
  margin-bottom: 0.35rem;
}

.contribution-profile-preview-identity h3 {
  font-size: 1.45rem;
  margin-bottom: 0.2rem;
}

.contribution-profile-preview-summary {
  color: var(--text-secondary);
  line-height: 1.7;
}

.contribution-profile-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contribution-preview-link {
  align-self: flex-start;
}

.quote-list {
  display: grid;
  gap: 1rem;
}

.quote-entry-card {
  padding: 1.05rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

.quote-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.quote-entry-header h3 {
  font-size: 1.25rem;
}

.quote-remove-button {
  min-width: 92px;
}

.contribution-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.9rem;
}

.contribution-feedback {
  min-height: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.contribution-feedback[data-tone="success"] {
  color: #8fd3b0;
}

.contribution-feedback[data-tone="error"] {
  color: #f49ca6;
}

.contribution-feedback-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.philosophers-shell,
.philosopher-detail-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.philosophers-hero,
.philosophers-section {
  margin-bottom: 2rem;
}

.philosopher-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
}

.philosopher-card-link {
  display: flex;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.philosopher-card {
  width: 100%;
  min-height: 100%;
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.philosopher-card-link:hover .philosopher-card {
  transform: translateY(-4px);
  border-color: rgba(201, 168, 76, 0.2);
  box-shadow: var(--shadow-md);
}

.philosopher-card-top {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 1rem;
}

.philosopher-card-headline {
  min-width: 0;
}

.philosopher-card-headline h3 {
  font-size: 1.45rem;
  margin-bottom: 0.1rem;
}

.philosopher-card-period {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.philosopher-card-summary,
.philosopher-focus {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.75;
}

.philosopher-focus {
  max-width: 65ch;
  margin-top: 0.85rem;
}

.philosopher-card .philosopher-chip-row {
  margin-top: 1rem;
}

.philosopher-card-quote {
  margin-top: 1rem;
  padding: 1rem 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.philosopher-card-quote p {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.55;
}

.philosopher-card-quote.is-empty p,
.philosopher-card-quote-empty {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-style: normal;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.philosopher-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.philosopher-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem 1.25rem;
  margin-top: 2.25rem;
  padding-top: 0.35rem;
}

.philosopher-pagination[hidden] {
  display: none;
}

.philosopher-pagination-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

body.philosopher-detail-page .philosopher-detail-shell {
  width: min(1080px, 100%);
}

.philosopher-hero {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 2.25rem 2.5rem;
  align-items: start;
  margin-bottom: 3rem;
}

.philosopher-identity {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  padding-top: 0.15rem;
}

.philosopher-name {
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4vw, 3.15rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0;
}

.philosopher-period {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0;
}

.philosopher-hero .profile-summary {
  max-width: 62ch;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0.15rem 0 0;
}

.philosopher-sigil {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 18%, rgba(201, 168, 76, 0.22), transparent 58%),
    linear-gradient(180deg, #1a1c26 0%, #12131a 100%);
  border: 1px solid rgba(201, 168, 76, 0.2);
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

body.philosopher-detail-page .philosopher-sigil {
  width: 176px;
  height: 220px;
  border-radius: 14px;
  font-size: 2.35rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.philosopher-sigil-small {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  font-size: 1.15rem;
  box-shadow: none;
}

.philosopher-sigil-photo {
  padding: 0;
  overflow: hidden;
  background: #12131a;
}

.philosopher-sigil-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.philosopher-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.philosopher-chip-row-links {
  margin-top: 0.25rem;
}

.philosopher-chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.philosopher-lens-link {
  color: var(--gold-soft);
  border-color: rgba(201, 168, 76, 0.18);
  background: rgba(201, 168, 76, 0.08);
}

.philosopher-lens-link:hover,
.philosopher-lens-link:focus-visible {
  border-color: rgba(201, 168, 76, 0.28);
  background: rgba(201, 168, 76, 0.14);
}

.philosopher-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem 1.5rem;
  margin: 0.55rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.philosopher-meta-item {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
}

.philosopher-meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.philosopher-meta-value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--text-primary);
}

.philosopher-meta-caption {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 28ch;
}

.philosopher-quotes-block,
.philosopher-works-block {
  margin-top: 2.75rem;
}

.philosopher-quotes-block .section-title,
.philosopher-works-block .section-title {
  margin-bottom: 0.35rem;
}

.philosopher-quotes-block .section-subtitle,
.philosopher-works-block .section-subtitle {
  max-width: 68ch;
  margin-bottom: 1.35rem;
}

.philosopher-quote-grid {
  display: grid;
  gap: 0;
}

.philosopher-quote-card {
  padding: 1.55rem 0 1.65rem;
  border-top: 1px solid var(--border);
  background: transparent;
}

.philosopher-quote-card:last-child {
  border-bottom: 1px solid var(--border);
}

.philosopher-quote-text {
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 2.2vw, 1.7rem);
  line-height: 1.45;
  color: var(--text-primary);
  margin: 0 0 0.95rem;
  max-width: 40rem;
}

.philosopher-stat-theme {
  font-size: 1.35rem;
}

.philosopher-empty-state {
  background: rgba(201, 168, 76, 0.05);
  border: 1px solid rgba(201, 168, 76, 0.16);
  border-radius: 14px;
  padding: 1.75rem 1.5rem;
  margin: 0.35rem 0 0;
}

.philosopher-empty-state .empty-state-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--text-primary);
}

.philosopher-empty-state .empty-state-text {
  color: var(--text-secondary);
  max-width: 52ch;
}

.philosopher-page-loading {
  margin-bottom: 2rem;
}

.philosopher-works-block .loading-message {
  color: var(--text-secondary);
  margin-top: 0.85rem;
}

#quote-author a,
.ai-quote-author a {
  color: var(--gold-soft);
  text-decoration: none;
}

#quote-author a:hover,
.ai-quote-author a:hover {
  color: var(--gold);
}

/* ─── Details Page ──────────────────────────────────────────────────────────── */
body.details-page main {
  max-width: 1080px;
}

#details-container {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-areas:
    "poster info"
    "tools info";
  column-gap: 3rem;
  row-gap: 0.85rem;
  align-items: start;
  padding: 1rem 0 2.5rem;
}

.details-poster {
  grid-area: poster;
  width: 240px;
}

.details-poster-tools {
  grid-area: tools;
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.details-poster img {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: block;
}

.details-info {
  grid-area: info;
  min-width: 0;
  padding-top: 0.5rem;
}

#details-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 0.6rem;
}

#details-meta {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.25rem;
}

#details-overview {
  font-size: 0.975rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 60ch;
}

/* ─── Philosophy Quote Block ────────────────────────────────────────────────── */
#philosophy-quote {
  position: relative;
  background: var(--ink-muted);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 2.25rem 2.5rem;
  margin-top: 0;
  overflow: hidden;
}

#philosophy-quote::before {
  content: '\201C';
  position: absolute;
  top: -1.5rem;
  right: 1.5rem;
  font-family: var(--font-display);
  font-size: 8rem;
  color: rgba(201, 168, 76, 0.07);
  line-height: 1;
  pointer-events: none;
}

#philosophy-quote h2 {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

#quote-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.75;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

#quote-author {
  font-size: 0.825rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ─── Loading State ─────────────────────────────────────────────────────────── */
#loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Loading Skeleton */
.loading-skeleton {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  width: 100%;
}
.skeleton-card {
  aspect-ratio: 2/3;
  background: linear-gradient(110deg, var(--ink-muted) 30%, var(--ink-border) 50%, var(--ink-muted) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── Error & Empty States ──────────────────────────────────────────────────── */
#details-error,
.error-state,
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 2rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
}

#details-error h2,
.error-state-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: #f87171;
}

#details-error p,
.error-state-text,
.empty-state-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.empty-state.philosopher-empty-state {
  background: rgba(201, 168, 76, 0.05);
  border: 1px solid rgba(201, 168, 76, 0.16);
  color: var(--text-primary);
}

.btn-back {
  display: inline-block;
  align-self: flex-start;
  margin-top: 0.25rem;
  padding: 0.5rem 1.25rem;
  background: var(--gold);
  color: var(--ink);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background var(--transition);
}
.btn-back:hover { background: var(--gold-soft); }

.inline-message,
.loading-message {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem;
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem max(2.5rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(2.5rem, env(safe-area-inset-left));
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.tmdb-attribution {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 0.9rem;
  margin: 0.85rem 0 0;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  line-height: 1.45;
  color: var(--text-secondary);
}

.tmdb-attribution-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.tmdb-attribution-logo img {
  display: block;
  height: 14px;
  width: auto;
  opacity: 0.9;
}

.trending-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.trending-section[hidden] {
  display: none;
}

/* Catalog shelf — several posters per row, never a full-bleed mural */
.shelf-grid,
#trending-results {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.shelf-grid .result-card-action {
  font-size: 1.05rem;
}

.shelf-grid .result-card-actions {
  top: 0.45rem;
  left: 0.45rem;
  right: 0.45rem;
}

.shelf-grid .result-card-body {
  padding: 0.7rem 0.7rem 0.8rem;
}

.shelf-grid .result-card h3 {
  font-size: 0.88rem;
}

.shelf-grid .result-card .overview {
  display: none;
}

/* ─── Highlights Section ────────────────────────────────────────────────────── */
#highlights-section {
  margin-top: 1rem;
}

.highlights-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.75rem;
}

.highlights-pagination[hidden] {
  display: none;
}

.highlights-count {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 920px) {
  .shelf-grid,
  #trending-results {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  header {
    padding-left: max(1.25rem, env(safe-area-inset-left));
    padding-right: max(1.25rem, env(safe-area-inset-right));
    min-height: 56px;
    height: auto;
    padding-top: max(0.65rem, env(safe-area-inset-top));
    padding-bottom: 0.65rem;
    align-items: flex-start;
    flex-wrap: wrap;
    row-gap: 0.55rem;
  }
  .header-brand {
    flex: 1 1 auto;
    max-width: 100%;
  }
  .logo { font-size: 1.3rem; }
  .header-context { display: none; }
  nav {
    width: 100%;
    flex: 1 1 100%;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
    gap: 0.2rem;
  }
  nav a,
  .nav-locale-btn,
  .nav-logout-button {
    min-height: 44px;
    min-width: 44px;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .nav-auth-slot {
    gap: 0.2rem;
    flex-shrink: 0;
    margin-left: 0.2rem;
    padding-left: 0.35rem;
  }
  .nav-user-chip { display: none; }

  main {
    padding: 1.75rem max(1.25rem, env(safe-area-inset-right)) 2rem max(1.25rem, env(safe-area-inset-left));
  }

  footer {
    padding: 1.25rem max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
    font-size: 0.75rem;
    line-height: 1.5;
  }

  .section-title { font-size: 1.45rem; }
  .section-subtitle {
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
  }

  #quote-section {
    padding: 2rem 1.25rem;
    margin-bottom: 2.5rem;
  }
  #quote-section h2 {
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    margin-bottom: 0.7rem;
  }
  #quote-section-lead {
    font-size: 0.88rem;
    margin-bottom: 1.15rem;
    padding-inline: 0.25rem;
  }
  #quote-text {
    font-size: 1.25rem;
    line-height: 1.55;
    margin-bottom: 1rem;
  }
  #quote-author {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    overflow-wrap: anywhere;
  }
  #quote-section::before {
    font-size: 5.5rem;
    top: 0.15rem;
    left: 0.65rem;
    opacity: 0.85;
  }

  .highlights-pagination {
    width: 100%;
    padding-inline: 0.15rem;
  }
  .highlights-pagination .ghost-button {
    width: 100%;
    max-width: 100%;
    text-align: center;
    white-space: normal;
    line-height: 1.35;
    min-height: 44px;
  }
  .highlights-count {
    text-align: center;
    padding-inline: 0.25rem;
  }

  .loading-skeleton {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
  }

  #details-container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "poster"
      "info"
      "tools";
    justify-items: stretch;
    gap: 1.75rem;
  }
  .details-poster {
    width: 60%;
    max-width: 200px;
    margin: 0 auto;
    justify-self: center;
  }
  .details-poster-tools {
    width: 100%;
    max-width: 100%;
  }
  #details-title { font-size: 1.75rem; }

  #search-form { flex-direction: column; }
  #search-form button { width: 100%; }
  .lens-active-summary {
    font-size: 0.98rem;
    padding-inline: 0.35rem;
  }
  .results-meta { align-items: stretch; }
  .sort-control { width: 100%; margin-left: 0; }
  .sort-control select { width: 100%; }
  .library-toolbar { padding: 1rem; }
  .library-toolbar-row { align-items: stretch; }
  .library-filter-group { width: 100%; }
  .library-toolbar .filter-chip-row { justify-content: flex-start; }
  .profile-hero { flex-direction: column; align-items: flex-start; padding-top: 1rem; }
  .profile-avatar-column { justify-items: flex-start; }
  .profile-avatar-tools { width: min(220px, 100%); }
  .profile-avatar { width: 88px; height: 88px; border-radius: 24px; }
  .profile-grid { grid-template-columns: 1fr; }
  .contribution-grid { grid-template-columns: 1fr; }
  .contribution-mode-tabs { justify-content: flex-start; }
  .contribution-profile-preview-top { flex-direction: column; }
  .contribution-profile-preview-identity { grid-template-columns: 1fr; }
  .contribution-preview-link { width: 100%; }
  .contribution-actions { align-items: stretch; }
  .contribution-actions .ghost-button,
  .contribution-actions .profile-action-link { width: 100%; }
  body.philosopher-detail-page .philosopher-hero {
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 1.25rem 1.35rem;
    margin-bottom: 2.25rem;
  }
  body.philosopher-detail-page .philosopher-sigil {
    width: 128px;
    height: 160px;
    border-radius: 12px;
    font-size: 1.7rem;
  }
  .philosopher-meta {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .philosopher-quote-text {
    font-size: 1.28rem;
  }
  .philosopher-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
  }
  .philosopher-pagination {
    margin-top: 2rem;
    padding-top: 0.5rem;
    gap: 0.75rem 1rem;
  }
  .philosopher-pagination .ghost-button {
    min-height: 44px;
    padding-inline: 1.1rem;
  }
  .activity-item { grid-template-columns: 54px minmax(0, 1fr); }
  .activity-age { grid-column: 2; justify-self: start; }

  #highlights,
  #search-results,
  .results-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }

  .shelf-grid,
  #trending-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
  }
}

@media (max-width: 480px) {
  main {
    padding-top: 1.35rem;
    padding-bottom: 1.75rem;
  }

  .section-title { font-size: 1.3rem; }

  #quote-section {
    padding: 1.65rem 1rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-md);
  }
  #quote-section h2 {
    font-size: 0.58rem;
    letter-spacing: 0.12em;
  }
  #quote-text { font-size: 1.1rem; }
  #quote-section::before {
    font-size: 4.25rem;
    left: 0.35rem;
    top: 0.35rem;
  }

  body.philosopher-detail-page .philosopher-hero {
    grid-template-columns: 1fr;
    gap: 1.15rem;
  }

  body.philosopher-detail-page .philosopher-sigil {
    width: 120px;
    height: 150px;
    border-radius: 12px;
    font-size: 1.6rem;
  }

  .philosopher-name {
    font-size: 2rem;
  }

  #highlights,
  #search-results,
  .results-grid,
  .loading-skeleton,
  .shelf-grid,
  #trending-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  .result-card-body { padding: 0.7rem; }
  .result-card h3 { font-size: 0.88rem; }
  .result-card .overview {
    font-size: 0.74rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .philosopher-pagination {
    margin-top: 1.75rem;
    padding-bottom: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Lens discovery — load more */
.lens-pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem 0;
}

.lens-pagination-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}
