@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,700&display=swap');

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

:root {
  --bg:      #000000;
  --surface: #080808;
  --border:  #1c1c1c;
  --text:    #ffffff;
  --muted:   #555555;
  --accent:  #c64166;
  --soft:    #999999;
  --pad:     clamp(1.25rem, 4vw, 3rem);

  /* tier tints */
  --good-bg:   rgba(255,255,255,0.04); --good-bd: var(--border); --good-tx: var(--soft);
  --better-bg: rgba(143,168,204,0.12); --better-bd: rgba(143,168,204,0.4); --better-tx: #8fa8cc;
  --best-bg:   rgba(198,65,102,0.12);  --best-bd: rgba(198,65,102,0.4);  --best-tx: var(--accent);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Nav ── */
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem var(--pad);
  border-bottom: 1px solid var(--border);
}
.site-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--text);
  text-decoration: none;
}
.nav-browse {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-browse:hover { color: var(--text); }

/* ── Today page ── */
.today-page { padding-bottom: 6rem; }

.today-hero {
  padding: 2.5rem var(--pad) 1.75rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.today-hero.has-ambient {
  min-height: 260px;
  display: flex;
  align-items: flex-end;
}
.today-hero.has-ambient::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--ambient-img);
  background-size: cover;
  background-position: center;
  opacity: 0.28;
  z-index: 0;
}
.today-hero.has-ambient::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.1) 60%);
  z-index: 1;
}
.today-hero-content { position: relative; z-index: 2; }

.today-eyebrow {
  font-size: 0.55rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.today-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.today-progress {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--accent);
}

/* ── Routine image ── */
.routine-img-wrap {
  margin-bottom: 1.25rem;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 3 / 1;
}
.routine-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.7;
}

/* ── Per-habit thumbnail ── */
.habit-thumb {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  opacity: 0.75;
}

/* ── Routines grid ── */
.routines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  border-bottom: 1px solid var(--border);
}

/* ── Routine blocks ── */
.routine-block {
  padding: 1.75rem var(--pad);
  border-right: 1px solid var(--border);
}
.routine-block:last-child { border-right: none; }
.routine-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 1.1rem;
}

/* ── Habit list items ── */
.habit-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.habit-item:last-child { border-bottom: none; }
.habit-item:active { opacity: 0.7; }

/* Circle */
.habit-circle {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.check-icon {
  width: 12px;
  height: 12px;
  color: transparent;
  transition: color 0.15s, transform 0.2s;
  transform: scale(0);
}

/* Text */
.habit-text-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.habit-main-text {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.25;
  transition: color 0.2s, text-decoration 0.2s;
}
.habit-tier-label {
  font-size: 0.64rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-height: 1em;
}

/* ── States ── */
.state-good .habit-circle,
.state-better .habit-circle,
.state-best .habit-circle {
  border-color: transparent;
}
.state-good .check-icon,
.state-better .check-icon,
.state-best .check-icon {
  transform: scale(1);
}
.state-good .habit-main-text  { color: var(--soft); text-decoration: line-through; text-decoration-color: var(--muted); }
.state-better .habit-main-text { color: var(--soft); text-decoration: line-through; text-decoration-color: var(--muted); }
.state-best .habit-main-text  { color: var(--soft); text-decoration: line-through; text-decoration-color: var(--muted); }

/* Good — white fill */
.state-good .habit-circle { background: #fff; }
.state-good .check-icon   { color: #000; }
.state-good .habit-tier-label { color: var(--soft); }

/* Better — blue */
.state-better .habit-circle { background: #8fa8cc; }
.state-better .check-icon   { color: #fff; }
.state-better .habit-tier-label { color: #8fa8cc; }

/* Best — raspberry */
.state-best .habit-circle { background: var(--accent); }
.state-best .check-icon   { color: #fff; }
.state-best .habit-tier-label { color: var(--accent); }

/* ── Save bar ── */
.save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem var(--pad);
  flex-wrap: wrap;
}
.save-note {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
}
.btn-save {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.8rem 1.75rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-save:hover { opacity: 0.85; }

/* ── Mobile ── */
@media (max-width: 600px) {
  .tier-row { grid-template-columns: 1fr; }
  .save-bar { flex-direction: column; align-items: stretch; }
  .btn-save { width: 100%; }
}
