/* LAGOS 2026 Profile Frame Generator: public page styles. Tokens live in brand.css. */
html, body { min-height: 100%; }
.page {
  max-width: 480px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 16px 28px;
  display: grid;
  gap: 16px;
}

/* Header */
.brand { display: flex; align-items: center; padding-block: 4px; }
.logo-img { display: block; height: 52px; width: auto; }
.intro h1 {
  margin: 0;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(28px, 8vw, 34px); line-height: 1.05;
  color: var(--ink); text-wrap: balance;
}
.intro h1 span { color: var(--blue); }
.intro p { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; }

/* Editor */
.editor-wrap { display: grid; gap: 10px; }
.stage {
  position: relative;
  width: 100%; max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 1px 0 var(--line), 0 12px 32px -18px rgba(43,70,148,.55);
  touch-action: none;
  user-select: none;
  outline: none;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage.has-photo { cursor: grab; }
.stage.dragging { cursor: grabbing; }
.stage:focus-visible { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--blue); }
.stage.drop-hover::after {
  content: ""; position: absolute; inset: 10px; border-radius: 16px;
  border: 3px dashed var(--blue); background: rgba(43,70,148,.08);
}

.empty {
  position: absolute; left: 50%; top: 47.6%; transform: translate(-50%, -50%);
  width: 62%; aspect-ratio: 1/1; border-radius: 50%;
  display: grid; place-content: center; justify-items: center; gap: 10px;
  border: 0; background: none; font: inherit; color: var(--ink);
  cursor: pointer; padding: 16px;
}
.empty-icon {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--sky); border: 2px dashed var(--blue);
  display: grid; place-items: center; color: var(--blue);
  transition: transform .2s ease;
}
.empty:hover .empty-icon, .empty:focus-visible .empty-icon { transform: scale(1.06); }
.empty:focus-visible { outline: none; }
.empty:focus-visible .empty-icon { outline: 3px solid var(--blue); outline-offset: 4px; }
.empty-title { font-weight: 700; font-size: 16px; }
.empty-sub { font-size: 12px; color: var(--ink-soft); margin-top: -6px; }

.hint {
  margin: 0; text-align: center; font-size: 13px; font-weight: 500; color: var(--ink-soft);
  min-height: 1.5em;
}
.hint .dot { color: var(--yellow-deep); margin: 0 6px; }

/* Zoom */
.zoom { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px; flex: none;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--white); color: var(--blue);
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s, border-color .15s; touch-action: manipulation;
}
.icon-btn:hover { border-color: var(--blue); }
.icon-btn:active { background: var(--sky); }
.icon-btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.icon-btn:disabled { color: #AEB6CC; border-color: var(--line); cursor: default; }
.reset { margin-left: 4px; }

input[type="range"] {
  flex: 1; min-width: 0; height: 44px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
  --fill: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 99px;
  background: linear-gradient(to right, var(--blue) var(--fill), var(--line) var(--fill));
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--blue); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px;
  border-radius: 50%; background: var(--white); border: 3px solid var(--blue);
  box-shadow: 0 2px 6px rgba(43,70,148,.35);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--white);
  border: 3px solid var(--blue); box-shadow: 0 2px 6px rgba(43,70,148,.35);
}
input[type="range"]:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
input[type="range"]:disabled { cursor: default; opacity: .45; }

/* Buttons */
.actions { display: grid; gap: 10px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 56px; padding: 0 20px;
  border-radius: 16px; border: 0;
  font-family: var(--body); font-weight: 700; font-size: 19px; letter-spacing: .005em;
  cursor: pointer; transition: background .15s, transform .1s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.btn-primary { background: var(--blue); color: var(--white); }
.btn-primary:hover { background: var(--blue-deep); }
.btn-download { background: var(--yellow); color: var(--blue); box-shadow: 0 10px 22px -12px rgba(200,160,20,.9); }
.btn-download:hover { background: var(--yellow-deep); }
.btn-secondary {
  background: var(--white); color: var(--blue); border: 1.5px solid var(--line);
  min-height: 50px; font-size: 16px;
}
.btn-secondary:hover { border-color: var(--blue); }

.privacy {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); text-align: center;
}
.privacy svg { flex: none; color: var(--blue); }
.foot { margin: 0; text-align: center; font-size: 11px; color: #8A98A3; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }

.error {
  margin: 0; padding: 10px 12px; border-radius: 12px;
  background: #FBECEC; color: var(--red); font-size: 13px; font-weight: 500;
}

/* Result sheet */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(24, 40, 52, .45);
  display: grid; align-items: end; justify-items: center;
  animation: fade .2s ease;
}
.sheet {
  grid-auto-rows: max-content;
  width: 100%; max-width: 480px;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 14px;
  animation: rise .28s cubic-bezier(.2,.8,.2,1);
  max-height: 100%; overflow-y: auto;
}
.grabber { width: 40px; height: 5px; border-radius: 99px; background: var(--line); justify-self: center; }
.sheet h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.1; text-align: center; }
.sheet h2 span { color: var(--red); }
.result {
  width: min(100%, 320px, 36dvh); justify-self: center; aspect-ratio: 1/1; max-width: 100%;
  border-radius: 18px; overflow: hidden; background: var(--sky);
  box-shadow: 0 10px 26px -16px rgba(43,70,148,.7);
}
.result img { width: 100%; height: 100%; display: block; -webkit-touch-callout: default; }
.sheet-status { margin: -4px 0 0; text-align: center; font-size: 13px; font-weight: 600; color: var(--blue); min-height: 0; }
.sheet-status:empty { display: none; }
.sheet-status.bad { color: var(--red); }
.sheet-note { margin: -4px 0 0; text-align: center; font-size: 12.5px; color: var(--ink-soft); }
.sheet-meta { margin: -8px 0 0; text-align: center; font-size: 11.5px; color: #8A98A3; font-variant-numeric: tabular-nums; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

/* ---------- Phones & tablets (portrait) ---------- */
@media (max-width: 899px) {
  /* flatten .side so the intro can sit above the editor and the action bar can stick page-wide */
  .page { gap: 14px; }
  .side { display: contents; }
  .brand { order: 0; } .intro { order: 1; } .editor-wrap { order: 2; }
  .zoom { order: 3; } .error { order: 4; } #changeBtn { order: 5; }
  /* the one action that matters stays in thumb reach */
  .actions {
    order: 6;
    position: sticky; bottom: 0; z-index: 3;
    margin-inline: -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to bottom, rgba(243,245,251,0), var(--sky) 22%);
  }
  .privacy { order: 8; } .foot { order: 9; }
  /* once a photo is in, the intro has done its job: give the space to the editor */
  body.ready .intro { display: none; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .page { max-width: 560px; padding-block: 28px 0; }
  .logo-img { height: 60px; }
}

/* ---------- Phones in landscape (short screens) ---------- */
@media (max-width: 899px) and (orientation: landscape) and (max-height: 540px) {
  .page {
    max-width: 860px; padding-block: 12px;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "editor brand" "editor side";
    grid-template-rows: auto 1fr;
    column-gap: 24px; row-gap: 10px; align-items: start;
  }
  .brand { grid-area: brand; }
  .logo-img { height: 40px; }
  .editor-wrap { grid-area: editor; width: calc(100dvh - 24px - 30px); }
  .side { grid-area: side; display: grid; gap: 10px; align-content: start; }
  .editor-wrap, .brand { order: 0; }
  .intro h1 { font-size: 24px; }
  .actions { position: static; margin: 0; padding: 0; background: none; }
  .foot { display: none; }
  body.ready .intro { display: none; }
}

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  body { display: grid; place-items: center; }
  .page {
    max-width: 1040px;
    grid-template-columns: auto minmax(340px, 400px);
    grid-template-areas: "brand brand" "editor side";
    column-gap: 56px; row-gap: 24px; align-items: center; justify-content: center;
    padding-block: 32px;
  }
  .brand { grid-area: brand; }
  .logo-img { height: 60px; }
  .editor-wrap { grid-area: editor; width: clamp(360px, calc(100dvh - 190px), 560px); }
  .side { grid-area: side; display: grid; gap: 18px; align-content: center; }
  .intro h1 { font-size: 38px; }
  .intro p { font-size: 15px; }
  .privacy, .foot { justify-content: flex-start; text-align: left; }
  .sheet-backdrop { align-items: center; padding: 16px; }
  .sheet { border-radius: 24px; padding-top: 24px; padding-bottom: 22px; max-width: 440px; }
  .grabber { display: none; }
}


/* ---------- Facebook caption (secondary to the editor) ---------- */
.caption { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--white); border: 1.5px solid var(--line); text-align: left; }
.caption-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.caption-label { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.caption-toggle { border: 0; background: none; padding: 4px 0; font: 600 12.5px var(--body); color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.caption-text {
  margin: 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 13.5px; line-height: 1.55; color: var(--ink);
  max-height: 6.2em; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent);
}
.caption.open .caption-text { max-height: none; -webkit-mask-image: none; mask-image: none; }
.btn-copy { min-height: 50px; font-size: 16px; background: var(--blue-tint); color: var(--blue); }
.btn-copy:hover { background: #DCE3F3; }
.btn-copy.copied { background: var(--green-tint); color: var(--green-ok); }
.btn-copy .i-check { display: none; }
.btn-copy.copied .i-check { display: block; }
.btn-copy.copied .i-copy { display: none; }
@media (max-width: 899px) { #captionMain { order: 5; } }
.sheet .caption { background: var(--sky); border-color: transparent; }
