:root {
  --bg: #0a0e27;
  --ink: #f4efe4;
  --muted: rgba(244, 239, 228, 0.62);
  --line: rgba(255, 140, 0, 0.22);
  --card: rgba(255, 255, 255, 0.04);
  --mood: #ff8c00;
  --mood-soft: rgba(255, 140, 0, 0.12);
  --serif: "Source Serif 4", "Times New Roman", serif;
  --sans: Inter, sans-serif;
  --mono: "JetBrains Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

body {
  background-image:
    radial-gradient(circle at 12% 0%, var(--mood-soft), transparent 42%),
    radial-gradient(circle at 88% 100%, rgba(102, 126, 234, 0.12), transparent 46%);
  transition: background-image 0.35s ease;
}

body[data-mood="joyful"] {
  --mood: #e8b84a;
  --mood-soft: rgba(232, 184, 74, 0.16);
}

body[data-mood="sad"] {
  --mood: #8aa0c4;
  --mood-soft: rgba(138, 160, 196, 0.16);
}

body[data-mood="ironic"] {
  --mood: #c9d36a;
  --mood-soft: rgba(201, 211, 106, 0.14);
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
}

.skip:focus {
  left: 8px;
  z-index: 1100;
  background: var(--mood);
  color: #0a0e27;
  padding: 8px 12px;
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(10, 14, 39, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover,
.nav a:focus-visible { color: var(--mood); }

.masthead {
  max-width: 1180px;
  margin: 0 auto;
  padding: 92px 20px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 28px 48px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.mood-label,
.card-kicker,
.sheet-kicker,
.sheet-meta,
.badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 10px 0 12px;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 650;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  line-height: 1.55;
}

.mood-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(10px);
}

.mood-switch button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 500 0.92rem var(--sans);
  cursor: pointer;
}

.mood-switch button[aria-checked="true"] {
  background: var(--mood);
  color: #14110b;
}

.mood-switch button:focus-visible {
  outline: 2px solid var(--mood);
  outline-offset: 2px;
}

.grid {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 72px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(10px);
  color: inherit;
  font: inherit;
  appearance: none;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--mood);
}

.card.lead {
  grid-column: span 2;
  min-height: 320px;
  justify-content: flex-end;
}

body[data-mood="ironic"] .card:nth-child(odd) { transform: rotate(-0.35deg); }
body[data-mood="ironic"] .card:nth-child(even) { transform: rotate(0.35deg); }
body[data-mood="ironic"] .card:hover,
body[data-mood="ironic"] .card:focus-visible { transform: translateY(-4px) rotate(0deg); }

.card h2 {
  margin: 12px 0 10px;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 650;
  line-height: 1.15;
}

.card.lead h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); }

.excerpt {
  margin: 0 0 auto;
  color: var(--muted);
  line-height: 1.5;
  line-clamp: 4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--mood);
  font-size: 0.85rem;
}

.sheet {
  width: min(1080px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  border: 1px solid var(--line);
  background: #10162f;
  color: var(--ink);
}

.sheet::backdrop { background: rgba(6, 8, 18, 0.72); }

.sheet-bar,
.sheet-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.sheet-foot { border-bottom: 0; border-top: 1px solid var(--line); }

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.6rem;
  cursor: pointer;
}

.sheet-title {
  margin: 0;
  padding: 8px 20px 0;
  font-family: var(--serif);
  font-size: 1.7rem;
  line-height: 1.15;
}

.sheet-meta,
.facts { padding: 8px 20px 0; }

.facts { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; }

.chip {
  padding: 4px 8px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--mood);
}

.proof {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.proof article {
  padding: 18px 20px 24px;
}

.proof article:first-child {
  border-right: 1px dashed rgba(244, 239, 228, 0.18);
}

.proof h3 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mood);
}

.proof h4 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.25;
}

.proof p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  color: rgba(244, 239, 228, 0.88);
}

.badge {
  padding: 4px 8px;
  border: 1px solid var(--mood);
  color: var(--mood);
}

.badge.bad {
  border-color: #e07a5f;
  color: #e07a5f;
}

.sheet-foot a {
  color: var(--mood);
  font-weight: 500;
}

@media (max-width: 900px) {
  .masthead,
  .grid,
  .proof { grid-template-columns: 1fr; }
  .card.lead { grid-column: auto; min-height: 240px; }
  .proof article:first-child { border-right: 0; border-bottom: 1px dashed rgba(244, 239, 228, 0.18); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    transform: none !important;
  }
}
