/* =====================================================
   KOM Memorial – Main Stylesheet
   Dark cycling theme with polka-dot KOM jersey accents
   ===================================================== */

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

:root {
  --bg:        #0d0d0d;
  --bg2:       #161616;
  --bg3:       #1e1e1e;
  --border:    #2a2a2a;
  --border2:   #333;
  --red:       #B71C1C;
  --red-light: #ef5350;
  --red-dark:  #7f0000;
  --gold:      #FFD700;
  --gold-dim:  #a07800;
  --green:     #2e7d32;
  --green-light:#4caf50;
  --text:      #f0f0f0;
  --text-dim:  #aaa;
  --text-muted:#666;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --font:      'Inter', system-ui, sans-serif;
  --font-serif:'Playfair Display', Georgia, serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--red-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utilities ────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.narrow    { max-width: 700px; }
.text-center { text-align: center; }
.page-pad  { padding-top: 2.5rem; padding-bottom: 4rem; }
.inline    { display: inline; }

/* ── Navbar ───────────────────────────────────────── */
.navbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 800; font-size: 1.1rem; color: var(--text);
  text-decoration: none; letter-spacing: -0.02em;
}
.nav-brand:hover { text-decoration: none; }
.crown-icon { font-size: 1.3rem; }
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  padding: 0.4rem 0.8rem; border-radius: var(--radius);
  color: var(--text-dim); font-size: 0.9rem; font-weight: 500;
  text-decoration: none; transition: background 0.15s, color 0.15s;
  background: none; border: none; cursor: pointer; font-family: var(--font);
}
.nav-link:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav-cta {
  background: var(--red); color: #fff !important;
  font-weight: 600; margin-left: 0.25rem;
}
.nav-cta:hover { background: var(--red-light) !important; }
.nav-logout { color: var(--text-muted) !important; }

/* ── Main ─────────────────────────────────────────── */
.main-content { flex: 1; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.2rem; border-radius: var(--radius);
  font-family: var(--font); font-weight: 600; font-size: 0.9rem;
  border: none; cursor: pointer; text-decoration: none;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-light); }
.btn-danger { background: #7f0000; color: #fff; border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border2); }
.btn-outline:hover { border-color: var(--red-light); color: var(--red-light); background: transparent; }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); color: var(--text); }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-inline {
  background: none; border: none; color: var(--red-light);
  font-size: 0.8rem; cursor: pointer; padding: 0; margin-left: 0.5rem;
  font-family: var(--font); text-decoration: underline;
}
.btn-inline:hover { color: var(--gold); }

/* ── Alerts ───────────────────────────────────────── */
.alert {
  padding: 0.85rem 1.1rem; border-radius: var(--radius);
  margin-bottom: 1.25rem; font-size: 0.9rem;
}
.alert-error { background: rgba(183,28,28,0.2); border: 1px solid var(--red); color: #ef9a9a; }
.alert-success { background: rgba(46,125,50,0.2); border: 1px solid var(--green); color: #a5d6a7; }

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.2rem 0.6rem;
  border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-green { background: rgba(46,125,50,0.25); color: var(--green-light); border: 1px solid var(--green); }
.badge-red   { background: rgba(183,28,28,0.25); color: var(--red-light);   border: 1px solid var(--red);   }

/* ── Page header ──────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap;
}
.page-header h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; }
.page-sub { color: var(--text-dim); margin-top: 0.2rem; }

/* ── Section ──────────────────────────────────────── */
.section { margin-bottom: 3rem; }
.section-label {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 1rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-dim);
  margin-bottom: 1rem; padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.count-pill {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 999px; padding: 0.1rem 0.55rem;
  font-size: 0.8rem; color: var(--text-dim);
}

/* ── KOM Grid ─────────────────────────────────────── */
.kom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}
.kom-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  transition: border-color 0.2s, transform 0.15s;
}
.kom-card:hover { transform: translateY(-2px); }
.kom-card--active { border-left: 3px solid var(--green); }
.kom-card--memorial { border-left: 3px solid var(--red); }

.kom-card-header { display: flex; align-items: center; justify-content: space-between; }
.kom-crown { font-size: 1.4rem; }
.kom-name { font-size: 1.1rem; font-weight: 700; line-height: 1.3; }
.kom-meta { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: var(--text-dim); }
.days-pill {
  display: inline-block; background: rgba(255,215,0,0.1);
  border: 1px solid var(--gold-dim); color: var(--gold);
  border-radius: 999px; padding: 0.15rem 0.6rem;
  font-size: 0.78rem; font-weight: 600; width: fit-content; margin-top: 0.15rem;
}
.kom-notes { font-size: 0.82rem; color: var(--text-dim); font-style: italic; }
.kom-holder { font-size: 0.85rem; color: var(--text-dim); }
.strava-link { font-size: 0.82rem; color: var(--red-light); }
.kom-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; padding-top: 0.5rem; }

/* ── Empty state ──────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  background: var(--bg2); border: 1px dashed var(--border2);
  border-radius: var(--radius-lg); color: var(--text-dim);
}
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state a { color: var(--red-light); }

/* ── Auth pages ───────────────────────────────────── */
.auth-page {
  display: flex; justify-content: center; align-items: flex-start;
  padding: 4rem 1rem;
}
.auth-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.auth-header h1 { font-size: 1.6rem; font-weight: 800; }
.auth-header p { color: var(--text-dim); margin-top: 0.3rem; font-size: 0.9rem; }
.auth-switch { text-align: center; margin-top: 1.5rem; font-size: 0.88rem; color: var(--text-dim); }

/* ── Forms ────────────────────────────────────────── */
.auth-form, .form-card form { display: flex; flex-direction: column; gap: 1rem; }
.form-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
  box-shadow: var(--shadow);
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-size: 0.88rem; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 0.25rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font); font-size: 0.95rem;
  padding: 0.65rem 0.9rem; transition: border-color 0.15s;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none; border-color: var(--red-light);
  box-shadow: 0 0 0 3px rgba(183,28,28,0.15);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); }
.required { color: var(--red-light); }
.optional { color: var(--text-muted); font-weight: 400; font-style: italic; text-transform: none; letter-spacing: 0; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; flex-wrap: wrap; }

/* ── Memorial banner (memorialize form) ───────────── */
.memorial-banner {
  display: flex; align-items: center; gap: 1.25rem;
  background: rgba(183,28,28,0.1); border: 1px solid var(--red);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.memorial-crown { font-size: 2.5rem; }
.memorial-banner h2 { font-size: 1.2rem; font-weight: 700; }
.memorial-banner p { color: var(--text-dim); font-size: 0.88rem; margin-top: 0.2rem; }

/* ── Tombstone card ───────────────────────────────── */
.tombstone-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

/* Polka dot background on tombstone */
.tombstone-card::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(183,28,28,0.1) 4px, transparent 4px);
  background-size: 40px 40px;
  pointer-events: none;
}

.tombstone-top { position: relative; z-index: 1; }
.tombstone-crown { font-size: 3.5rem; display: block; margin-bottom: 0.5rem; }
.tombstone-rip {
  font-family: var(--font-serif); font-size: 2rem; font-style: italic;
  color: var(--red-light); letter-spacing: 0.15em;
}
.tombstone-subtitle {
  font-size: 0.72rem; letter-spacing: 0.3em; color: var(--text-muted);
  text-transform: uppercase; margin-top: 0.25rem;
}
.tombstone-segment {
  font-size: 2rem; font-weight: 900; letter-spacing: -0.02em;
  margin: 1.5rem 0; line-height: 1.2; position: relative; z-index: 1;
}
.tombstone-dates {
  display: flex; align-items: center; justify-content: center; gap: 1.5rem;
  flex-wrap: wrap; position: relative; z-index: 1;
}
.tombstone-date-block { display: flex; flex-direction: column; gap: 0.2rem; }
.date-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.date-val { font-size: 0.95rem; font-weight: 600; color: var(--text-dim); }
.tombstone-divider { color: var(--text-muted); font-size: 1.5rem; }
.tombstone-days {
  font-size: 1.15rem; margin-top: 1rem; position: relative; z-index: 1;
  color: var(--gold);
}
.tombstone-holder {
  color: var(--text-dim); font-size: 0.88rem; margin-top: 0.4rem;
  position: relative; z-index: 1;
}
.tombstone-divider-line {
  height: 1px; background: var(--border); margin: 1.5rem 0;
  position: relative; z-index: 1;
}
.tombstone-obituary {
  font-style: italic; color: var(--text-dim); line-height: 1.8;
  font-size: 0.97rem; position: relative; z-index: 1;
  quotes: "\201C" "\201D";
}
.tombstone-obituary::before { content: open-quote; font-size: 2rem; color: var(--red); vertical-align: -0.4rem; }
.tombstone-obituary::after  { content: close-quote; font-size: 2rem; color: var(--red); vertical-align: -0.4rem; }
.tombstone-brand {
  margin-top: 2rem; font-size: 0.72rem; letter-spacing: 0.15em;
  color: var(--text-muted); text-transform: uppercase;
  position: relative; z-index: 1;
}

/* ── Memorial actions & image ─────────────────────── */
.memorial-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 2rem; }
.image-preview { margin-top: 2rem; }
.image-preview h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-dim); }
.memorial-img {
  width: 100%; max-width: 540px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); display: block;
}
.img-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ── Hero ─────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0d0d0d 0%, #1a0000 60%, #0d0d0d 100%);
  border-bottom: 1px solid var(--border);
  padding: 6rem 1.5rem;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(183,28,28,0.08) 5px, transparent 5px);
  background-size: 50px 50px;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; }
.hero-badge {
  display: inline-block; background: rgba(183,28,28,0.2);
  border: 1px solid var(--red); color: var(--red-light);
  border-radius: 999px; padding: 0.3rem 1rem;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 900;
  letter-spacing: -0.04em; line-height: 1.1; margin-bottom: 1.25rem;
}
.hero-title em { color: var(--red-light); font-style: italic; font-family: var(--font-serif); }
.hero-sub { font-size: 1.1rem; color: var(--text-dim); line-height: 1.7; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Features ─────────────────────────────────────── */
.features { padding: 5rem 0; }
.section-title {
  text-align: center; font-size: 2rem; font-weight: 800;
  letter-spacing: -0.03em; margin-bottom: 3rem;
}
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
.feature-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.75rem;
  transition: border-color 0.2s, transform 0.15s;
}
.feature-card:hover { border-color: var(--red); transform: translateY(-3px); }
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.88rem; color: var(--text-dim); line-height: 1.6; }

/* ── CTA section ──────────────────────────────────── */
.cta-section {
  padding: 5rem 1.5rem;
  background: linear-gradient(135deg, #1a0000, #0d0d0d);
  border-top: 1px solid var(--border);
}
.cta-section h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.75rem; }
.cta-section p { color: var(--text-dim); margin-bottom: 1.75rem; }

/* ── Footer ───────────────────────────────────────── */
.site-footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 2rem 1.5rem; text-align: center;
}
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-inner p { color: var(--text-muted); font-size: 0.85rem; }
.footer-sub { font-size: 0.75rem; margin-top: 0.25rem; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
  .page-header { flex-direction: column; }
  .hero { padding: 4rem 1rem; }
  .form-actions { flex-direction: column; }
  .memorial-actions { flex-direction: column; }
  .tombstone-card { padding: 1.75rem 1.25rem; }
  .tombstone-dates { gap: 0.75rem; }
  .tombstone-segment { font-size: 1.5rem; }
  .nav-links .nav-link { padding: 0.4rem 0.5rem; font-size: 0.82rem; }
}
