/* PiixelCore Layouts · album proof viewer */

:root,
:root[data-theme="light"] {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --ink: #1c1a17;
  --muted: #6f6a62;
  --line: #e3ded5;
  --accent: #8a6a43;
  --accent-ink: #ffffff;
  --accent-soft: rgba(138, 106, 67, 0.12);
  --danger: #a4452f;
  --shadow-book: 0 30px 60px -20px rgba(40, 30, 15, 0.35), 0 12px 24px -12px rgba(40, 30, 15, 0.25);
  --backdrop: rgba(28, 26, 23, 0.32);
  --edge-1: #f7f5f1;
  --edge-2: #e8e3da;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121212;
  --surface: #1c1b19;
  --ink: #eeeae3;
  --muted: #9a948a;
  --line: #2c2a27;
  --accent: #c9a66b;
  --accent-ink: #1a1712;
  --accent-soft: rgba(201, 166, 107, 0.14);
  --danger: #e0806a;
  --shadow-book: 0 30px 70px -20px rgba(0, 0, 0, 0.75), 0 12px 28px -12px rgba(0, 0, 0, 0.6);
  --backdrop: rgba(0, 0, 0, 0.55);
  --edge-1: #d9d4ca;
  --edge-2: #a9a399;
  color-scheme: dark;
}

/* Landing follows the OS (it has no share settings). */
@media (prefers-color-scheme: dark) {
  :root.landing-root {
    --bg: #121212; --surface: #1c1b19; --ink: #eeeae3; --muted: #9a948a;
    --line: #2c2a27; --accent: #c9a66b; color-scheme: dark;
  }
}

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

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

button, input, textarea { font: inherit; color: inherit; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; flex: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* ---------- Buttons & inputs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:not(:disabled):hover { filter: brightness(1.06); }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-quiet:not(:disabled):hover { background: var(--accent-soft); border-color: transparent; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 999px; border: 0; background: transparent;
  color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.icon-btn:not(:disabled):hover { background: var(--accent-soft); }
.icon-btn:disabled { opacity: .3; cursor: default; }

.text-input, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 10px; padding: 11px 14px; font-size: 16px; /* 16px stops iOS zooming */
  transition: border-color .15s, box-shadow .15s;
}
.text-input:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: none; line-height: 1.45; }
::placeholder { color: var(--muted); opacity: .8; }

.field-label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 8px; text-align: center; }

/* ---------- Screens ---------- */

.screen { min-height: 100vh; min-height: 100dvh; }

.loading-screen { display: grid; place-items: center; }
body:not(.is-loading) .loading-screen { display: none; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Gate ---------- */

.gate { display: flex; flex-direction: column; align-items: center; padding: 0 16px; }
.gate-col {
  flex: 1; width: 100%; max-width: 420px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 48px 0 24px;
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.gate-logo { max-height: 88px; max-width: 220px; object-fit: contain; margin-bottom: 22px; }
.gate-studio {
  margin: 0 0 10px; font-size: 12px; font-weight: 500; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted);
}
.gate-title {
  margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500;
  font-size: clamp(38px, 10vw, 56px); line-height: 1.05; letter-spacing: -.005em;
  overflow-wrap: anywhere;
}
.gate-welcome {
  margin: 18px 0 0; color: var(--muted); white-space: pre-line; max-width: 36ch;
  overflow-wrap: anywhere;
}
.gate-form { width: 100%; margin-top: 36px; display: flex; flex-direction: column; align-items: stretch; }
.gate-form .text-input { text-align: center; margin-bottom: 4px; }
.gate-form > .field-label + .text-input { margin-top: 0; }
.gate-form > .pin + .field-label { margin-top: 26px; }

.pin { position: relative; width: 100%; max-width: 330px; margin: 0 auto; }
.pin-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pin-box {
  height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pin-box.is-filled { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pin.is-focused .pin-box.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pin.is-focused .pin-box.is-active:empty::after {
  content: ""; width: 1.5px; height: 24px; background: var(--accent); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.pin-input {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0;
  font-size: 16px; color: transparent; background: transparent; caret-color: transparent; cursor: text;
}
.pin.is-error .pin-box { border-color: var(--danger); }
.pin.is-shake { animation: shake .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); }
}
.pin.is-busy .pin-box { opacity: .55; }
.pin.is-disabled .pin-box { opacity: .4; }

.gate-error { min-height: 22px; margin: 14px 0 0; font-size: 14px; color: var(--danger); }
.gate-error.is-info { color: var(--muted); }
.gate-submit { margin-top: 10px; align-self: center; min-width: 180px; }

.gate-status { margin-top: 34px; max-width: 34ch; }
.gate-status-msg { margin: 0 0 16px; color: var(--muted); }

.foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px;
  font-size: 11.5px; color: var(--muted); letter-spacing: .02em; padding: 14px 16px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.foot-expiry::before { content: "·"; margin-right: 14px; }

/* ---------- Viewer layout ---------- */

.viewer {
  height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--bg); flex: none;
}
.topbar-titles { display: flex; flex-direction: column; min-width: 0; }
.topbar-studio {
  font-size: 10.5px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-studio:empty { display: none; }
.topbar-title {
  font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 22px; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; gap: 8px; flex: none; }
.btn-comments .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 600; display: inline-grid; place-items: center;
}
.btn-comments[aria-expanded="true"] { background: var(--accent-soft); border-color: transparent; }

.approved-banner {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 16px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500;
}
.approved-banner svg { width: 16px; height: 16px; stroke-width: 2.2; }

.viewer-body { position: relative; flex: 1; min-height: 0; display: flex; }

/* ---------- Stage & book ---------- */

.stage {
  position: relative; flex: 1; min-width: 0; overflow: hidden;
  display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.stage.is-turning { overflow: visible; z-index: 10; }
.zoom-layer { position: absolute; inset: 0; display: grid; place-items: center; transform-origin: 0 0; perspective: 2600px; }
.stage.is-zoomed { cursor: grab; }
.stage.is-panning { cursor: grabbing; }

.book {
  position: relative; perspective: 2600px;
  width: 300px; height: 150px; /* sized from JS */
}
.book::before { /* soft shadow under the open book */
  content: ""; position: absolute; inset: 0; box-shadow: var(--shadow-book); pointer-events: none;
  transition: opacity 1s ease;
}
.half {
  position: absolute; top: 0; width: 50%; height: 100%; overflow: hidden; background: var(--surface);
}
.half-left { left: 0; }
.half-right { right: 0; }
.half img, .face img, .xfade img {
  position: absolute; top: 0; height: 100%; width: 200%; max-width: none; display: block;
  object-fit: fill; pointer-events: none; -webkit-user-drag: none;
}
.half-left img, .face-back img { left: 0; }
.half-right img, .face-front img { left: -100%; }
.half.is-empty { background: transparent; }
.half.is-empty img { display: none; }

.gutter {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 12%; transform: translateX(-50%);
  pointer-events: none; z-index: 2; transition: opacity 1s ease;
  background: linear-gradient(90deg,
    rgba(0,0,0,0) 0%, rgba(0,0,0,.035) 30%, rgba(0,0,0,.14) 47%, rgba(0,0,0,.2) 50%,
    rgba(0,0,0,.14) 53%, rgba(0,0,0,.035) 70%, rgba(0,0,0,0) 100%);
  mix-blend-mode: multiply;
}
.book.is-closed .gutter, .book.is-closed::before { opacity: 0; transition: none; }

.leaf {
  position: absolute; top: 0; width: 50%; height: 100%; z-index: 3;
  transform-style: preserve-3d; will-change: transform;
}
.leaf.is-forward { left: 50%; transform-origin: 0 50%; }
.leaf.is-back { left: 0; transform-origin: 100% 50%; }
.face {
  position: absolute; inset: 0; overflow: hidden; background: var(--surface);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.face-back { transform: rotateY(180deg); }
.leaf.is-back .face-front img { left: 0; }
.leaf.is-back .face-back img { left: -100%; }
.shade { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.leaf.is-forward .face-front .shade { background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,.05) 40%, rgba(0,0,0,0)); }
.leaf.is-forward .face-back .shade { background: linear-gradient(270deg, rgba(0,0,0,.28), rgba(0,0,0,.05) 40%, rgba(0,0,0,0)); }
.leaf.is-back .face-front .shade { background: linear-gradient(270deg, rgba(0,0,0,.28), rgba(0,0,0,.05) 40%, rgba(0,0,0,0)); }
.leaf.is-back .face-back .shade { background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,.05) 40%, rgba(0,0,0,0)); }

/* Closed book: the front cover sits centred with page edges and a soft shadow. */
.book.is-closed .leaf .face-front {
  box-shadow: var(--shadow-book), 1px 0 0 var(--edge-1), 2px 1px 0 var(--edge-2), 3px 1px 0 var(--edge-1),
    4px 2px 0 var(--edge-2), 5px 2px 0 var(--edge-1);
  border-radius: 1px 3px 3px 1px;
}
.book.is-closed .leaf .face-front::after { /* spine highlight */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4%;
  background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(255,255,255,.12) 55%, rgba(0,0,0,0));
}

/* Page turns are drawn on this canvas (above the halves and gutter) while pages move. */
.flip-canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; display: block; }
.xfade { position: absolute; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; }

.stage-spinner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 6; }

.side-arrow {
  position: absolute; top: 50%; z-index: 5; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 999px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 82%, transparent); color: var(--ink);
  display: none; align-items: center; justify-content: center; cursor: pointer;
  transition: opacity .2s, background-color .15s;
}
.side-arrow:not(:disabled):hover { background: var(--surface); }
.side-arrow:disabled { opacity: 0; pointer-events: none; }
.side-prev { left: 16px; }
.side-next { right: 16px; }
.stage.is-zoomed .side-arrow { opacity: 0; pointer-events: none; }

.zoom-exit {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 13px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.zoom-exit svg { width: 16px; height: 16px; }

.toast {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 8;
  padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 13px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: toast-in .35s ease both;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Controls ---------- */

.controls { flex: none; padding: 6px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.controls-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.spread-label { min-width: 120px; text-align: center; font-size: 13px; color: var(--muted);
  font-variant-numeric: tabular-nums; }
.progress { height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; display: none; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .35s ease; }

.thumbs {
  list-style: none; margin: 0; padding: 4px 2px 6px; display: flex; gap: 8px;
  overflow-x: auto; scroll-behavior: smooth; scrollbar-width: thin; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; justify-content: safe center;
}
.thumbs li { flex: none; scroll-snap-align: center; }
.thumb {
  position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); cursor: pointer; overflow: visible; height: 46px;
  opacity: .62; transition: opacity .15s, border-color .15s, transform .15s;
}
.thumb img { display: block; height: 100%; width: auto; border-radius: 3px; pointer-events: none; }
.thumb:hover { opacity: .9; }
.thumb[aria-current="true"] { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.thumb-badge {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 600; display: grid; place-items: center; line-height: 1;
  border: 2px solid var(--bg);
}

.viewer-foot { padding-top: 2px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }

/* ---------- Comments panel ---------- */

.panel {
  flex: none; width: 360px; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-left: 1px solid var(--line);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line);
}
.tabs { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 13px;
  font-weight: 500; color: var(--muted); cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.comment-list { list-style: none; margin: 0; padding: 6px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 12.5px; }
.comment-name { font-weight: 600; }
.comment-time { color: var(--muted); }
.comment-where {
  border: 0; background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  font-size: 11px; font-weight: 500; padding: 1px 8px; cursor: pointer;
}
.comment-tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px;
}
.comment-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.comment.is-resolved { opacity: .55; }
.comment.is-approval .comment-body { color: var(--accent); font-weight: 500; }
.comment.is-pending { opacity: .6; }
.comment-empty { margin: 0; padding: 28px 22px; text-align: center; color: var(--muted); font-size: 14px; flex: 1; }

.composer { border-top: 1px solid var(--line); padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; }
.composer textarea { font-size: 15px; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.composer-as { font-size: 12px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-as button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.btn-send { min-height: 36px; padding: 0 18px; }
.composer-error { margin: 0; min-height: 0; font-size: 13px; color: var(--danger); }
.composer-error:empty { display: none; }

.sheet-backdrop { display: none; }

/* ---------- Photo comments ---------- */

.marks { position: absolute; inset: 0; z-index: 6; pointer-events: none; --zs: 1; }
.marks.is-off { visibility: hidden; }
.marks-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mark-dim { fill: rgba(12, 10, 8, .42); stroke: none; opacity: 0; transition: opacity .2s ease; }
.marks.is-dim .mark-dim { opacity: 1; }
.mark-frame { fill: none; stroke: #fff; stroke-width: 2.5; opacity: 0; stroke-linejoin: round;
  filter: drop-shadow(0 0 1.5px rgba(0,0,0,.55)); transition: opacity .15s ease; }
.marks.is-hover .mark-frame { opacity: .9; stroke-width: 2; stroke-dasharray: none; }
.marks.is-selected .mark-frame { opacity: 1; stroke: var(--accent); stroke-width: 3; filter: drop-shadow(0 0 2px rgba(0,0,0,.4)); }
/* Press and hold: the outline draws itself around the photo while the finger stays down. */
.marks.is-holding .mark-frame { opacity: 1; stroke-width: 3.5; stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: hold-ring .34s linear forwards; }
@keyframes hold-ring { to { stroke-dashoffset: 0; } }

.mark-chip {
  position: absolute; pointer-events: auto; transform: translate(calc(-100% - 10px), 10px) scale(calc(1 / var(--zs)));
  transform-origin: top right; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px;
  border: 0; border-radius: 999px; background: rgba(20, 18, 15, .78); color: #fff; font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.25); animation: fade-in .15s ease both;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.mark-chip svg { width: 15px; height: 15px; stroke-width: 2; }
.mark-chip:hover { background: var(--accent); color: var(--accent-ink); }
.stage.is-picking .mark-chip { display: none; }
.stage.is-picking { cursor: crosshair; }

.mark-dots { position: absolute; inset: 0; }
.mark-dot {
  position: absolute; pointer-events: auto; width: 24px; height: 24px; min-width: 24px; padding: 0 5px;
  margin: -12px 0 0 -12px; border-radius: 999px 999px 999px 4px; border: 2px solid #fff;
  background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; line-height: 1;
  display: inline-grid; place-items: center; cursor: pointer; transform: scale(calc(1 / var(--zs)));
  box-shadow: 0 3px 10px rgba(0,0,0,.35); -webkit-tap-highlight-color: transparent;
}
.mark-dot::before { content: ""; position: absolute; inset: -10px; } /* bigger touch target */
.mark-dot.is-done { background: #7d786f; opacity: .75; }
.mark-dot.is-new { animation: dot-pop .45s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes dot-pop { from { transform: scale(0); } }
.mark-dot:hover { filter: brightness(1.08); }

.pick-hint {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 8;
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 13px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  animation: toast-in .3s ease both;
}
.pick-hint button { border: 0; border-radius: 999px; padding: 5px 12px; background: rgba(255,255,255,.16); color: inherit;
  font-size: 12.5px; cursor: pointer; }
.btn-mark[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* The note: a popover beside the photo; a bottom sheet on phones (see below). */
.note-backdrop { position: fixed; inset: 0; z-index: 29; background: transparent; }
.note {
  position: fixed; z-index: 30; width: min(340px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.28);
  overflow: hidden; animation: note-in .18s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes note-in { from { opacity: 0; transform: scale(.96); } }
.note-head { display: flex; align-items: center; gap: 12px; padding: 12px 8px 10px 12px; }
.note-thumb { flex: none; width: 52px; height: 52px; border-radius: 8px; background: var(--line); object-fit: cover; }
.note-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.note-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.25; }
.note-sub { font-size: 12.5px; color: var(--muted); }
.note-thread { list-style: none; margin: 0; padding: 0 14px; max-height: 180px; overflow-y: auto;
  border-top: 1px solid var(--line); }
.note-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.note-form textarea { font-size: 15px; resize: none; }

@media (max-width: 899px), (pointer: coarse) {
  .note.is-sheet {
    left: 0 !important; right: 0; top: auto !important; bottom: var(--kb, 0px); width: auto;
    max-height: min(70vh, 560px); border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -18px 50px rgba(0,0,0,.22);
    animation: sheet-in .28s cubic-bezier(.2,.8,.2,1) both; transition: bottom .15s ease;
  }
  .note.is-sheet .note-head { padding-top: 18px; position: relative; }
  .note.is-sheet .note-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px;
    margin-left: -18px; border-radius: 4px; background: var(--line); }
  .note.is-sheet .note-thumb { width: 60px; height: 60px; }
  .note-backdrop { background: rgba(0,0,0,.18); animation: fade-in .2s ease both; }
  .note.is-sheet .note-thread { max-height: 26vh; }
}

/* ---------- Dialog ---------- */

.dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(400px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
.dialog::backdrop { background: var(--backdrop); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.dialog-title { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 600; font-size: 26px; line-height: 1.15; }
.dialog-text { margin: 0 0 8px; color: var(--muted); }
.dialog-name { margin: 6px 0; }
.dialog-name .field-label { text-align: left; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ---------- Responsive ---------- */

@media (min-width: 900px) {
  .side-arrow { display: inline-flex; }
  .progress { display: none; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .topbar-title { font-size: 24px; }
}

@media (max-width: 899px) {
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; max-height: min(78vh, 620px); z-index: 20;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 50px rgba(0,0,0,.18); animation: sheet-in .32s cubic-bezier(.2,.8,.2,1) both;
  }
  .panel-head { padding-top: 14px; position: relative; }
  .panel-head::before { content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 4px;
    margin-left: -18px; border-radius: 4px; background: var(--line); }
  .comment-list { min-height: 80px; }
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 19; background: var(--backdrop);
    animation: fade-in .25s ease both; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }

@media (max-width: 600px) {
  .topbar { padding-left: 12px; padding-right: 10px; gap: 8px; }
  .topbar-title { font-size: 19px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .btn { padding: 0 12px; min-height: 36px; font-size: 13px; }
  .btn-approve span { display: none; }
  .btn-approve { width: 36px; padding: 0 !important; }
  .btn-comments-label { display: none; }
  .btn-mark-label { display: none; }
  .btn-mark { width: 36px; padding: 0 !important; }
  .controls { padding: 4px 10px 0; gap: 4px; }
  .progress { display: block; }
  .thumb { height: 38px; }
  .viewer-foot { font-size: 10.5px; padding-top: 0; }
}

@media (max-width: 380px) {
  .pin-boxes { gap: 6px; }
  .pin-box { height: 50px; font-size: 22px; }
}

/* Short landscape phones: keep the spread as large as possible. */
@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding-top: 4px; padding-bottom: 4px; }
  .topbar-studio { display: none; }
  .topbar-title { font-size: 18px; }
  .thumbs, .viewer-foot, .approved-banner { display: none; }
  .controls { padding-top: 0; }
  .nav-btn { width: 34px; height: 34px; }
  .side-arrow { display: inline-flex; width: 38px; height: 38px; }
  .side-prev { left: 8px; } .side-next { right: 8px; }
  .panel { max-height: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-col, .toast, .panel, .sheet-backdrop, .pin.is-shake, .note, .note-backdrop, .pick-hint, .mark-chip, .mark-dot { animation: none !important; }
  .marks.is-holding .mark-frame { animation: none; stroke-dashoffset: 0; }
  .progress-fill, .thumb, .btn { transition: none; }
  .thumbs { scroll-behavior: auto; }
}

/* ---------- Landing ---------- */

.landing {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 32px 16px;
}
.landing-mark {
  width: 54px; height: 40px; margin: 0 auto 26px; position: relative;
}
.landing-mark span {
  position: absolute; top: 0; width: 50%; height: 100%; border: 1.5px solid var(--accent);
}
.landing-mark span:first-child { left: 0; border-radius: 3px 0 0 3px; transform: skewY(6deg); transform-origin: right; }
.landing-mark span:last-child { right: 0; border-radius: 0 3px 3px 0; transform: skewY(-6deg); transform-origin: left; }
.landing-kicker { margin: 0 0 10px; font-size: 12px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.landing-title { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; font-size: clamp(40px, 9vw, 60px); line-height: 1.05; }
.landing-text { margin: 18px auto 0; max-width: 34ch; color: var(--muted); }
.landing-rule { width: 40px; height: 1px; background: var(--line); margin: 28px auto 0; border: 0; }
.landing-foot { margin-top: 18px; font-size: 11.5px; color: var(--muted); }
