/* Ai fitting room — editorial layout matching the design mock */

:root {
  --black: #000;
  --white: #fff;
  --paper: #fafafa;
  --ink: #111;
  --muted: #666;

  /* Tony spec: Bodoni 72 + Optima (Apple system fonts), with web fallbacks */
  --serif: "Bodoni 72", "Bodoni Moda", Bodoni, "Didot", "Times New Roman", serif;
  --sans:  "Optima", "Optima Nova", "Avenir Next", "Avenir", "Lato",
           -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--serif); font-size: 18px; line-height: 1.4; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
em { font-style: italic; }
[hidden] { display: none !important; }

/* ============================================================
   HERO  — desktop: face left, brand+examples stacked right
           mobile: brand top, face left, examples right
   ============================================================ */
.hero {
  padding: 48px 64px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "face brand"
    "face examples";
  gap: 24px 48px;
  align-items: start;
}

/* ----- brand wordmark ----- */
.brand-block {
  grid-area: brand;
  text-align: right;
  align-self: start;
}
.brand {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 7vw, 96px);
  letter-spacing: -0.01em;
  line-height: 0.95;
}
.brand-ai { font-style: normal; }
.brand-rest { display: inline-block; }
.brand-byline {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.brand-byline:hover { color: var(--ink); }

/* ----- face upload ----- */
.face-block {
  grid-area: face;
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
}
.upload-box {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 4 / 5;
  border: 2px dashed var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  background: var(--white);
  overflow: hidden;
}
.upload-box:hover { background: #f1f1f1; }
.upload-box.has-face { border-style: solid; }
.upload-box.drag-over { background: #e9e9e9; border-color: var(--ink); }
.upload-box input[type="file"] { display: none !important; }

/* X button to clear an uploaded/selected face */
.clear-face {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: var(--white);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}
.clear-face:hover { background: rgba(0, 0, 0, 0.85); }
.upload-box.has-face .clear-face { display: flex; }
.upload-prompt {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}
#facePreview { width: 100%; height: 100%; object-fit: cover; }
.box-caption {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}
.upload-box.has-face .box-caption,
.upload-box.has-face .upload-prompt { display: none; }

/* ----- examples ----- */
.examples {
  grid-area: examples;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.example-thumbs { display: flex; gap: 12px; }
.example-face {
  border: 2px solid transparent;
  background: none;
  padding: 0;
  width: 96px;
  height: 96px;
  overflow: hidden;
}
.example-face img { width: 100%; height: 100%; object-fit: cover; }
.example-face.selected { border-color: var(--ink); }
.examples-label {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ============================================================
   CLOTHING — single horizontal row of 6
   ============================================================ */
.clothing-section { padding: 16px 64px; }
.step-label {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
}
.clothing-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.clothing-tile {
  border: 3px solid transparent;
  background: none;
  padding: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}
.clothing-tile img { width: 100%; height: 100%; object-fit: cover; }
.clothing-tile.selected { border-color: var(--ink); }

/* ============================================================
   GENERATE bar
   ============================================================ */
.generate-bar {
  padding: 24px 64px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}
#generateBtn {
  background: var(--white);
  border: 1.5px solid var(--ink);
  color: var(--ink);
  padding: 10px 36px;
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0.01em;
}
#generateBtn:not(:disabled):hover { background: var(--ink); color: var(--white); }
#generateBtn:disabled { opacity: 0.4; cursor: not-allowed; }
.status { margin: 0; font-size: 13px; color: var(--muted); font-family: var(--sans); }

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee {
  background: var(--black);
  color: var(--white);
  padding: 14px 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.marquee-track {
  display: inline-flex;
  animation: scroll 60s linear infinite;
  will-change: transform;
}
.marquee-track > span { padding-right: 40px; }
@keyframes scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============================================================
   OUTPUT — dashed box (left) + lorem copy (right)
   ============================================================ */
.output-section {
  padding: 40px 64px 64px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.output-frame { display: flex; justify-content: flex-start; }
.output-box {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 4 / 5;
  border: 2px dashed var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  overflow: hidden;
  position: relative;
}
.output-box.has-result { border-style: solid; }
.output-box img { width: 100%; height: 100%; object-fit: cover; }
.output-placeholder {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
}
.output-box.has-result .output-placeholder,
.output-box.has-result .box-caption { display: none; }

.output-copy p {
  margin: 0 0 1.2em;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
}

/* loading spinner */
.output-box.loading::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 2px solid #ddd;
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  position: absolute;
}
.output-box.loading .output-placeholder,
.output-box.loading .box-caption { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MOBILE — brand spans top, then face | examples
   ============================================================ */
@media (max-width: 760px) {
  .hero {
    padding: 24px 24px 16px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "examples"
      "face";
    gap: 12px;
  }
  .brand-block { text-align: left; }
  .brand { font-size: clamp(40px, 14vw, 64px); }
  .examples { align-items: flex-start; }
  .face-block { justify-content: center; }
  .upload-box {
    width: 100%;
    max-width: 260px;
    aspect-ratio: 4 / 5;
  }
  .example-face { width: 72px; height: 72px; }
  .example-thumbs { gap: 8px; }

  .clothing-section { padding: 12px 24px; }
  .clothing-row { grid-template-columns: repeat(3, 1fr); }

  .generate-bar { padding: 20px 24px 24px; }

  .output-section {
    padding: 24px 24px 56px;
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .output-box { max-width: 100%; aspect-ratio: 3 / 4; }
}
