@font-face {
  font-family: "Instrument Serif";
  src: url("./assets/instrument-serif.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("./assets/instrument-serif-italic.woff2") format("woff2");
  font-display: swap;
  font-style: italic;
}

:root {
  color-scheme: light;
  --paper: #faf6ef;
  --ink: #281c1a;
  --muted: #685956;
  --accent: #7d3c4b;
  --line: #e4d7cb;
  --surface: #fffaf4;
  --focus: #86465a;
  font: 16px/1.5 "Instrument Sans", "Aptos", "Segoe UI", sans-serif;
}

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

body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner {
  max-width: 1224px;
  margin: 0 auto;
  padding-inline: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.masthead-inner { min-height: 73px; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 27px;
  line-height: 1;
}
.wordmark-studio { font-style: italic; color: var(--accent); }
.brand-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  margin-right: 4px;
  border: 1px solid #d8bcc0;
  border-radius: 50%;
  background: #f3e5e6;
}
.brand-icon span {
  width: 11px;
  height: 17px;
  transform: rotate(-25deg);
  border-radius: 7px 7px 5px 5px;
  background: linear-gradient(140deg, #d992a0, #8c4354 68%);
  box-shadow: inset 2px 1px 0 #f4bac2;
}
.stage-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.stage-label span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.studio {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) 28px clamp(52px, 8vw, 105px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "intro preview" "looks preview" "save preview";
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(42px, 8vw, 104px);
  row-gap: 26px;
  align-items: start;
}

.intro { grid-area: intro; padding-top: 22px; }
.intro h1 {
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(72px, 8vw, 116px);
  font-weight: 400;
  letter-spacing: -.033em;
  line-height: .86;
}
.intro h1 em { color: var(--accent); font-weight: 400; }
.intro p {
  max-width: 35ch;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.preview {
  grid-area: preview;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 18px 70px -40px #5f302b66;
  padding: 12px;
}
.preview-top, .preview-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
}
.preview-top { min-height: 31px; padding-bottom: 9px; }
.preview-footer { min-height: 39px; padding-top: 8px; }
.preview-top h2 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 650; }
.photo-label { white-space: nowrap; }

.photo-stage {
  --split: 48%;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 12px;
  aspect-ratio: 1122 / 1402;
  background: #46515d;
}
.photo-stage img, .photo-stage canvas, .compare-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.photo-stage img { display: block; }
.photo-stage canvas { clip-path: inset(0 0 0 var(--split)); }
.compare-input {
  z-index: 3;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  touch-action: pan-y;
}
.compare-input:disabled { cursor: default; }
.photo-stage:focus-within { outline: 2px solid var(--focus); outline-offset: 4px; }
.photo-tag {
  pointer-events: none;
  position: absolute;
  top: 14px;
  padding: 4px 9px;
  border-radius: 4px;
  background: #241b1bd9;
  color: #fffaf4;
  font-weight: 600;
  font-size: 11px;
}
.original-tag { left: 14px; }
.result-tag { right: 14px; }
.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 1px;
  transform: translateX(-50%);
  background: #fffaf4;
  pointer-events: none;
}
.handle {
  position: absolute;
  top: 54%;
  left: clamp(21px, var(--split), calc(100% - 21px));
  translate: -50% -50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid #dec9bf;
  border-radius: 50%;
  box-shadow: 0 2px 14px #241b1b45;
  pointer-events: none;
}
.handle i {
  width: 6px;
  height: 6px;
  border-bottom: 1.5px solid var(--ink);
  border-left: 1.5px solid var(--ink);
  transform: rotate(45deg);
}
.handle i + i { transform: rotate(225deg); }
.text-button {
  border: 0;
  min-height: 32px;
  padding: 4px 1px;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.look-controls { grid-area: looks; max-width: 386px; }
.save-controls { grid-area: save; }
.look-controls h2 { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
.looks { display: grid; gap: 9px; }
.look {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 10px 15px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  text-align: left;
  color: var(--ink);
}
.look:hover { border-color: #ba8d94; }
.look[aria-pressed="true"] { border-color: #a96a75; background: #f6e9e6; }
.swatch {
  flex: 0 0 38px;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid #392b2526;
  box-shadow: inset 1px 1px 5px #fffbf863;
}
.swatch-teal { background: linear-gradient(138deg, #163239 18%, #4d909a 51%, #1d454e 77%); }
.swatch-rose { background: linear-gradient(136deg, #92575e, #e9b8b8 47%, #ba8285 75%); }
.look-text { display: grid; }
.look-text strong { font-size: 14px; }
.look-text span { color: var(--muted); font-size: 12px; }
.selection {
  margin-left: auto;
  flex: 0 0 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #ab9791;
}
.look[aria-pressed="true"] .selection { border-color: var(--accent); }
.look[aria-pressed="true"] .selection::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.save-button {
  display: inline-flex;
  min-height: 46px;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 9px 17px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface);
  font-size: 13px;
  font-weight: 650;
}
.save-button:hover { background: #492d31; }
.save-button:disabled { opacity: .65; }
.download-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  position: relative;
  border-bottom: 1px solid currentColor;
}
.download-icon::before, .download-icon::after { content: ""; position: absolute; }
.download-icon::before { width: 1px; height: 8px; background: currentColor; left: 6px; top: 0; }
.download-icon::after {
  border: solid currentColor;
  border-width: 0 1px 1px 0;
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  top: 4px;
  left: 4px;
}
.error { color: #7a263c; margin: 12px 0 0; font-size: 13px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .masthead-inner { padding-inline: 18px; }
  .masthead-inner { min-height: 59px; }
  .wordmark { font-size: 23px; }
  .stage-label { font-size: 11px; }
  .studio {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "looks" "preview" "save";
    grid-template-rows: auto;
    gap: 18px;
    max-width: 540px;
    padding: 37px 18px 52px;
  }
  .intro { padding-top: 0; }
  .intro h1 { font-size: clamp(56px, 13vw, 84px); line-height: .92; }
  .wide-break { display: none; }
  .intro p { margin-top: 14px; font-size: 14px; }
  .preview { padding: 8px; border-radius: 15px; }
  .photo-stage { border-radius: 9px; }
  .look-controls { max-width: none; }
  .look-controls h2 { margin-bottom: 8px; }
  .looks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .look { min-height: 52px; gap: 7px; padding: 6px 9px; }
  .swatch { flex-basis: 27px; border-radius: 6px; }
  .look-text strong { font-size: 12px; }
  .look-text span { display: none; }
  .selection { flex-basis: 12px; height: 12px; }
  .look[aria-pressed="true"] .selection::after { width: 6px; height: 6px; }
  .save-button { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .look, .save-button { transition: background-color 140ms ease, border-color 140ms ease; }
}
