/* Lumen — Sun & Daylight Tracker
   Palette: midnight-indigo → dawn-rose → honey-amber → bone-sand → copper
   Typography: Frank Ruhl Libre (display) · Instrument Serif (accent) · IBM Plex Mono (numbers) · Heebo (body)
*/

:root {
  --bg: #0F0B1E;
  --bg-elev: #1A1432;
  --bg-elev-2: #221A40;
  --surface: rgba(34, 26, 64, 0.55);
  --surface-strong: rgba(34, 26, 64, 0.85);
  --line: rgba(232, 184, 106, 0.14);
  --line-strong: rgba(232, 184, 106, 0.28);

  --amber: #E8B86A;
  --amber-deep: #C48A4A;
  --rose: #D89B92;
  --rose-deep: #B97268;
  --indigo: #5B5099;
  --indigo-deep: #3A3270;
  --bone: #F2E6D0;
  --copper: #C48A4A;
  --plum: #4A2D58;

  --text: #F2E6D0;
  --text-mute: rgba(242, 230, 208, 0.65);
  --text-dim: rgba(242, 230, 208, 0.42);

  --good: #9FCB8B;
  --warn: #E8B86A;
  --bad: #D88A82;

  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.4, 0, .2, 1);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;

  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 60px rgba(232, 184, 106, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Heebo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient backdrop — orbs + grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 600px at 85% 8%, rgba(232, 184, 106, 0.16), transparent 60%),
    radial-gradient(circle 500px at 10% 25%, rgba(216, 155, 146, 0.13), transparent 60%),
    radial-gradient(circle 700px at 50% 110%, rgba(91, 80, 153, 0.20), transparent 60%);
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.9'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='0.06'/></svg>");
  z-index: 0;
  mix-blend-mode: overlay;
}

#root { position: relative; z-index: 1; max-width: 540px; margin: 0 auto; padding: 0 0 120px; min-height: 100vh; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  background: linear-gradient(to bottom, rgba(15, 11, 30, 0.86), rgba(15, 11, 30, 0.55));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(232, 184, 106, 0.3)); }
.brand-name {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 22px;
  letter-spacing: 0.5px;
  font-weight: 500;
  color: var(--text);
}
.brand-name em {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--amber);
  font-weight: 400;
  margin-inline-start: 6px;
  font-size: 0.85em;
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.3s var(--spring);
  font-size: 16px;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }
.icon-btn:active { transform: scale(0.94); }
.topbar-actions { display: flex; gap: 8px; }

/* ---------- Hero ---------- */
.hero {
  margin: 14px 14px 22px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 11;
  background-color: var(--bg-elev);
  background-image: url('./hero_bg.jpg');
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-soft);
}
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(15, 11, 30, 0.92) 0%, rgba(15, 11, 30, 0.3) 45%, rgba(15, 11, 30, 0) 80%),
              linear-gradient(to right, rgba(15, 11, 30, 0.55), transparent 60%);
}
.hero-inner {
  position: absolute; inset: 0; padding: 22px;
  display: flex; flex-direction: column; justify-content: flex-end;
  z-index: 2;
}
.hero-eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
  opacity: 0.85;
}
.hero-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.05;
  margin: 0 0 6px;
  font-weight: 500;
  letter-spacing: -0.5px;
}
.hero-title em {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  color: var(--amber);
  font-weight: 400;
}
.hero-sub {
  font-size: 14px;
  color: var(--text-mute);
  line-height: 1.5;
  max-width: 320px;
}

/* ---------- Stats row ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 14px 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease);
}
.stat:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.stat-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 500;
  color: var(--bone);
  display: block;
  letter-spacing: -0.5px;
  line-height: 1;
}
.stat-num small {
  font-size: 11px;
  color: var(--text-dim);
  margin-inline-start: 2px;
}
.stat-label {
  font-size: 10.5px;
  color: var(--text-mute);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 6px;
  display: block;
}
.stat-spark {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 18px;
  opacity: 0.5;
}

/* ---------- Section / panel ---------- */
.section { margin: 0 14px 22px; }
.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0 4px 12px;
}
.section-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 18px;
  font-weight: 500;
  margin: 0;
  letter-spacing: 0.3px;
}
.section-title em { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--amber); font-weight: 400; }
.section-meta { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-dim); letter-spacing: 0.5px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
  position: relative;
}

/* ---------- Sun arc panel (primary feature) ---------- */
.sunpanel { padding: 22px 18px 12px; }
.sun-svg { width: 100%; aspect-ratio: 16/9; display: block; }
.sun-times {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.suntime { text-align: center; }
.suntime-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.suntime-val { font-family: 'IBM Plex Mono', monospace; font-size: 15px; margin-top: 4px; color: var(--bone); }
.suntime-val em { font-style: normal; color: var(--amber); }

.golden-hint {
  margin-top: 12px;
  background: linear-gradient(135deg, rgba(232, 184, 106, 0.12), rgba(216, 155, 146, 0.08));
  border: 1px solid rgba(232, 184, 106, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  color: var(--bone);
}
.golden-hint .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber);
  animation: gpulse 2s var(--ease) infinite;
}
@keyframes gpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 184, 106, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(232, 184, 106, 0); }
}

/* ---------- Today log ---------- */
.daypanel { padding: 16px 18px; }
.day-ring-wrap { display: flex; align-items: center; gap: 16px; }
.day-ring { position: relative; width: 110px; height: 110px; flex-shrink: 0; }
.day-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.day-ring-num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 26px;
  color: var(--bone);
  letter-spacing: -0.5px;
}
.day-ring-num small {
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 2px;
}
.day-body { flex: 1; }
.day-line {
  display: flex; justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.day-line:last-child { border-bottom: none; }
.day-line-label { color: var(--text-mute); }
.day-line-val { font-family: 'IBM Plex Mono', monospace; color: var(--bone); }

/* ---------- Calendar heatmap ---------- */
.heatmap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.heat-col { display: flex; flex-direction: column; gap: 4px; }
.heat-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(232, 184, 106, 0.06);
  position: relative;
  cursor: pointer;
  transition: transform 0.2s var(--spring);
}
.heat-cell.l1 { background: rgba(232, 184, 106, 0.18); }
.heat-cell.l2 { background: rgba(232, 184, 106, 0.36); }
.heat-cell.l3 { background: rgba(232, 184, 106, 0.6); }
.heat-cell.l4 { background: rgba(232, 184, 106, 0.92); box-shadow: 0 0 8px rgba(232, 184, 106, 0.3); }
.heat-cell:hover { transform: scale(1.5); z-index: 5; outline: 1px solid var(--amber); }
.heat-legend {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
  justify-content: flex-end;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.5px;
}
.heat-legend-cells { display: flex; gap: 3px; }
.heat-legend-cells span {
  display: block; width: 10px; height: 10px; border-radius: 2px;
}

/* ---------- Sessions list ---------- */
.sessions-list { display: flex; flex-direction: column; gap: 8px; }
.session-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(34, 26, 64, 0.35);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: all 0.3s var(--ease);
}
.session-row:hover { border-color: var(--line-strong); background: rgba(34, 26, 64, 0.55); }
.session-icon {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--amber), var(--copper));
  color: var(--bg);
  display: grid; place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}
.session-row.dawn .session-icon { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); }
.session-row.dusk .session-icon { background: linear-gradient(135deg, var(--indigo), var(--plum)); }
.session-row.midday .session-icon { background: linear-gradient(135deg, var(--amber), var(--amber-deep)); }
.session-info { flex: 1; min-width: 0; }
.session-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--bone);
}
.session-meta {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}
.session-dur {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  color: var(--amber);
  letter-spacing: -0.3px;
}
.session-dur small { font-size: 10px; color: var(--text-dim); }
.session-del {
  background: none; border: none;
  color: var(--text-dim);
  cursor: pointer; padding: 6px;
  border-radius: 50%;
  width: 28px; height: 28px;
  display: grid; place-items: center;
}
.session-del:hover { color: var(--bad); background: rgba(216, 138, 130, 0.1); }

.empty-state {
  text-align: center;
  padding: 32px 14px 18px;
  color: var(--text-mute);
}
.empty-state img { width: 110px; height: 110px; opacity: 0.85; margin-bottom: 8px; }
.empty-state-title { font-family: 'Frank Ruhl Libre', serif; font-size: 17px; margin: 0 0 4px; color: var(--bone); }
.empty-state-body { font-size: 13px; max-width: 280px; margin: 0 auto; line-height: 1.5; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex; align-items: center; gap: 0;
}
.fab-main {
  background: linear-gradient(135deg, var(--amber), var(--copper));
  color: var(--bg);
  border: none;
  width: 64px; height: 64px;
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(232, 184, 106, 0.4), 0 4px 12px rgba(0,0,0,0.4);
  transition: all 0.4s var(--spring);
  position: relative;
}
.fab-main::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), var(--copper));
  filter: blur(14px);
  opacity: 0.5;
  z-index: -1;
}
.fab-main:hover { transform: scale(1.08) rotate(90deg); }
.fab-main:active { transform: scale(0.94); }

/* timer running state */
.fab-main.timing {
  background: linear-gradient(135deg, var(--good), #6BA058);
  animation: timing-pulse 2s var(--ease) infinite;
}
@keyframes timing-pulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(159, 203, 139, 0.5), 0 0 0 0 rgba(159, 203, 139, 0.4); }
  50% { box-shadow: 0 10px 24px rgba(159, 203, 139, 0.5), 0 0 0 18px rgba(159, 203, 139, 0); }
}

/* ---------- Modals ---------- */
.scrim {
  position: fixed; inset: 0;
  background: rgba(15, 11, 30, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.scrim.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 540px; margin: 0 auto;
  background: var(--bg-elev);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--line);
  border-bottom: none;
  z-index: 101;
  max-height: 88vh;
  overflow-y: auto;
  transform: translateY(110%);
  transition: transform 0.45s var(--spring);
  padding: 22px 22px 30px;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
}
.sheet.show { transform: translateY(0); }
.sheet-grab {
  width: 40px; height: 4px;
  background: var(--line-strong);
  border-radius: 2px;
  margin: -8px auto 14px;
}
.sheet-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 22px;
  margin: 0 0 4px;
  text-align: center;
  font-weight: 500;
}
.sheet-title em { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--amber); font-weight: 400; }
.sheet-sub {
  text-align: center;
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 22px;
}

/* ---------- Form controls ---------- */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-family: 'IBM Plex Mono', monospace;
}
.input, .select, .textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.2s var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--amber);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(232, 184, 106, 0.1);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chip-group { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  color: var(--text-mute);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s var(--spring);
  font-family: inherit;
}
.chip:hover { border-color: var(--line-strong); }
.chip.on {
  background: linear-gradient(135deg, var(--amber), var(--copper));
  color: var(--bg);
  border-color: var(--amber);
  font-weight: 600;
}

.btn {
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: all 0.25s var(--spring);
}
.btn-primary {
  background: linear-gradient(135deg, var(--amber), var(--copper));
  color: var(--bg);
  box-shadow: 0 6px 18px rgba(232, 184, 106, 0.32);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(232, 184, 106, 0.4); }
.btn-ghost {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 1px solid var(--line);
}

/* ---------- Insights modal ---------- */
.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.insight-card {
  padding: 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.insight-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 24px;
  color: var(--amber);
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}
.insight-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.weekchart-wrap { margin-top: 12px; }
.weekchart { width: 100%; height: 140px; }
.weekchart-labels {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-align: center;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* ---------- About modal ---------- */
.about-hero {
  display: flex; gap: 14px; align-items: center;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.about-hero img { width: 60px; height: 60px; filter: drop-shadow(0 0 12px rgba(232,184,106,0.35)); }
.about-hero h3 { font-family: 'Frank Ruhl Libre', serif; margin: 0 0 4px; font-size: 22px; font-weight: 500; }
.about-hero p { margin: 0; color: var(--text-mute); font-size: 13px; }
.about-list { padding: 0; margin: 0; list-style: none; }
.about-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.about-list li:last-child { border-bottom: none; }
.about-list li::before { content: '✦'; color: var(--amber); margin-top: 1px; flex-shrink: 0; font-size: 14px; }
.about-foot { margin-top: 14px; font-size: 11px; color: var(--text-dim); text-align: center; letter-spacing: 0.3px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 110px;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s var(--spring);
  box-shadow: 0 10px 28px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
  .topbar { padding: 14px 16px; }
  .hero { margin: 10px 10px 18px; }
  .section { margin: 0 10px 18px; }
  .stats { margin: 0 10px 18px; gap: 8px; }
  .stat-num { font-size: 19px; }
}
@media (min-width: 720px) {
  .hero-title { font-size: 44px; }
}

/* ---------- Helpers ---------- */
.row { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.between { justify-content: space-between; }
.hide { display: none !important; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.5s var(--ease) both; }
