/* ─────────────────────────────────────────────────────────────
   Stoicism 100 — Design System
   Deep ink, warm gold, parchment light · classical modern
───────────────────────────────────────────────────────────── */

:root {
  --ink: #0c0f14;
  --ink-elevated: #141922;
  --ink-soft: #1c2430;
  --ink-border: rgba(212, 175, 106, 0.14);
  --gold: #d4af6a;
  --gold-bright: #e8c98a;
  --gold-dim: rgba(212, 175, 106, 0.55);
  --cream: #f3ebe0;
  --cream-muted: #c4b8a8;
  --cream-faint: rgba(243, 235, 224, 0.55);
  --accent-blue: #6b8cae;
  --danger-soft: #c4786a;

  --font-display: "Cormorant Garamond", "Times New Roman", serif;
  --font-body: "Outfit", system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 60px rgba(212, 175, 106, 0.08);

  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  color: var(--cream);
  background: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Ambient background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(212, 175, 106, 0.09), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(107, 140, 174, 0.07), transparent 45%),
    radial-gradient(ellipse 50% 50% at 50% 100%, rgba(212, 175, 106, 0.05), transparent 50%),
    var(--ink);
}

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

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

a:hover {
  color: var(--gold-bright);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ── Header ─────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--ink-border);
  background: rgba(12, 15, 20, 0.78);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.header-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  gap: 0.1rem;
}

.logo-mark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cream);
}

.logo-mark span {
  color: var(--gold);
}

.logo-sub {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-dim);
  font-weight: 500;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav a {
  color: var(--cream-muted);
  font-size: 0.875rem;
  font-weight: 450;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  transition: color 0.2s, background 0.2s;
}

.nav a:hover {
  color: var(--cream);
  background: rgba(243, 235, 224, 0.06);
}

.lang-switch {
  display: flex;
  align-items: center;
  background: var(--ink-soft);
  border: 1px solid var(--ink-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.lang-btn {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  color: var(--cream-muted);
  transition: all 0.25s var(--ease);
}

.lang-btn:hover {
  color: var(--cream);
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--gold), #b8924a);
  color: var(--ink);
  box-shadow: 0 2px 12px rgba(212, 175, 106, 0.35);
}

/* ── Hero ───────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding: clamp(3.5rem, 10vw, 7rem) 1.5rem clamp(3rem, 6vw, 5rem);
  max-width: var(--max);
  margin: 0 auto;
  text-align: center;
}

.hero-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  color: var(--gold-dim);
}

.hero-ornament svg {
  width: 28px;
  height: 28px;
  opacity: 0.85;
}

.hero-ornament .line {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.hero-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.4rem, 6.5vw, 4.25rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--cream);
  max-width: 16ch;
  margin: 0 auto 1.5rem;
}

.hero h1 em {
  font-style: italic;
  color: var(--gold-bright);
  font-weight: 400;
}

.hero-lead {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--cream-muted);
  max-width: 38rem;
  margin: 0 auto 2.25rem;
  line-height: 1.75;
  font-weight: 350;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold) 50%, #b8924a);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 28px rgba(212, 175, 106, 0.28);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}

.hero-cta:hover {
  color: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(212, 175, 106, 0.4);
}

.hero-cta svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease);
}

.hero-cta:hover svg {
  transform: translateY(2px);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ink-border);
}

.stat {
  text-align: center;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

/* ── Toolbar ────────────────────────────────────────────────── */

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

.section-header {
  margin-bottom: 1.75rem;
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 500;
  color: var(--cream);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2rem;
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  padding: 1rem 0 1.1rem;
  background: linear-gradient(
    180deg,
    rgba(12, 15, 20, 0.96) 0%,
    rgba(12, 15, 20, 0.92) 70%,
    transparent 100%
  );
  backdrop-filter: blur(8px);
}

.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--cream-muted);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 2.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-border);
  background: var(--ink-elevated);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#search::placeholder {
  color: var(--cream-muted);
  opacity: 0.7;
}

#search:focus {
  border-color: rgba(212, 175, 106, 0.4);
  box-shadow: 0 0 0 3px rgba(212, 175, 106, 0.1);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.filter-btn {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--ink-border);
  background: var(--ink-elevated);
  color: var(--cream-muted);
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--cream);
  border-color: rgba(212, 175, 106, 0.3);
}

.filter-btn.active {
  background: rgba(212, 175, 106, 0.15);
  border-color: rgba(212, 175, 106, 0.45);
  color: var(--gold-bright);
}

.count-line {
  font-size: 0.8rem;
  color: var(--cream-muted);
}

.count-line strong {
  color: var(--gold);
  font-weight: 600;
}

/* ── Cards grid ─────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.15rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.45rem 1.35rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(
    155deg,
    rgba(28, 36, 48, 0.9) 0%,
    rgba(20, 25, 34, 0.95) 100%
  );
  border: 1px solid var(--ink-border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: left;
  transition: transform 0.35s var(--ease), border-color 0.3s, box-shadow 0.35s;
  overflow: hidden;
  min-height: 220px;
  animation: cardIn 0.55s var(--ease) both;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 106, 0.35), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(212, 175, 106, 0.32);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.card:hover::before {
  opacity: 1;
}

.card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-num {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
  opacity: 0.9;
}

.card-num::before {
  content: "";
  /* number only */
}

.card-cat {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-blue);
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(107, 140, 174, 0.12);
  border: 1px solid rgba(107, 140, 174, 0.2);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 550;
  line-height: 1.3;
  color: var(--cream);
  margin-bottom: 0.75rem;
  flex: 0 0 auto;
}

.card-body {
  font-size: 0.9rem;
  color: var(--cream-faint);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer {
  margin-top: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gold-dim);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.card-footer svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}

.card:hover .card-footer svg {
  transform: translateX(3px);
  opacity: 1;
  color: var(--gold);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--cream-muted);
  font-size: 1.05rem;
}

/* ── Modal ──────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: min(560px, 100%);
  max-height: min(85vh, 720px);
  overflow-y: auto;
  background: linear-gradient(165deg, #1a212c 0%, #12171f 100%);
  border: 1px solid rgba(212, 175, 106, 0.22);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  padding: 2rem 1.75rem 1.75rem;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.35s var(--ease);
  position: relative;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream-muted);
  background: rgba(243, 235, 224, 0.05);
  border: 1px solid var(--ink-border);
  transition: color 0.2s, background 0.2s;
}

.modal-close:hover {
  color: var(--cream);
  background: rgba(243, 235, 224, 0.1);
}

.modal-num {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.modal-cat {
  display: inline-block;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-blue);
  margin-bottom: 1rem;
  font-weight: 500;
}

.modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 550;
  line-height: 1.25;
  color: var(--cream);
  margin-bottom: 1.25rem;
  padding-right: 2rem;
}

.modal-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--cream-muted);
  font-weight: 350;
}

.modal-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ink-border);
}

.modal-nav button {
  flex: 1;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-border);
  background: var(--ink-elevated);
  color: var(--cream-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.modal-nav button:hover:not(:disabled) {
  color: var(--gold-bright);
  border-color: rgba(212, 175, 106, 0.35);
}

.modal-nav button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── About ──────────────────────────────────────────────────── */

.about {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.5rem 5rem;
}

.about-card {
  position: relative;
  padding: clamp(2rem, 5vw, 3rem);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    145deg,
    rgba(28, 36, 48, 0.65),
    rgba(20, 25, 34, 0.9)
  );
  border: 1px solid var(--ink-border);
  overflow: hidden;
}

.about-card::after {
  content: "Σ";
  position: absolute;
  right: -0.1rem;
  bottom: -1.5rem;
  font-family: var(--font-display);
  font-size: 12rem;
  line-height: 1;
  color: rgba(212, 175, 106, 0.04);
  pointer-events: none;
  user-select: none;
}

.about-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 500;
  margin-bottom: 1.25rem;
  color: var(--cream);
}

.about-card p {
  color: var(--cream-muted);
  max-width: 52rem;
  margin-bottom: 1rem;
  font-size: 1.02rem;
  line-height: 1.8;
  font-weight: 350;
}

.about-card .note {
  font-size: 0.9rem;
  color: var(--gold-dim);
  font-style: italic;
  border-left: 2px solid rgba(212, 175, 106, 0.35);
  padding-left: 1rem;
  margin-top: 1.5rem;
}

/* ── Footer ─────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--ink-border);
  padding: 2rem 1.5rem 2.5rem;
  text-align: center;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--cream-muted);
  letter-spacing: 0.04em;
}

.site-footer .sigma {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold-dim);
  margin-bottom: 0.5rem;
  display: block;
}

/* ── Animations ─────────────────────────────────────────────── */

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger via JS inline delay */

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 640px) {
  .nav a {
    display: none;
  }

  .hero-stats {
    gap: 1.25rem;
  }

  .stat-num {
    font-size: 1.6rem;
  }

  .card {
    min-height: 200px;
  }

  .modal {
    padding: 1.5rem 1.25rem 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Selection */
::selection {
  background: rgba(212, 175, 106, 0.3);
  color: var(--cream);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--ink);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-soft);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2a3444;
}
