/* Album Designer — Anthony Ochoa Photography brand:
   ivory / warm neutrals, Cormorant Garamond headings, gold script accents,
   Poppins body. Desktop-first (Mac Studio + iPad). */
:root {
  --ivory: #f7f2ea;
  --ivory-2: #efe7d8;
  --paper: #fffdf8;
  --ink: #3e3222;
  --ink-soft: #6d5b3f;
  --gold: #b08d3e;
  --gold-bright: #c9a227;
  --line: #ddd2bf;
  --danger: #a33b2e;
  --ok: #3e6b35;
  --shadow: 0 10px 30px rgba(62, 50, 34, 0.14);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Poppins', system-ui, sans-serif;
  background: var(--ivory);
  color: var(--ink);
  font-size: 14px;
}
h1, h2, h3, .serif { font-family: 'Cormorant Garamond', Georgia, serif; }
.script { font-family: 'Pinyon Script', cursive; color: var(--gold); }
button {
  font-family: inherit; cursor: pointer; border: 1px solid var(--gold);
  background: var(--gold); color: #fff; border-radius: 999px;
  padding: 8px 18px; font-size: 13px; letter-spacing: 0.04em;
}
button:hover { background: #9a7a33; }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.ghost:hover { border-color: var(--gold); color: var(--gold); }
button.small { padding: 5px 12px; font-size: 12px; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: var(--danger); color: #fff; }
button:disabled { opacity: 0.45; cursor: default; }
input, select, textarea {
  font-family: inherit; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--paper); width: 100%;
}
input[type="color"] { padding: 2px; height: 34px; }
input[type="range"] { padding: 0; }
label { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 10px 0 4px; }
a { color: var(--gold); }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 36px 40px; width: 380px; max-width: 94vw; text-align: center; }
.auth-card h1 { font-size: 30px; margin: 4px 0 0; font-weight: 600; letter-spacing: 0.06em; }
.auth-card .script { font-size: 30px; display: block; margin-top: 2px; }
.auth-card form { text-align: left; margin-top: 14px; }
.auth-card button { width: 100%; margin-top: 16px; }
.err { color: var(--danger); font-size: 12.5px; min-height: 16px; margin-top: 8px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 12px 22px;
  background: var(--paper); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar .brand { font-family: 'Cormorant Garamond', serif; font-size: 21px; font-weight: 600; letter-spacing: 0.08em; }
.topbar .brand .script { font-size: 21px; letter-spacing: 0; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12px; color: var(--ink-soft); }

/* ---------- project list ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }
.page h2 { font-size: 30px; margin: 6px 0 2px; }
.subtle { color: var(--ink-soft); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 18px; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; cursor: pointer; box-shadow: 0 2px 8px rgba(62,50,34,0.05);
}
.card:hover { border-color: var(--gold); }
.card h3 { margin: 0 0 4px; font-size: 21px; }
.badge { display: inline-block; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); }
.badge.approved { border-color: var(--ok); color: var(--ok); }
.badge.shared { border-color: var(--gold); color: var(--gold); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }

/* ---------- editor layout ---------- */
.editor { display: grid; grid-template-columns: 168px 1fr 300px; gap: 14px; padding: 14px; align-items: start; }
.rail, .side { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.rail { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; }
.side { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; }
.rail-item { border: 2px solid transparent; border-radius: 10px; padding: 6px; margin-bottom: 8px; cursor: pointer; background: var(--ivory); }
.rail-item.active { border-color: var(--gold); }
.rail-item .mini { pointer-events: none; }
.rail-item .cap { font-size: 11px; color: var(--ink-soft); display: flex; justify-content: space-between; margin-top: 4px; }
.rail-item .flag { color: var(--danger); font-weight: 600; }
.stage { min-width: 0; }
.stage-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.stage-head .grow { flex: 1; }
.canvas-wrap { background: var(--ivory-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.canvas-wrap .spread, .canvas-wrap .cover { box-shadow: var(--shadow); margin: 0 auto; max-width: 100%; }

/* ---------- spread rendering (shared editor + proof) ---------- */
.spread, .cover { position: relative; overflow: hidden; border-radius: 4px; width: 100%; }
.frame { position: absolute; overflow: hidden; background: rgba(62,50,34,0.07); }
.frame.shape-rounded { border-radius: 14px; }
.frame.shape-arch { border-radius: 999px 999px 10px 10px; }
.frame.selected { outline: 3px solid var(--gold); outline-offset: -3px; z-index: 5; }
.frame.droptarget { outline: 3px dashed var(--gold-bright); outline-offset: -3px; }
.frame img.placed, .cover-front img.placed {
  position: absolute; max-width: none; max-height: none; user-select: none; -webkit-user-drag: none;
}
.frame-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 8px; font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft); pointer-events: none;
}
.script-layer {
  position: absolute; left: 5.5%; top: 30%; width: 40%; white-space: pre-line;
  font-family: 'Pinyon Script', cursive; color: rgba(138,109,59,0.34);
  line-height: 1.45; pointer-events: none;
}
.torn-band { position: absolute; inset: 0; pointer-events: none; }
.title-layer {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; pointer-events: none;
}
.title-names { font-family: 'Cormorant Garamond', serif; font-weight: 600; letter-spacing: 0.22em; color: #4a3b28; }
.title-amp { font-family: 'Pinyon Script', cursive; color: var(--gold); line-height: 1.15; }
.title-date { font-family: 'Cormorant Garamond', serif; letter-spacing: 0.27em; color: var(--ink-soft); }
.guides { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.guide-cut { position: absolute; border: 1px dashed rgba(163,59,46,0.65); }
.guide-safe { position: absolute; border: 1px dashed rgba(176,141,62,0.8); }

/* cover zones */
.cover-back, .cover-spine, .cover-front { position: absolute; top: 0; bottom: 0; overflow: hidden; }
.cover-back { left: 0; display: flex; align-items: center; justify-content: center; }
.cover-back-names { font-family: 'Pinyon Script', cursive; color: #a5853f; }
.cover-spine { border-left: 1px solid rgba(62,50,34,0.18); border-right: 1px solid rgba(62,50,34,0.18); }
.cover-spine-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-90deg);
  white-space: nowrap; font-family: 'Cormorant Garamond', serif; font-weight: 600;
  letter-spacing: 0.3em; color: #5a4632;
}
.cover-front.droptarget { outline: 3px dashed var(--gold-bright); outline-offset: -3px; }
.cover-front-text {
  position: absolute; left: 0; right: 0; bottom: 7%; text-align: center; pointer-events: none;
}
.cover-front-names {
  font-family: 'Cormorant Garamond', serif; font-weight: 600; letter-spacing: 0.18em;
  color: #fff; text-shadow: 0 1px 10px rgba(50,38,20,0.5);
}
.cover-front-date { font-family: 'Pinyon Script', cursive; color: #e9c766; text-shadow: 0 1px 8px rgba(50,38,20,0.5); }

/* ---------- side panel ---------- */
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.strip .thumb { border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: grab; aspect-ratio: 1; background: var(--ivory-2); }
.strip .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip .thumb:hover { border-color: var(--gold); }
.strip .thumb.used { opacity: 0.45; }
.strip .thumb { position: relative; }
.thumb-x {
  position: absolute; top: 2px; right: 5px; color: #fff; font-size: 15px; line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6); cursor: pointer; z-index: 2;
}
.thumb-x:hover { color: #ffb3a7; }
.layout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.layout-btn { text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 12px; }
.layout-btn.active { border-color: var(--gold); background: var(--ivory); }
.layout-btn small { display: block; color: var(--ink-soft); font-size: 10.5px; margin-top: 2px; letter-spacing: 0; text-transform: none; }
.kv { display: flex; gap: 8px; }
.kv > * { flex: 1; }
.hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.comment-item { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-top: 8px; background: var(--ivory); font-size: 12.5px; }
.comment-item .meta { color: var(--ink-soft); font-size: 11px; margin-bottom: 3px; }
.proof-link { word-break: break-all; font-size: 12px; background: var(--ivory); border: 1px dashed var(--line); padding: 8px; border-radius: 8px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--ivory); padding: 10px 20px; border-radius: 999px;
  font-size: 13px; z-index: 99; box-shadow: var(--shadow);
}

/* ---------- proof page ---------- */
.proof-wrap { max-width: 1020px; margin: 0 auto; padding: 26px 18px 70px; }
.proof-head { text-align: center; margin-bottom: 8px; }
.proof-head h1 { font-size: 36px; margin: 0; font-weight: 600; letter-spacing: 0.05em; }
.proof-head .script { font-size: 32px; }
.flip { background: var(--ivory-2); border: 1px solid var(--line); border-radius: 16px; padding: 18px; position: relative; }
.flip .spread, .flip .cover { box-shadow: var(--shadow); }
.flip-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 4px; }
.pin {
  position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transform: translate(-50%, -50%); z-index: 9; border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25); pointer-events: none;
}
.pin-mode .spread { cursor: crosshair; }
.approve-box { text-align: center; margin-top: 22px; }
.approve-box button { font-size: 15px; padding: 12px 34px; }
.approved-banner {
  text-align: center; border: 1px solid var(--ok); color: var(--ok);
  border-radius: 12px; padding: 14px; margin-top: 20px; background: #f2f6ee;
  font-family: 'Cormorant Garamond', serif; font-size: 20px;
}
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 0 1 auto; }
.row .grow { flex: 1; }
.mt { margin-top: 12px; }

/* ---------- v0.2: smart album, extend, collections ---------- */
.smart-on { border: 1px solid var(--gold); border-radius: 10px; padding: 10px; background: #fffaf0; }
.thumb-sel {
  position: absolute; top: 2px; left: 5px; color: rgba(255,255,255,0.85); font-size: 15px; line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.65); cursor: pointer; z-index: 2;
}
.thumb-sel.on { color: var(--gold-bright); }
.strip .thumb.auto-sel { border-color: var(--gold-bright); box-shadow: 0 0 0 1px var(--gold-bright); opacity: 1; }
.extend-bg { filter: blur(14px) saturate(0.92) brightness(1.04); }
.extend-strip { position: absolute; overflow: hidden; }
.extend-strip img.placed { position: absolute; max-width: none; max-height: none; }
.frame img.fg, .cover-front img.fg { z-index: 2; }
