/* ─────────────────────────────────────────────────────────────
   Zero Feed — Style Sheet
   Swiss Modernist / Typographic Poster aesthetic
   ───────────────────────────────────────────────────────────── */

/* ── Custom Properties ── */
:root {
  --font: 'Space Grotesk', system-ui, sans-serif;

  /* Light mode */
  --bg: #FAFAFA;
  --text: #111111;
  --text-muted: #888888;
  --text-faint: #BBBBBB;
  --border: #E0E0E0;
  --accent: #D94F00;
  --impact-color: #D94F00; /* overridden per-day by JS */

  /* Type scale */
  --size-date: clamp(0.8rem, 1.5vw, 0.95rem);
  --size-label: clamp(0.7rem, 1.2vw, 0.8rem);
  --size-body: clamp(1rem, 1.8vw, 1.15rem);
  --size-impact-prefix: clamp(1.1rem, 2.5vw, 1.5rem);
  --size-impact: clamp(3.5rem, 10vw, 7.5rem);
  --size-section-heading: clamp(1.4rem, 3vw, 2rem);

  /* Spacing */
  --col-max: 680px;
  --col-pad: clamp(1.25rem, 5vw, 3rem);
  --section-pad-top: clamp(4rem, 8vh, 7rem);
  --section-pad-bottom: clamp(3rem, 6vh, 5rem);

  /* Depth indicator */
  --bar-gap: 5px;

  /* Transitions */
  --transition-snap: 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --text: #EAEAEA;
    --text-muted: #777777;
    --text-faint: #444444;
    --border: #2A2A2A;
    --accent: #FF6520;
  --impact-color: #FF6520; /* overridden per-day by JS */
  }
}

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

/* Enforce the HTML hidden attribute even when elements have an explicit display value set */
[hidden] { display: none !important; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow: hidden; /* snap container handles scroll */
}

/* ── Screen reader only ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Snap Container ── */
.snap-container {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;

  /* Hide scrollbar but keep functionality */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.snap-container::-webkit-scrollbar {
  display: none;
}

/* ── Snap Sections ── */
.snap-section {
  min-height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.35s ease;
}

.snap-section.is-visible {
  opacity: 1;
}

/* Long section: snaps at top, content can overflow downward */
.snap-section--long {
  align-items: flex-start;
  min-height: 100dvh;
  height: auto;
  scroll-snap-align: start;
}

.section-inner {
  width: 100%;
  max-width: calc(var(--col-max) + (var(--col-pad) * 2));
  padding: 0 var(--col-pad);
  margin: 0 auto;
}

.section-inner--long {
  padding-top: var(--section-pad-top);
  padding-bottom: 6rem; /* room for depth indicator */
}

/* ── Content Column ── */
.content {
  width: 100%;
}

.content--short {
  padding: var(--section-pad-top) 0 var(--section-pad-bottom);
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vh, 2.5rem);
  min-height: 100dvh;
  justify-content: center;
}

.content--medium {
  padding: var(--section-pad-top) 0 var(--section-pad-bottom);
}

.content--long {
  /* no extra padding — section-inner handles it */
}

/* ── Section Label ── */
.section-label {
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: clamp(1.5rem, 4vh, 2.5rem);
}

/* ── Day Header / Date ── */
.day-header {
  display: flex;
  align-items: baseline;
}

.date-trigger {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font);
  font-size: var(--size-date);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.15s ease;
  text-align: left;
}

.date-trigger:hover,
.date-trigger:focus-visible {
  color: var(--impact-color);
  outline: none;
}

.date-trigger:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Impact Block ── */
.impact-block {
  display: flex;
  flex-direction: column;
  gap: 0.1em;
}

.impact-label {
  font-size: var(--size-impact-prefix);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.impact-headline {
  font-size: var(--size-impact);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--text);
}

.impact-level {
  color: var(--impact-color);
  display: inline-block;
  transition: color 0.4s ease;
}

/* Impact level–specific sizing */
.impact-level[data-level="HUGE"] {
  font-size: 0.82em;
}

.impact-suffix {
  display: block;
  font-size: 0.55em;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-top: 0.15em;
}

/* ── Short Summary ── */
.short-summary {
  max-width: 560px;
}

.short-summary p {
  font-size: var(--size-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text);
}

/* ── Scroll Hint ── */
.scroll-hint {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  opacity: 0.3;
}

.scroll-hint-line {
  display: block;
  width: 24px;
  height: 1px;
  background: var(--text);
}

/* ── Medium Summary ── */
.medium-summary {
  display: flex;
  flex-direction: column;
  gap: 1.4em;
}

.medium-summary p {
  font-size: var(--size-body);
  font-weight: 400;
  line-height: 1.7;
  color: var(--text);
}

/* ── Long Summary ── */
.long-summary {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  margin-bottom: 3rem;
}

.long-section {
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.long-section:last-child {
  border-bottom: none;
}

.long-section-headline {
  font-size: var(--size-section-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

.long-section-body {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
}

.long-section-body p {
  font-size: var(--size-body);
  font-weight: 400;
  line-height: 1.7;
  color: var(--text);
}

.source-tag {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Sources Footer ── */
.sources-footer {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  margin-bottom: 1rem;
}

.sources-label {
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.sources-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
}

.sources-list li {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.sources-list li span {
  color: var(--text-faint);
  font-weight: 300;
}

/* ── Depth Indicator ── */
.depth-indicator {
  position: fixed;
  left: var(--col-pad);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column; /* shortest on top, longest on bottom */
  align-items: flex-start;
  gap: var(--bar-gap);
  z-index: 100;
}

.depth-bar {
  position: relative;
  display: block;
  width: 3px;
  background: var(--text-faint);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
  transition: background 0.25s ease;
}

/* Generous tap/click target */
.depth-bar::before {
  content: '';
  display: block;
  position: absolute;
  top: -10px;
  left: -8px;
  right: -8px;
  bottom: -10px;
}

/* Heights increase with depth level */
.depth-bar--1 { height: 12px; }
.depth-bar--2 { height: 22px; }
.depth-bar--3 { height: 32px; }

.depth-bar.is-active {
  background: var(--impact-color);
}

.depth-bar:hover {
  background: var(--text-muted);
}

.depth-bar.is-active:hover {
  background: var(--impact-color);
}

.depth-bar:focus-visible {
  outline: 2px solid var(--impact-color);
  outline-offset: 4px;
}

/* ── Date Picker Overlay ── */
.date-picker-wrapper {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.date-picker-wrapper.is-open {
  pointer-events: all;
  opacity: 1;
}

.date-picker-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.date-picker-panel {
  position: relative;
  margin: clamp(3.5rem, 10vh, 6rem) var(--col-pad);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  min-width: 220px;
  transform: translateY(-4px);
  transition: transform 0.2s ease;
}

.date-picker-wrapper.is-open .date-picker-panel {
  transform: translateY(0);
}

.date-picker-label {
  font-size: var(--size-label);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.date-picker-input {
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.date-picker-input:focus {
  outline: 2px solid var(--impact-color);
  outline-offset: 1px;
  border-color: transparent;
}

.date-picker-hint {
  font-size: 0.7rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: var(--section-pad-top) 0;
  min-height: 100dvh;
  justify-content: center;
}

.empty-state-date {
  font-size: var(--size-date);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.empty-state-headline {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--text-muted);
}

.empty-state-sub {
  font-size: var(--size-body);
  color: var(--text-muted);
  max-width: 400px;
}

.empty-state-code {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--border);
  padding: 0.5rem 0.85rem;
  border-radius: 3px;
  display: inline-block;
  margin: 0.25rem 0;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .snap-container {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ── Responsive tweaks ── */
@media (max-width: 600px) {
  :root {
    --col-pad: 1.25rem;
    --section-pad-top: 3.5rem;
    --section-pad-bottom: 2.5rem;
  }

  .impact-suffix {
    font-size: 0.5em;
  }

  /* Push content right so depth indicator doesn't overlap body text */
  .section-inner {
    padding-left: calc(var(--col-pad) + 18px);
  }
}
