:root {
  color-scheme: dark;
  --ink: #101b17;
  --panel: #1a2923;
  --line: #43574d;
  --cream: #f6f1e4;
  --dim: #c2cec3;
  --gold: #edcf98;
  --edge: clamp(14px, 4vw, 64px);
  font: 1rem system-ui, sans-serif;
  color: var(--cream);
  background: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: inherit; }
button, input { font: inherit; }
button, .upload { cursor: pointer; }
:focus-visible, .upload:has(+ input:focus-visible) {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.masthead, footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px var(--edge);
}
.masthead { min-height: 64px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  min-height: 44px;
  font-size: clamp(.75rem, 2.2vw, 1rem);
  font-weight: 750;
  letter-spacing: .16em;
  text-decoration: none;
}
.wordmark em { font: italic 1.35em Georgia, serif; letter-spacing: 0; color: var(--gold); }
.masthead-cta { display: flex; align-items: center; gap: 6px; min-height: 44px; font-size: .85rem; text-decoration: none; }
.masthead-cta span { color: var(--gold); }

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: clamp(380px, 57svh, 650px);
  overflow: hidden;
}
.hero > img, .hero::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero > img { object-fit: cover; object-position: 60% 58%; z-index: -2; }
.hero::after { content: ""; z-index: -1; background: linear-gradient(90deg, #091712e8, #0917128c 39%, transparent 82%); }
.hero-copy { width: 100%; max-width: 1600px; margin: auto; padding: 48px var(--edge); }
.eyebrow { color: var(--gold); font-size: .73rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 750; margin: 0 0 12px; }
h1, h2 { font: 400 clamp(3.2rem, 7.5vw, 7.6rem)/.96 Georgia, serif; letter-spacing: -.06em; margin: 0; }
h1 em { color: var(--gold); }
h2 { font-size: clamp(2.55rem, 5vw, 4.8rem); }
.hero-intro { max-width: 33ch; line-height: 1.5; margin: 17px 0 22px; }

.button, .motion, .compare button, .options button, .editor-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 12px;
  color: inherit;
  background: transparent;
  font-weight: 650;
  font-size: .88rem;
  text-align: center;
  text-decoration: none;
}
.primary, .compare button[aria-pressed=true], .motion[aria-pressed=true] {
  background: var(--gold);
  color: #17231d;
  border-color: var(--gold);
}
button:disabled { opacity: .48; cursor: default; }
@media (hover: hover) {
  button:hover:not(:disabled), .button:hover { filter: brightness(1.13); }
}

.studio { max-width: 1600px; margin: auto; padding: clamp(26px, 4vw, 56px) var(--edge) 48px; scroll-margin-top: 12px; }
.studio-heading, .photo-tools, .photo-actions, .preview-heading, .preview-footer, .editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.studio-heading { margin-bottom: 19px; }
.studio-heading > p { max-width: 36ch; margin: 0; color: var(--dim); line-height: 1.5; }
.photo-tools { padding: 10px 14px; background: #17251f; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 12px; }
.photo-tools > div:first-child { min-width: 0; }
.source { font-size: .88rem; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.privacy { color: var(--dim); font-size: .76rem; margin: 3px 0 0; }
.photo-actions { flex-wrap: wrap; justify-content: end; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 375px); gap: 15px; align-items: start; }
.preview, .controls { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.preview { position: sticky; top: 8px; z-index: 2; scroll-margin-top: 8px; box-shadow: 0 10px 24px #07100a55; }
.preview-heading, .preview-footer { padding: 5px 9px; }
.preview-footer p { margin: 0; color: var(--dim); font-size: .78rem; line-height: 1.25; }
.motion { flex-shrink: 0; border-color: transparent; padding-inline: 8px; font-size: .8rem; }
#canvas-edit { border-color: var(--line); }
.picture { display: grid; place-items: center; background: #0c1511; min-height: 115px; }
canvas { display: block; max-width: 100%; max-height: min(65svh, 720px); width: auto; height: auto; cursor: grab; touch-action: pan-y pinch-zoom; }
canvas.editing { touch-action: none; }
canvas.drawing { cursor: crosshair; }
canvas:active:not(.drawing) { cursor: grabbing; }
.compare { display: flex; flex-wrap: wrap; gap: 3px; }
.compare button { padding-inline: 11px; }
.preview-heading .compare button:not([aria-pressed=true]) { border-color: transparent; }

.editor-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 8px; background: #14211b; border-radius: 13px 13px 0 0; }
.editor-nav button { border-color: transparent; color: var(--dim); }
.editor-nav button[aria-pressed=true] { color: var(--gold); border-color: var(--line); background: var(--panel); }
.editor-panel { display: grid; gap: 16px; padding: 15px; }
fieldset { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
legend { margin-bottom: 8px; padding: 0; font-size: .9rem; font-weight: 750; }
.options { display: flex; gap: 6px; flex-wrap: wrap; }
.options button[aria-pressed=true], .look[aria-pressed=true] { color: var(--cream); background: #edcf981c; border-color: var(--gold); }
#shapes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
#shapes button { flex-direction: column; gap: 6px; min-height: 62px; padding: 5px 2px; font-size: .76rem; }
#shapes button[data-shape=custom] { grid-column: 1 / -1; flex-direction: row; min-height: 44px; }
#shapes button::before { content: ""; display: block; width: 26px; height: 14px; border: 1px solid currentColor; background: #7ac4b030; border-radius: 3px; }
#shapes button[data-shape=lap]::before { height: 8px; }
#shapes button[data-shape=round]::before { border-radius: 50%; }
#shapes button[data-shape=lagoon]::before { border-radius: 32% 66% 31% 63% / 70% 40% 66% 35%; transform: rotate(-12deg); }
#shapes button[data-shape=custom]::before { border-style: dashed; border-radius: 50%; width: 16px; }

.looks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.look { display: grid; justify-items: start; gap: 5px; min-height: 86px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: #14211c; color: inherit; text-align: left; }
.swatch { display: flex; border-radius: 5px; overflow: hidden; }
.swatch i { width: 20px; height: 12px; }
.t-day { background: #bfe0f2; }
.t-golden { background: linear-gradient(#f3b866, #d9744a); }
.t-night { background: linear-gradient(#263452, #496281); }
.look-name { font-weight: 720; font-size: .82rem; }
.look-note, .hint { font-size: .75rem; color: var(--dim); line-height: 1.35; }
.hint { margin: 8px 0 0; }
.slider { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 650; }
input[type=range] { width: 100%; margin: -12px 0 0; min-height: 44px; accent-color: var(--gold); }
.reset { justify-self: start; }
.editor-footer { border-top: 1px solid var(--line); padding: 10px 14px; background: #14211b; border-radius: 0 0 13px 13px; }
.editor-footer p, footer { color: var(--dim); font-size: .8rem; }
footer { border-top: 1px solid var(--line); }
footer a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 4px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  canvas { max-height: min(31svh, 380px); }
  .editor-panel { padding: 13px; }
  .controls :is(button, input) { scroll-margin-top: calc(31svh + 120px); }
}
@media (max-width: 620px) {
  .hero { min-height: clamp(355px, 61svh, 480px); align-items: end; }
  .hero-copy { padding-block: 40px 25px; }
  .hero::after { background: linear-gradient(0deg, #091712fa, #09171294 52%, transparent 100%); }
  h1 { font-size: clamp(2.8rem, 11vw, 4.55rem); }
  .studio-heading { flex-direction: column; align-items: start; }
  .studio-heading > p { font-size: .9rem; }
  .photo-tools { padding-inline: 9px; }
  .photo-actions .button { font-size: .78rem; padding-inline: 7px; }
  .photo-actions { gap: 5px; }
}
@media (max-height: 540px) and (max-width: 900px) {
  .preview { position: static; }
  canvas { max-height: 62svh; }
  .controls :is(button, input) { scroll-margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

#redraw { margin-top: 8px; }
@media (pointer: coarse) {
  canvas:not(.editing) { cursor: default; }
}
