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

:root {
  --bg: #0a0a0f;
  --text: #e8e4df;
  --text-dim: #a09b94;
  --accent: #7c9885;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-snap-type: y mandatory;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === App Shell === */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(10, 10, 15, 0.9) 0%, transparent 100%);
  pointer-events: none;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.15em;
  color: var(--text);
  opacity: 0.8;
}

/* === Feed === */
.feed {
  display: flex;
  flex-direction: column;
}

/* === Card === */
.card {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.card-image-wrap {
  position: absolute;
  inset: 0;
}

.card-image-placeholder {
  position: absolute;
  inset: 0;
  background: var(--bg);
  animation: shimmer 2s ease-in-out infinite;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.card-image.loaded {
  opacity: 1;
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.15) 0%,
    rgba(0, 0, 0, 0.45) 40%,
    rgba(0, 0, 0, 0.65) 100%
  );
}

.card-content {
  position: relative;
  z-index: 2;
  padding: 2rem 1.75rem;
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  animation: fadeUp 0.8s ease both;
}

/* === Poem Typography === */
.poem-lines {
  text-align: center;
}

.poem-line {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 4vw, 1.35rem);
  line-height: 1.9;
  color: var(--text);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.poem-break {
  height: 0.6em;
}

.poem-attribution {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.7;
}

.poem-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.poem-poet {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* === Breathe Timer === */
.breathe-wrap {
  position: absolute;
  bottom: max(3.5rem, env(safe-area-inset-bottom) + 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  pointer-events: none;
}

.breathe-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 152, 133, 0.45);
  background: rgba(124, 152, 133, 0.07);
  animation: breathe-pulse 10s ease-in-out infinite;
}

@keyframes breathe-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.45; }
  40%       { transform: scale(1.9); opacity: 0.85; }
  50%       { transform: scale(1.9); opacity: 0.85; }
}

/* === Photo Credit === */
.photo-credit {
  position: absolute;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  right: 0.85rem;
  z-index: 3;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.35);
  text-decoration: none;
  transition: color 0.2s;
}
.photo-credit:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* === Loader === */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 3rem;
  min-height: 120px;
}

.loader-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0.4;
  animation: pulse 1.4s ease-in-out infinite;
}

.loader-dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dot:nth-child(3) { animation-delay: 0.4s; }

/* === Stats Page === */
.stats-page {
  min-height: 100dvh;
  padding: 2rem 1.5rem;
  padding-top: max(2rem, env(safe-area-inset-top));
  max-width: 600px;
  margin: 0 auto;
}

.stats-back {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 1.5rem;
  padding: 0.25rem 0;
}

.stats-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.stats-subtitle {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stats-section-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 1rem;
  color: var(--text-dim);
}

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.daily-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  font-size: 0.85rem;
}

.daily-date {
  color: var(--text);
  min-width: 6rem;
}

.daily-detail {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* === Animations === */
@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

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

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 0.8; transform: scale(1.2); }
}

/* === Responsive === */
@media (min-width: 768px) {
  .poem-line { font-size: 1.35rem; }
  .card-content { padding: 3rem 2.5rem; }
}

@media (max-width: 380px) {
  .poem-line { font-size: 1.1rem; line-height: 1.8; }
  .card-content { padding: 1.5rem 1.25rem; gap: 1.25rem; }
}

.card-content--long .poem-line {
  font-size: clamp(1.05rem, 3.5vw, 1.25rem);
  line-height: 1.75;
}

.card-content--long {
  gap: 1.25rem;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
