/* KOM Memorial: dark cycling theme with polka-dot KOM jersey accents.
   Tokens carried over from the original app's style.css. */

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

:root {
  --bg:        #0d0d0d;
  --bg2:       #161616;
  --bg3:       #1e1e1e;
  --border:    #2a2a2a;
  --border2:   #3a3a3a;
  --red:       #B71C1C;
  --red-light: #ef5350;   /* small red text: 5.6:1 on --bg, where --red is only 2.6:1 */
  --gold:      #FFD700;
  --text:      #f0f0f0;
  --text-dim:  #b0b0b0;
  --text-muted:#8a8a8a;   /* lightest grey that still reads at 13px (5.6:1) */
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --font:      'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif:'Playfair Display', Georgia, serif;
  color-scheme: dark;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
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); }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Navbar */
.navbar { background: var(--bg2); border-bottom: 1px solid var(--border); }
.nav-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 16px; height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em;
}
.nav-brand:hover { color: var(--text); }
.crown { width: 24px; height: 20px; background: url('/favicon.svg') center / contain no-repeat; }
.nav-link {
  color: var(--text-dim); font-size: 0.9rem; font-weight: 500; text-decoration: none;
  padding: 10px 12px; border-radius: var(--radius);
}
.nav-link:hover { background: var(--bg3); color: var(--text); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #0d0d0d 0%, #1a0000 60%, #0d0d0d 100%);
  border-bottom: 1px solid var(--border);
  padding: 56px 16px 48px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(183,28,28,0.10) 5px, transparent 5px);
  background-size: 50px 50px;
}
.hero-inner { position: relative; max-width: 700px; 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: 4px 14px;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; margin-bottom: 20px;
}
.hero-title {
  font-size: clamp(2.1rem, 6vw, 3.6rem); font-weight: 900;
  letter-spacing: -0.04em; line-height: 1.08; margin-bottom: 16px;
}
.hero-title em { display: block; color: var(--red-light); font-family: var(--font-serif); font-style: italic; font-weight: 700; letter-spacing: -0.02em; }
.hero-sub { font-size: 1.05rem; color: var(--text-dim); line-height: 1.7; }

/* Maker: form beside the live card */
.maker {
  flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 40px 16px 64px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start;
}
.form-card, .preview-col {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow);
}
.preview-col { position: sticky; top: 16px; }
h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em; }
.form-card h2 { margin-bottom: 20px; }

form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-group label, .label-row label {
  font-size: 0.8rem; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-group input, .form-group textarea {
  background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius);
  color: var(--text); font-family: var(--font); font-size: 16px; /* 16px stops iOS zooming in */
  padding: 11px 13px; width: 100%; min-height: 46px; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #6f6f6f; }
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--red-light); box-shadow: 0 0 0 3px rgba(239,83,80,0.2);
}
.form-group input[type="date"] { color-scheme: dark; }
.form-group textarea { resize: vertical; min-height: 150px; line-height: 1.55; }
.form-hint { font-size: 0.8rem; 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; }
.err { color: #ef9a9a; font-size: 0.9rem; min-height: 0; }
.err:empty { display: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; min-height: 44px; border-radius: var(--radius);
  font-family: var(--font); font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #d32f2f; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg3); }
.btn-lg { padding: 12px 26px; font-size: 1rem; }
.btn-inline {
  background: none; border: none; color: var(--red-light); cursor: pointer;
  font-family: var(--font); font-size: 0.85rem; font-weight: 600; text-decoration: underline;
  padding: 10px 4px; min-height: 44px;
}
.btn-inline:hover { color: var(--gold); }

/* Preview */
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sizes { display: inline-flex; background: var(--bg3); border: 1px solid var(--border2); border-radius: 999px; padding: 3px; }
.sizes button {
  background: none; border: none; color: var(--text-dim); font-family: var(--font);
  font-size: 0.88rem; font-weight: 600; padding: 8px 16px; min-height: 38px; border-radius: 999px; cursor: pointer;
}
.sizes button span { color: var(--text-muted); font-weight: 500; margin-left: 2px; }
.sizes button[aria-pressed="true"] { background: var(--red); color: #fff; }
.sizes button[aria-pressed="true"] span { color: rgba(255,255,255,0.75); }
.preview { position: relative; margin: 0 auto; width: 100%; }
.preview.is-story { max-width: min(100%, calc(72vh * 9 / 16)); }
.preview canvas {
  display: block; width: 100%; height: auto;
  border-radius: 12px; border: 1px solid var(--border);
}
.example-tag {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  background: rgba(13,13,13,0.85); border: 1px solid var(--border2); color: var(--text-dim);
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.actions #start-over { margin-left: auto; }
.need { margin-top: 10px; }
.status { font-size: 0.85rem; color: var(--text-dim); margin-top: 6px; }
.status:empty { display: none; }

/* Footer */
.site-footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 0.88rem;
}
.site-footer strong { color: var(--text-dim); }
.footer-sub { font-size: 0.8rem; margin-top: 6px; }

@media (max-width: 900px) {
  .maker { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 24px; }
  .preview-col { position: static; }
}
@media (max-width: 600px) {
  .hero { padding: 40px 16px 32px; }
  .form-card, .preview-col { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .actions .btn { flex: 1 1 100%; }
  .actions #start-over { margin: 0 auto; }
  .preview.is-story { max-width: min(100%, 360px); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
