/* Montage pages: a side rail, a large hero and calm cards. Neutral by default; theme.js sets
   --bg, --text, --accent and --on-accent from the signed-in account's saved brand. */
@font-face { font-family: Inter; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Inter; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f3f4f5; --text: #15181c; --accent: #15181c; --on-accent: #ffffff;
  --panel: #ffffff; --field: #ffffff;
  --soft: color-mix(in srgb, var(--text) 4%, var(--bg));
  --line: color-mix(in srgb, var(--text) 11%, var(--bg));
  --edge: color-mix(in srgb, var(--text) 30%, var(--bg));
  --muted: color-mix(in srgb, var(--text) 66%, var(--bg));
  --hero: #15181c; --hero-text: #f5f6f7; --hero-muted: #c3c8ce; --hero-accent: #e9ebee;
  --focus: var(--text); --danger: #a3352a; --danger-soft: #f8e9e6;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Menlo, monospace;
  --rail: 252px; --radius: 14px;
}
[data-theme=dark] {
  color-scheme: dark;
  --panel: color-mix(in srgb, var(--text) 6%, var(--bg));
  --field: color-mix(in srgb, var(--text) 3%, var(--bg));
  --soft: color-mix(in srgb, var(--text) 9%, var(--bg));
  --line: color-mix(in srgb, var(--text) 13%, var(--bg));
  --edge: color-mix(in srgb, var(--text) 38%, var(--bg));
  --muted: color-mix(in srgb, var(--text) 72%, var(--bg));
  --hero: color-mix(in srgb, var(--text) 5%, var(--bg)); --hero-text: var(--text); --hero-muted: var(--muted);
  --hero-accent: var(--accent); --focus: var(--accent); --danger: #fca5a5;
  --danger-soft: color-mix(in srgb, #ef4444 16%, var(--bg));
}
[data-theme=light] { --hero: var(--text); --hero-text: var(--bg); --hero-accent: var(--accent); }
[data-font=inter] { --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--bg); font: 15px/1.55 var(--font); }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.1; margin: 0; letter-spacing: -.025em; font-weight: 750; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
svg { flex: none; }

/* Rail */
.rail { position: fixed; inset: 0 auto 0 0; z-index: 2; width: var(--rail); display: flex; flex-direction: column;
  padding: 26px 18px 18px; background: var(--panel); border-right: 1px solid var(--line); }
.wordmark { display: flex; align-items: center; gap: 10px; width: fit-content; margin: 0 0 40px 6px; min-height: 44px;
  font-size: 21px; font-weight: 800; letter-spacing: -.03em; text-decoration: none; }
.wordmark-second { color: var(--muted); }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); }
.brand-mark { display: flex; gap: 3px; transform: skewX(-12deg); }
.brand-mark span { display: block; width: 5px; height: 18px; background: var(--on-accent); }
.brand-mark span:first-child { height: 12px; margin-top: 6px; }
.rail nav { display: grid; gap: 4px; }
.rail nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; }
.rail nav a:hover { background: var(--soft); color: var(--text); }
.rail nav a[aria-current] { background: var(--soft); color: var(--text); font-weight: 650; box-shadow: inset 3px 0 var(--accent); }
.rail nav a.out { margin-top: 10px; }
.account { margin-top: auto; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 12px 4px 0;
  border-top: 1px solid var(--line); }
.account > span:last-child { min-width: 0; }
.account strong { display: block; font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; }
.avatar { flex: 0 0 36px; height: 36px; display: grid; place-items: center; overflow: hidden; border-radius: 10px;
  background: var(--soft); color: var(--text); font-weight: 750; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Workspace */
.workspace { margin-left: var(--rail); min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px;
  padding-inline: max(40px, calc((100% - 1230px) / 2)); background: var(--panel); border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 14px; }
.topbar strong { color: var(--text); }
.crumb { margin: 0 8px; }
main { width: min(1230px, calc(100% - 80px)); margin: 30px auto 64px; }

.hero { position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: center; min-height: 300px;
  margin-bottom: 28px; padding: 44px clamp(26px, 5vw, 64px); border-radius: 18px; color: var(--hero-text);
  background: radial-gradient(circle at 82% 18%, color-mix(in srgb, var(--hero-accent) 16%, transparent), transparent 52%), var(--hero); }
[data-theme=dark] .hero { border: 1px solid var(--line); }
.hero > div { position: relative; z-index: 1; max-width: 40rem; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; color: var(--hero-accent);
  font-size: 12px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: currentColor; }
.hero h1 { font-size: clamp(44px, 6vw, 84px); line-height: .95; letter-spacing: -.04em; font-weight: 800; }
.hero h1 span { color: var(--hero-accent); }
.hero p:not(.eyebrow) { margin: 18px 0 0; max-width: 34rem; color: var(--hero-muted); font-size: 16px; line-height: 1.6; }
.frame { position: absolute; z-index: 0; inset: 12% 9% 12% auto; aspect-ratio: 9 / 16; border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--hero-text) 22%, transparent); pointer-events: none; }
.frame::before, .frame::after, .frame i, .frame b { content: ""; position: absolute; width: 22px; height: 22px;
  border: 2px solid var(--hero-accent); }
.frame::before { inset: -1px auto auto -1px; border-width: 2px 0 0 2px; border-radius: 6px 0 0 0; }
.frame i { inset: -1px -1px auto auto; border-width: 2px 2px 0 0; border-radius: 0 6px 0 0; }
.frame b { inset: auto auto -1px -1px; border-width: 0 0 2px 2px; border-radius: 0 0 0 6px; }
.frame::after { inset: auto -1px -1px auto; border-width: 0 2px 2px 0; border-radius: 0 0 6px 0; }
.frame small { position: absolute; right: 10px; bottom: 10px; padding: 2px 7px; border-radius: 4px; font: 700 11px/1.4 var(--font);
  color: var(--hero-text); background: color-mix(in srgb, var(--hero) 80%, transparent); }

/* Cards */
.layout { display: grid; gap: 20px; align-items: start; }
@media (min-width: 70rem) { .layout { grid-template-columns: minmax(0, 1fr) 23rem; } }
.work, .side { display: grid; gap: 20px; min-width: 0; }
section { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(18px, 3vw, 30px); }
section > h2 { font-size: clamp(24px, 2.4vw, 30px); letter-spacing: -.035em; margin-bottom: 16px; }
.side section > h2 { font-size: 21px; }
.gallery-sections { display: grid; gap: 20px; }
.gallery-sections .hint { margin-bottom: 18px; max-width: 46rem; }
.count { display: inline-block; margin-left: 8px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px;
  font: 650 12px/1.3 var(--font); letter-spacing: 0; color: var(--muted); vertical-align: middle; }
.count:empty { display: none; }

/* Fields */
form, .fields { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 650; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; }
label.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
input:not([type=checkbox]):not([type=color]):not([type=file]), textarea, select {
  font: 400 15px/1.4 var(--font); color: var(--text); width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--field); border: 1px solid var(--edge); border-radius: 10px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, var(--bg)); }
textarea { font: 13px/1.5 var(--mono); resize: vertical; }
input[type=color] { width: 100%; height: 46px; padding: 4px; background: var(--field); border: 1px solid var(--edge); border-radius: 10px; }
code { font: 12.5px var(--mono); background: var(--soft); padding: 1px 6px; border-radius: 5px; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }
#material-hint:empty { display: none; }
fieldset { min-width: 0; }
.step { margin: 0; padding: 22px 0 0; border: 0; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.step:first-of-type { border-top: 0; padding-top: 0; }
.step legend { padding: 0; font-size: 17px; font-weight: 750; letter-spacing: -.02em; display: flex; align-items: center;
  gap: 10px; float: left; width: 100%; }
.step-number { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: var(--accent); color: var(--on-accent); font: 700 13px/1 var(--font); }

/* Buttons */
button { font: 650 14px/1.2 var(--font); min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--edge);
  background: var(--panel); color: var(--text); cursor: pointer; justify-self: start;
  transition: background .16s ease, border-color .16s ease, filter .16s ease; }
button:hover:not(:disabled) { background: var(--soft); }
button[type=submit], button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
button[type=submit]:hover:not(:disabled), button.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
button.primary { min-height: 54px; padding: 0 28px; font-size: 16px; }
button.delete { color: var(--danger); border-color: var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }

#notice:empty { display: none; }
#notice { margin: 0 0 20px; padding: 12px 16px; border-radius: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--panel)); }

.design-options, .brand-colours { display: grid; gap: 14px; }
@media (min-width: 40rem) { .design-options { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.brand-colours { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.template-save { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.template-save label { flex: 1 1 16rem; }
#accounts { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

/* Galleries: each tile is a small card */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.tile { display: grid; grid-template-rows: auto 1fr; min-width: 0; overflow: hidden; background: var(--field);
  border: 1px solid var(--line); border-radius: 12px; transition: box-shadow .2s ease, border-color .2s ease; }
.tile:hover { border-color: var(--edge); box-shadow: 0 10px 28px color-mix(in srgb, #000 12%, transparent); }
.thumb { aspect-ratio: 9 / 16; overflow: hidden; background: #1a1d24; display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.tile:hover .thumb img { transform: scale(1.03); }
.thumb-note { color: #cbd3da; font-size: 12px; }
/* Facts stack; buttons share rows and wrap. */
.tile-body { display: flex; flex-wrap: wrap; gap: 5px 6px; align-content: start; align-items: flex-start; padding: 13px 14px 14px; }
.tile-body > :not(button) { flex: 1 0 100%; }
.tile-body > code, .tile-body > .flag, .tile-body > .tile-action { flex: 0 0 auto; max-width: 100%; }
.tile-body h3 { font-size: 16px; overflow-wrap: anywhere; }
.tile-body p { margin: 0; font-size: 12.5px; color: var(--muted); }
.tile-body code { justify-self: start; white-space: normal; overflow-wrap: anywhere; }
.tile-action { justify-self: start; margin-top: 4px; font-size: 13.5px; font-weight: 700; min-height: 44px;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.tile-action::after { content: "→"; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--soft); transition: background .16s ease; }
.tile-action:hover::after { background: var(--accent); color: var(--on-accent); }
.files { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.files .thumb { aspect-ratio: 4 / 3; }
.files .thumb img { object-fit: contain; }
.files .tile:hover .thumb img { transform: none; }
.thumb-audio, .thumb-font { background: var(--soft); }
.thumb-audio .thumb-note, .thumb-font .thumb-note { color: var(--text); font: 700 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.tile-body .summary { color: var(--text); font-size: 13.5px; }
.tile-body .flag { justify-self: start; color: var(--danger); background: var(--danger-soft); padding: 2px 8px; border-radius: 5px; font-weight: 600; }
.tile-body button { min-height: 44px; margin-top: 4px; font-size: 13px; padding: 0 12px; }
.tile-body > button:first-of-type { margin-top: 8px; }
.tile-body > button:first-of-type ~ button { margin-top: 8px; }
.find { display: grid; gap: 14px; margin-bottom: 20px; align-items: end; }
@media (min-width: 44rem) { .find { grid-template-columns: minmax(0, 1fr) 11rem auto; } }
.drop { display: grid; gap: 10px; place-items: center; text-align: center; padding: 34px 16px; border: 2px dashed var(--edge);
  border-radius: var(--radius); background: var(--soft); font-size: 15px; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.drop.over, .drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.drop input { max-width: 100%; min-height: 44px; }
.drop input::file-selector-button { min-height: 40px; margin-right: 10px; padding: 0 14px; border: 1px solid var(--edge);
  border-radius: 10px; background: var(--panel); color: var(--text); font: 650 13.5px/1 var(--font); cursor: pointer; }
.progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.progress li { padding: 8px 12px; background: var(--soft); border-radius: 8px; overflow-wrap: anywhere; }
.progress .failed { color: var(--danger); background: var(--danger-soft); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--field); font-size: 13px; font-weight: 600; }

/* Drafts */
#empty { margin: 0; color: var(--muted); }
#montages { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.montage { border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 10px; background: var(--field); }
.montage h3 { font-size: 19px; }
.montage p { margin: 0; }
.status { justify-self: start; padding: 3px 10px; border-radius: 999px; background: var(--soft);
  font: 650 11px/1.4 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.selection, .design-choice { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 8px; }
.review { display: grid; gap: 12px; }
video { width: min(100%, 20rem); border-radius: 12px; background: #000; }
.sheets { display: grid; gap: 8px; }
.sheets img { width: 100%; height: auto; border-radius: 8px; }
.approved a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; text-underline-offset: 4px; }
.ask { display: grid; gap: 6px; justify-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.ask input { width: 100%; min-height: 44px; }
.handoff { gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.handoff h4 { font-size: 17px; }
.handoff fieldset { display: grid; gap: 8px; margin: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 10px; }
.handoff legend { padding: 0 6px; font-size: 13.5px; font-weight: 650; }

@media (max-width: 1020px) {
  :root { --rail: 196px; }
  .rail { padding-inline: 12px; }
  main { width: calc(100% - 48px); }
  .topbar { padding-inline: 24px; }
  .frame { right: 6%; }
}
@media (max-width: 760px) {
  .rail { position: static; width: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
    padding: 10px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .wordmark { margin: 0; font-size: 19px; }
  .mark { width: 32px; height: 32px; }
  .rail nav { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
  .rail nav a { flex-direction: column; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px;
    font-size: 12px; line-height: 1.15; text-align: center; border-radius: 8px 8px 0 0; }
  .rail nav a[aria-current] { box-shadow: inset 0 -3px var(--accent); }
  .rail nav a.out { margin-top: 0; }
  .account { grid-row: 1; grid-column: 2; margin: 0; padding: 0; min-height: 44px; border: 0; }
  .account > span:last-child { display: none; }
  .workspace { margin-left: 0; }
  .topbar { display: none; }
  main { width: calc(100% - 32px); margin-top: 16px; }
  .hero { min-height: 0; padding: 32px 22px; margin-bottom: 18px; border-radius: 16px; }
  .hero h1 { font-size: clamp(38px, 11vw, 52px); }
  .hero p { font-size: 15px; }
  .frame { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .tile:hover .thumb img { transform: none; }
}
