/* Home hub. Layout: a greeting band, then a dense bento grid of cards
   (2 columns on phones, 4 on wider screens). */

.home.wrap { gap: 28px; }
.hub { display: grid; gap: 18px; }

/* Greeting */
.hub-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: clamp(22px, 5vw, 40px) clamp(18px, 4vw, 34px);
  border-radius: var(--r-xl);
  background: var(--surface);
}
.hub-orbs { position: absolute; inset: 0; z-index: -1; }
.hub-orbs span {
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.55;
  animation: orb-drift 18s ease-in-out infinite alternate;
}
.hub-orbs span:nth-child(1) { background: var(--secondary); top: -90px; left: -60px; }
.hub-orbs span:nth-child(2) { background: var(--accent); top: -40px; left: 40%; animation-duration: 22s; }
.hub-orbs span:nth-child(3) { background: var(--primary); bottom: -120px; right: -60px; animation-duration: 26s; }
@keyframes orb-drift { to { transform: translate(40px, 30px) scale(1.15); } }
.hub-date { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); opacity: 0.85; }
.hub-hello { font-size: clamp(2rem, 7vw, 3.2rem); line-height: 1.05; margin-top: 6px; }
.hub-name {
  background: linear-gradient(90deg, var(--secondary), var(--accent), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hub-tools { display: flex; gap: 8px; align-self: center; }
.hub-icon {
  appearance: none; border: 0; cursor: pointer;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(7, 10, 31, 0.55); color: var(--ink);
  backdrop-filter: blur(6px);
}
.hub-icon[aria-pressed="true"] { background: var(--secondary); color: var(--on-secondary); }

/* Grid */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 12px;
}
@media (min-width: 820px) { .hub-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }

.hub-card {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.hub-next, .hub-checkin, .hub-photos, .hub-jar, .hub-links { grid-column: span 2; }
@media (min-width: 820px) { .hub-links { grid-column: span 4; } }

.hc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hc-title { font-family: var(--font-body); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.hc-open { font-size: 0.8rem; font-weight: 800; color: var(--link); text-decoration: none; }
.hc-body { display: grid; gap: 8px; align-content: start; min-width: 0; }
.hc-big { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.05; color: var(--deep); }
.hc-big-sm { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--deep); }
.hc-sub { font-size: 0.86rem; color: var(--muted); overflow-wrap: anywhere; }
.hc-empty { font-size: 0.9rem; color: var(--muted); }
.hc-body .btn { justify-self: start; }
.hc-warn { font-size: 0.85rem; font-weight: 700; background: var(--secondary-light); color: var(--ink); border-radius: var(--r-sm); padding: 8px 12px; }
.hc-cheer { font-weight: 800; color: var(--pink-text); }
.hub-link { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-size: 0.86rem; font-weight: 800; color: var(--link); text-decoration: none; cursor: pointer; justify-self: start; text-align: left; }

/* Up next */
.dose-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dose-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.dose-info { display: grid; gap: 4px; min-width: 0; }
.dose-info strong { overflow-wrap: anywhere; }
.dose-chip { justify-self: start; font-size: 0.72rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: var(--primary-light); color: var(--link); }
.dose-chip[data-state="today"] { background: var(--warn); color: var(--on-warn); }
.dose-chip[data-state="late"] { background: var(--secondary); color: var(--on-secondary); }
.dose-chip[data-state="none"] { background: var(--surface); color: var(--muted); }

/* Accent cards */
.hub-milestone { background: linear-gradient(150deg, var(--lav-light), var(--primary-light)); }
.hub-milestone.is-anniv { background: linear-gradient(150deg, var(--secondary-light), var(--lav-light)); outline: 2px solid var(--secondary); }
.hub-visit .hc-big { color: var(--pink-text); }
.hub-checkin { background: linear-gradient(120deg, var(--surface), var(--secondary-light) 140%); }

/* Mood check-in */
.mood-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.mood-btn {
  appearance: none; border: 2px solid transparent; cursor: pointer; font: inherit; font-weight: 800; font-size: 0.8rem;
  padding: 12px 2px; border-radius: var(--r-sm); color: var(--ink); background: var(--surface-2);
  transition: transform .12s ease;
}
.mood-btn:active { transform: scale(0.95); }
.mood-btn[data-mood="1"] { background: var(--secondary-dark); color: #fff; }
.mood-btn[data-mood="2"] { background: var(--secondary-light); }
.mood-btn[data-mood="3"] { background: var(--lav-light); }
.mood-btn[data-mood="4"] { background: var(--primary-light); }
.mood-btn[data-mood="5"] { background: var(--primary); color: var(--on-primary); }
.mood-btn[aria-pressed="true"] { border-color: var(--ink); }

/* Photos */
.photo-wrap { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center; }
.hub-photo { width: 96px; height: 128px; border-radius: var(--r-sm); overflow: hidden; background: linear-gradient(160deg, var(--lav-light), var(--primary-light)); }
.hub-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-meta { display: grid; gap: 6px; }

/* Voice */
.week-dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.week-dot { display: grid; place-items: center; aspect-ratio: 1; max-width: 30px; border-radius: 50%; background: var(--surface-2); font-size: 0.68rem; font-weight: 800; color: var(--muted); }
.week-dot.on { background: linear-gradient(135deg, var(--secondary), var(--accent)); color: #fff; }
.voice-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink); }

/* Jar */
.jar-quote {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  line-height: 1.35;
  color: var(--deep);
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.hub-jar { background: linear-gradient(140deg, var(--surface) 55%, var(--secondary-light)); }
.hc-ms-title { font-weight: 800; color: var(--deep); overflow-wrap: anywhere; }

/* Labs */
.lab-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lab-list li { display: grid; gap: 0; }
.lab-n { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.lab-v { font-family: var(--font-mono); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* All tools */
.tool-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 112px), 1fr)); gap: 8px; }
.tool-link { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; font-weight: 800; font-size: 0.88rem; color: var(--ink) !important; background: var(--surface-2); padding: 8px 14px; border-radius: 999px; }
.tool-link:hover { background: var(--primary-light); }

/* Discreet mode */
.hub-card.is-covered .hc-body { filter: blur(12px); opacity: 0.4; pointer-events: none; user-select: none; }
.hc-cover {
  position: absolute; inset: 40px 0 0;
  appearance: none; border: 0; cursor: pointer; background: transparent;
  display: grid; place-content: center; justify-items: center; gap: 6px;
  color: var(--ink); font: inherit; font-weight: 800; font-size: 0.85rem;
}

/* Settings */
.card-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.order-row { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border-radius: var(--r-sm); padding: 6px 8px 6px 12px; }
.order-check { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 0.92rem; }
.order-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.order-row .icon-btn { width: 32px; height: 32px; font-size: 1rem; }
.order-row .icon-btn:disabled { opacity: 0.3; cursor: default; }

/* About section: open on the welcome page, folded away on the hub */
.about { border-radius: var(--r-lg); }
.about > summary {
  cursor: pointer; list-style: none;
  font-weight: 800; color: var(--link);
  padding: 14px 18px; border-radius: var(--r-lg); background: var(--surface);
}
.about > summary::-webkit-details-marker { display: none; }
html:not(.hub-mode) .about > summary { display: none; }
.about-body { display: grid; gap: 28px; padding-top: 16px; }
html:not(.hub-mode) .about-body { padding-top: 0; }

@media (prefers-reduced-motion: reduce) { .hub-orbs span { animation: none; } }
.hc-soon { font-size: 0.85rem; font-weight: 800; color: var(--pink-text); }
.warm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.warm-streak { white-space: nowrap; font-size: 0.8rem; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: linear-gradient(120deg, rgba(255, 79, 163, .25), rgba(61, 169, 252, .2)); color: var(--ink); }
.warm-done { font-size: 0.86rem; font-weight: 800; color: var(--pink-text); }
/* Floating hard day heart */
.hub { padding-bottom: 76px; }
.hard-fab {
  position: fixed; z-index: 20;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  height: 56px; min-width: 56px; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 0;
  border-radius: 999px; text-decoration: none; color: #fff;
  background: radial-gradient(circle at 30% 25%, #FF8CC6, #FF4FA3 45%, #9B5DE5);
  box-shadow: 0 8px 24px rgba(7, 10, 31, 0.6), 0 0 22px rgba(255, 79, 163, 0.35);
  transition: transform .2s ease, box-shadow .2s ease, gap .35s ease;
}
.hard-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(7, 10, 31, 0.6), 0 0 30px rgba(255, 79, 163, 0.5); }
.hard-fab { -webkit-tap-highlight-color: transparent; outline: none; }
.hard-fab:active { transform: scale(0.96); background: #fff; color: #FF4FA3; box-shadow: 0 8px 24px rgba(7, 10, 31, 0.6), 0 0 0 3px #FF4FA3; }
.hard-fab-label { max-width: 0; overflow: hidden; white-space: nowrap; font-weight: 800; font-size: 0.92rem; transition: max-width .35s ease; }
.hard-fab.show-label { gap: 8px; }
.hard-fab.show-label .hard-fab-label { max-width: 7em; }
.hard-fab:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 22px rgba(255, 79, 163, 0.35); }
@media (prefers-reduced-motion: reduce) { .hard-fab, .hard-fab-label { transition: none; } }
@media print { .hard-fab { display: none; } }
.hc-soft { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(155, 93, 229, 0.16); font-size: 0.9rem; }

/* Backup reminder */
.backup-nudge {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center;
  padding: 16px 18px; border-radius: var(--r-lg);
  background: linear-gradient(140deg, rgba(155, 93, 229, 0.22), rgba(61, 169, 252, 0.12)), var(--surface);
  border: 1px solid rgba(155, 93, 229, 0.35);
  animation: bn-in .4s ease;
}
@keyframes bn-in { from { opacity: 0; transform: translateY(-6px); } }
.bn-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.08); color: #FFB3D6; }
.bn-text { display: grid; gap: 2px; font-size: 0.9rem; color: var(--muted); }
.bn-text strong { color: var(--ink); font-size: 1rem; }
.bn-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
@media (min-width: 700px) { .backup-nudge { grid-template-columns: auto minmax(0, 1fr) auto; } .bn-actions { grid-column: auto; } }
@media (prefers-reduced-motion: reduce) { .backup-nudge { animation: none; } }
