/*
 * Styles for Birthday Facts. Scoped to this app only — never reference files
 * outside this folder.
 *
 * Design tokens match the home page (see the "Design language" section in the root
 * README): shadcn zinc scale, 0.625rem base radius, system-ui font stack,
 * indigo→purple brand gradient. Copy this block as-is to stay visually consistent.
 */


:root {
  --background: #ffffff;
  --foreground: #09090b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --border: #e4e4e7;
  --ring: #a1a1aa;
  --radius: 0.625rem;
  --brand-from: #6366f1;
  --brand-to: #a855f7;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
}

:root[data-theme='dark'] {
  --background: #09090b;
  --foreground: #fafafa;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --secondary: #27272a;
  --secondary-foreground: #fafafa;
  --muted-foreground: #a1a1aa;
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --border: #27272a;
  --ring: #d4d4d8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  display: grid;
  place-items: center;
  -webkit-font-smoothing: antialiased;
  transition: background-color 200ms ease, color 200ms ease;
}

::selection { background: var(--primary); color: var(--primary-foreground); }

/*
 * The scaffold's body is grid + place-items:center, which suits a single centred card.
 * This app lays out a whole page, so it goes back to block — and place-items MUST be
 * reset alongside it: modern Chromium applies justify-items to block containers too, so
 * changing only `display` leaves children shrink-wrapped and centred, and the page
 * mysteriously collapses to a narrow strip.
 */
body { display: block; place-items: normal; }

.app { max-width: 620px; margin: 0 auto; padding: 64px 16px 48px; }

h1 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.sub { font-size: 13px; color: var(--muted-foreground); margin-bottom: 24px; }

/* ---------- inputs ---------- */

.inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.field {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field > span { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted-foreground); }
.field input, .field select {
  font: inherit;
  font-size: 15px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
}
.field--date input { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.field input:focus-visible, .field select:focus-visible { outline: none; border-color: var(--ring); }

/* ---------- hero ---------- */

.hero {
  padding: 24px 22px;
  border-radius: 1rem;
  background: var(--secondary);
  text-align: center;
  margin-bottom: 18px;
}
.hero__label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-foreground); }
.hero__value {
  margin: 6px 0 4px;
  font-size: 60px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background-image: linear-gradient(to right, var(--brand-from), var(--brand-to));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}
.hero__sub { font-size: 14px; }
.hero__note { font-size: 12px; color: var(--muted-foreground); margin-top: 8px; }

/* ---------- fact cards ---------- */

.cards { display: grid; gap: 14px; margin-bottom: 18px; }
@media (min-width: 620px) { .cards { grid-template-columns: 1fr 1fr; } }

.card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  align-self: start;
}
.card__head {
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}
.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row__name { color: var(--muted-foreground); font-size: 13px; flex-shrink: 0; }
.row__value { text-align: right; overflow-wrap: anywhere; }
.row__hint { display: block; font-size: 11px; color: var(--muted-foreground); }

/* ---------- on this day ---------- */

.history {
  border: 1px solid var(--border);
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 14px;
}
.history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}
.history__head h2 { font-size: 13px; font-weight: 600; }

.segmented {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.segmented button {
  font: inherit;
  font-size: 12px;
  padding: 4px 11px;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}
.segmented button:hover { color: var(--foreground); }
.segmented button.is-active { background: var(--primary); color: var(--primary-foreground); }

.events { list-style: none; margin: 0; padding: 0; }
.event {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 4px 12px;
  padding: 11px 16px;
  font-size: 14px;
  line-height: 1.55;
  border-bottom: 1px solid var(--border);
}
.event:last-child { border-bottom: none; }
.event__year {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted-foreground);
  font-size: 13px;
}
.event__text { overflow-wrap: anywhere; }
.event__link {
  grid-column: 2;
  font-size: 11px;
  color: var(--muted-foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
  justify-self: start;
}
.event__link:hover { color: var(--foreground); }

.note { padding: 14px 16px; font-size: 13px; color: var(--muted-foreground); line-height: 1.6; }
.note--error { color: var(--foreground); }

.link-btn {
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  margin-left: 4px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--secondary-foreground);
  cursor: pointer;
}
.link-btn:hover { background: var(--accent); border-color: var(--ring); }

/* ---------- caveats ---------- */

.notice {
  display: flex;
  gap: 9px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, #f59e0b 35%, var(--border));
  background: color-mix(in srgb, #f59e0b 8%, transparent);
  font-size: 12px;
  line-height: 1.55;
  color: var(--foreground);
}
.notice svg { flex-shrink: 0; color: #f59e0b; margin-top: 1px; }

/* Back to home: same spot (top-left) and same look in every app — see README */
.back-home {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 13px 7px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow-sm);
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.back-home:hover { background: var(--accent); color: var(--accent-foreground); }
