/* ── CADENCE — Grooming Journal · Dark Edition ── */

:root {
  --bg:        #0a0c10;
  --surface:   #131820;
  --surface2:  #1a2030;
  --surface3:  #1e2638;
  --border:    rgba(201,168,76,0.15);
  --border2:   rgba(201,168,76,0.3);
  --text:      #d4c9b0;
  --muted:     #6b7a8f;
  --faint:     rgba(201,168,76,0.06);
  --cream:     #f0e6cc;

  --green:     #2a9d8f;
  --green-dim: rgba(42,157,143,0.15);
  --amber:     #c9a84c;
  --amber-dim: rgba(201,168,76,0.12);
  --rose:      #d45a50;
  --rose-dim:  rgba(192,57,43,0.12);
  --gold:      #c9a84c;
  --gold-dim:  #8a6f30;
  --gold-glow: rgba(201,168,76,0.18);

  --haircut-c: var(--green);
  --shave-c:   var(--amber);
  --hyg-c:     var(--rose);

  --radius:      6px;
  --radius-sm:   4px;
  --radius-pill: 99px;

  --shadow:       0 2px 16px rgba(0,0,0,0.5);
  --shadow-hover: 0 4px 24px rgba(0,0,0,0.6);

  --sans:   'Playfair Display', serif;
  --body:   'Crimson Pro', serif;
  --mono:   'JetBrains Mono', monospace;
  --rhythm: 'Crimson Pro', serif;
}

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

body {
  font-family: var(--body);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(201,168,76,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 85% 90%, rgba(42,157,143,0.04) 0%, transparent 70%);
  color: var(--text);
  min-height: 100vh;
  padding: 32px 24px;
}

/* ── LAYOUT ──────────────────────────────── */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: auto 1fr;
  gap: 20px;
}

/* ── HEADER ──────────────────────────────── */
header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-dim));
  opacity: 0.6;
}

.wordmark { display: flex; align-items: center; gap: 14px; }

.wordmark-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  animation: icon-wiggle 5s ease-in-out infinite;
}

@keyframes icon-wiggle {
  0%, 85%, 100% { transform: rotate(0deg); }
  88%           { transform: rotate(-10deg); }
  92%           { transform: rotate(10deg); }
  96%           { transform: rotate(-5deg); }
}

.wordmark h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  line-height: 1;
}

.wordmark span {
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--muted);
  display: block;
  margin-top: 3px;
  letter-spacing: 0.06em;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.btn-ghost {
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.btn-ghost:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: rgba(201,168,76,0.06);
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  animation: pop-in 0.4s ease both;
  transition: border-color 0.2s;
}

.card:hover { border-color: rgba(201,168,76,0.28); }

.card-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RHYTHM SECTION ── */
.rhythm-toggles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }

.rhythm-btn {
  font-family: var(--body);
  font-size: 0.95rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rhythm-btn:hover {
  background: rgba(201,168,76,0.06);
  border-color: var(--gold-dim);
  color: var(--gold);
}

.rhythm-btn.r-haircut {
  border-color: rgba(42,157,143,0.45);
  background: rgba(42,157,143,0.08);
  color: #2a9d8f;
}

.rhythm-btn.r-shave {
  border-color: rgba(201,168,76,0.45);
  background: rgba(201,168,76,0.08);
  color: var(--gold);
}

.rhythm-btn.r-hygienic {
  border-color: rgba(212,90,80,0.45);
  background: rgba(212,90,80,0.08);
  color: var(--rose);
}

.next-label {
  font-family: var(--mono);
  font-size: 0.56rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

.next-date {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
  line-height: 1.2;
}

.progress-rail {
  height: 4px;
  background: var(--surface2);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

/* ── CALENDAR ── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cream);
}

.cal-nav {
  background: none;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 9px;
  transition: all 0.2s;
  font-family: var(--mono);
}

.cal-nav:hover { border-color: var(--gold-dim); color: var(--gold); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-dow {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.54rem;
  color: var(--muted);
  padding: 4px 0 2px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  border-radius: 3px;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s;
  gap: 2px;
}

.cal-cell:hover { background: rgba(201,168,76,0.08); color: var(--gold); }

.cal-cell.today {
  background: var(--gold);
  color: #0a0c10;
  font-weight: 700;
  border-color: var(--gold);
}

.cal-cell.ev-haircut {
  background: rgba(42,157,143,0.14);
  color: #2a9d8f;
  border: 1px solid rgba(42,157,143,0.28);
  font-weight: 700;
}

.cal-cell.ev-shave {
  background: rgba(201,168,76,0.14);
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.28);
  font-weight: 700;
}

.cal-cell.ev-cleanshave {
  background: rgba(212,90,80,0.12);
  color: var(--rose);
  border: 1px solid rgba(212,90,80,0.25);
  font-weight: 700;
}

.cal-cell.ev-multi {
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.2);
  color: var(--gold);
}

.cal-dots {
  display: flex;
  gap: 2px;
  align-items: center;
}

.cal-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  display: inline-block;
}

.cal-dot.d-haircut    { background: #2a9d8f; }
.cal-dot.d-shave      { background: var(--gold); }
.cal-dot.d-cleanshave { background: var(--rose); }

/* ── ADD FORM ── */
.add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

input[type="date"],
select {
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  width: 100%;
  outline: none;
  transition: all 0.2s;
  color-scheme: dark;
}

input[type="date"]:focus,
select:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.btn-add {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  border: none;
  border-radius: var(--radius-sm);
  color: #0a0c10;
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-add:hover {
  background: linear-gradient(135deg, var(--gold), #e8b84b);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,168,76,0.25);
}

/* ── FILTER ROW ── */
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }

.fpill {
  background: none;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.fpill:hover { border-color: var(--gold-dim); color: var(--gold); }

.fpill.active {
  background: rgba(201,168,76,0.12);
  border-color: var(--gold-dim);
  color: var(--gold);
}

.count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: var(--surface2);
  border-radius: 99px;
  font-size: 0.56rem;
  padding: 0 4px;
  color: var(--muted);
}

.fpill.active .count-chip { background: rgba(201,168,76,0.18); color: var(--gold); }

/* ── TIMELINE ── */
.events-list { list-style: none; }

.event-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
  border-radius: var(--radius-sm);
}

.event-row:last-child { border-bottom: none; }
.event-row:hover { background: rgba(255,255,255,0.02); }

.event-emoji { font-size: 1.1rem; flex-shrink: 0; }

.event-type-pill {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.event-type-pill.ep-haircut {
  color: #2a9d8f;
  background: rgba(42,157,143,0.1);
  border-color: rgba(42,157,143,0.2);
}

.event-type-pill.ep-shave {
  color: var(--gold);
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.2);
}

.event-type-pill.ep-hygienic {
  color: var(--rose);
  background: rgba(212,90,80,0.08);
  border-color: rgba(212,90,80,0.2);
}

.event-date {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--muted);
  flex: 1;
  letter-spacing: 0.06em;
}

.del-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 4px 6px;
  border-radius: 3px;
  opacity: 0;
  transition: all 0.2s;
  font-family: var(--mono);
}

.event-row:hover .del-btn { opacity: 1; }
.del-btn:hover { color: #e74c3c; background: rgba(231,76,60,0.08); }

.empty-state {
  font-family: 'Crimson Pro', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
  padding: 20px 4px;
  text-align: center;
}

/* ── AUTH GATE ── */
.auth-gate.hidden { display: none !important; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 10%, rgba(201,168,76,0.04) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 85% 90%, rgba(42,157,143,0.04) 0%, transparent 70%);
  transition: opacity 0.3s, visibility 0.3s;
}

.auth-gate svg.auth-geo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-widget {
  position: relative;
  z-index: 1;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 32px 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  animation: pop-in 0.5s ease;
  overflow: hidden;
}

.auth-widget::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold), var(--gold-dim));
  opacity: 0.6;
}

.auth-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-input {
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  width: 100%;
  padding: 10px 14px;
  outline: none;
  transition: all 0.2s;
  color-scheme: dark;
}

.auth-input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.auth-submit {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  border: none;
  color: #0a0c10;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-submit:hover {
  background: linear-gradient(135deg, var(--gold), #e8b84b);
  box-shadow: 0 4px 20px rgba(201,168,76,0.3);
  transform: scale(1.04);
}

.auth-submit:active { transform: scale(0.96); }

.auth-status {
  font-family: var(--body);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 20px;
  margin-top: 10px;
  text-align: center;
}

/* ── VAULT WRAPPER (auth.js) ── */
.vault-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 8000;
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .add-grid { grid-template-columns: 1fr 1fr; }
  .add-grid .btn-add { grid-column: 1 / -1; }
}
