/* lumen. One theme, light: warm off-white and white, deep plum text, a rose
   accent. The frame right around the photo stays neutral grey, so the looks
   are judged against no tint. System fonts only; the page makes no request
   to anyone but itself. Contrast (WCAG) is noted beside each pair. */

:root {
  color-scheme: light;
  --bg: #fbf7f5;
  --surface: #ffffff;
  --surface-raised: #f6ecea;
  --border: #e8dad5; /* decorative dividers only */
  --border-strong: #968079; /* control outlines: 3.5:1 on --bg, 3.7:1 on --surface */
  --text: #2b1f24; /* 14.9:1 on --bg */
  --muted: #6b5960; /* 6.1:1 on --bg, 5.6:1 on --surface-raised, 5.4:1 on --stage */
  --accent: #c03a66; /* rose; 4.9:1 on --bg */
  --accent-strong: #9c2c52; /* hover, links: 6.8:1 on --bg */
  --accent-soft: #fce7ee; /* --accent-strong on it: 6.2:1 */
  --on-accent: #ffffff; /* 5.2:1 on --accent, 7.3:1 on --accent-strong */
  --stage: #ebeae9; /* neutral, untinted */
  --danger: #b42318; /* 5.8:1 on --danger-soft */
  --danger-soft: #fdecea;
  --focus: #c03a66;
  --radius: 14px;
  --radius-sm: 10px;
  --control: 2.75rem; /* 44px touch target */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
body.dragging main { outline: 2px dashed var(--accent); outline-offset: -0.75rem; border-radius: var(--radius); }

a { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 0.5rem; z-index: 10; padding: 0.5rem 0.75rem; background: var(--surface-raised); border-radius: var(--radius-sm); }
.skip:focus { left: 0.5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

header.site, footer.site, main { width: min(100%, 72rem); margin-inline: auto; padding-inline: 1rem; }
header.site { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; padding-block: 1rem; }
.wordmark { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text); text-decoration: none; font: 600 1.5rem/1 var(--font-display); letter-spacing: -0.02em; min-height: var(--control); }
.wordmark .dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd9cc, #e8829f 55%, var(--accent)); }
.tagline { margin: 0; color: var(--muted); font-size: 0.875rem; }

main { flex: 1; padding-block: 1rem 2rem; }

/* Start */
.start { max-width: 40rem; margin: clamp(2rem, 10vh, 6rem) auto; text-align: center; }
.start h1 { margin: 0 0 1rem; font: 500 clamp(2.25rem, 1.5rem + 3.5vw, 3.75rem)/1.08 var(--font-display); letter-spacing: -0.03em; text-wrap: balance; }
.lead { margin: 0 auto 2rem; max-width: 32rem; color: var(--muted); font-size: 1.125rem; text-wrap: pretty; }
.hint { margin: 1rem 0 0; color: var(--muted); font-size: 0.875rem; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--control); padding: 0.5rem 1.1rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: 600 1rem/1.2 var(--font); cursor: pointer; text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.button.secondary:hover { background: #f9d6e2; }
.button.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.button.ghost:hover { background: var(--surface-raised); }
.button.ghost[aria-pressed="true"] { background: var(--surface-raised); border-color: var(--text); }
.button.big { min-height: 3.25rem; padding-inline: 1.75rem; font-size: 1.125rem; }
.button:disabled { opacity: 0.5; cursor: default; }
input[type="file"]:focus-visible + .hint, .start label:has(+ input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Editor */
.editor { display: grid; gap: 1rem; }
@media (min-width: 60rem) {
  .editor { grid-template-columns: minmax(0, 1fr) 24rem; align-items: start; }
}
.stage { margin: 0; display: grid; place-items: center; gap: 0.5rem; padding: 0.75rem; background: var(--stage); border-radius: var(--radius); min-height: 12rem; }
#view { display: block; max-width: 100%; max-height: min(70dvh, 52rem); width: auto; height: auto; border-radius: 4px; }
.status { color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; min-height: 1.2em; }

.controls { display: grid; gap: 1rem; min-width: 0; }

/* Looks: a strip that scrolls inside itself on phones, a grid beside the photo on wide screens. */
.presets {
  display: grid; grid-auto-flow: column; grid-auto-columns: 5.25rem; gap: 0.5rem;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
  padding: 0.4rem 0.4rem 0.6rem; margin-inline: -0.4rem;
}
@media (min-width: 60rem) {
  .presets { grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); grid-auto-columns: auto; overflow: visible; }
}
.preset {
  display: grid; gap: 0.35rem; padding: 0.3rem; scroll-snap-align: start;
  background: var(--surface); color: var(--muted); border: 2px solid var(--border); border-radius: var(--radius-sm);
  font: 500 0.8125rem/1.2 var(--font); cursor: pointer; text-align: center;
}
.preset:hover { background: var(--surface-raised); color: var(--text); }
.preset canvas { display: block; width: 100%; aspect-ratio: 1; border-radius: 6px; background: var(--surface-raised); }
.preset span { padding-bottom: 0.15rem; overflow-wrap: anywhere; }
.preset[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }

.strength { display: grid; grid-template-columns: auto 1fr 3.25rem; align-items: center; gap: 0.75rem; min-height: var(--control); color: var(--muted); font-size: 0.875rem; }
.strength output { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.strength input { width: 100%; min-height: var(--control); accent-color: var(--accent); }

.enhance { display: grid; gap: 0.4rem; padding: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.enhance .note { margin: 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.45; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.actions .primary { flex: 1 1 100%; order: -1; }
@media (min-width: 30rem) { .actions .primary { flex-basis: auto; order: 0; margin-left: auto; } }
#compare { -webkit-touch-callout: none; }

.error { max-width: 40rem; margin: 1rem auto 0; padding: 0.75rem 1rem; color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); text-align: center; }

footer.site { padding-block: 1.5rem 2rem; color: var(--muted); font-size: 0.875rem; border-top: 1px solid var(--border); }
footer.site p { margin: 0.25rem 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
