/* Bragi — "Warm Archival Editorial" (from the Stitch design system) */
:root {
  --bg: #121316;
  --s1: #18191e;
  --s2: #202229;
  --s3: #292b34;
  --line: #282a32;
  --line-2: #3a3d48;
  --amber: #e5a93c;
  --champagne: #f3c362;
  --bronze: #d49024;
  --amber-tint: rgba(229, 169, 60, 0.12);
  --text: #f4f4f6;
  --text-2: #a6a9b6;
  --text-3: #636775;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --r: 4px;
  --r-lg: 8px;
  --side: 248px;
  --row: 190px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 14px/22px var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; letter-spacing: -0.01em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--s1); color: var(--text); font-weight: 600; font-size: 13px;
  letter-spacing: .01em; cursor: pointer; text-decoration: none; white-space: nowrap; transition: border-color .2s, background .2s, box-shadow .2s; }
.btn:hover { border-color: var(--amber); background: var(--s2); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: var(--bg); }
.btn-primary:hover { background: var(--champagne); border-color: var(--champagne); box-shadow: 0 0 16px rgba(229,169,60,.3); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: transparent; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--r); border: 1px solid transparent;
  background: transparent; color: var(--text); cursor: pointer; font-size: 18px; }
.icon-btn:hover { border-color: var(--line-2); background: var(--s2); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* Login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, rgba(229,169,60,.10), transparent 60%), var(--bg); }
.login-card { text-align: center; max-width: 380px; }
.login-card .crest { width: 56px; height: 56px; color: var(--amber); }
.login-card h1 { font-size: 56px; line-height: 64px; margin: 8px 0 12px; }
.lede { font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 30px; color: var(--text-2); margin: 0 0 32px; }
.login-error { color: #ffb4ab; margin-top: 20px; }

/* Shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--s1); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 24px 16px; gap: 24px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 28px; padding: 0 8px; }
.brand .crest { width: 30px; height: 30px; color: var(--amber); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: var(--r);
  text-decoration: none; color: var(--text-2); font-weight: 500; }
.nav a:hover:not(.soon) { color: var(--text); background: var(--s2); }
.nav a.active { color: var(--champagne); background: var(--amber-tint); }
.nav a.soon { color: var(--text-3); cursor: default; }
.nav em { font-style: normal; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--text-3); padding: 0 8px; }
.side-foot a { color: var(--text-2); text-decoration: none; }
.side-foot a:hover { color: var(--champagne); }

.main { margin-left: var(--side); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 4; display: flex; gap: 16px; align-items: center; padding: 16px 40px;
  background: rgba(18,19,22,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px;
  background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); color: var(--text-3); }
.search:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(229,169,60,.15); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); }
#selectBtn { margin-left: auto; }
#view { padding: 32px 40px 120px; outline: none; }

/* Library */
.hero { position: relative; display: grid; grid-template-columns: 1.4fr 1fr; min-height: 300px; border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; background: var(--s1); margin-bottom: 32px; }
.hero-img { position: relative; background: var(--s2); }
.hero-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-body { padding: 36px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--amber); }
.hero h1 { font-size: 40px; line-height: 48px; }
.hero p { margin: 0; color: var(--text-2); }
.hero .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; margin-bottom: 28px; }
.stat { background: var(--s1); padding: 16px 20px; }
.stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 38px; }
.stat span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .chips { margin: 12px 0 0; }
.page-head .chips + .small { margin-top: 8px; }
.chip { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  color: var(--text-2); font-weight: 500; font-size: 13px; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--amber-tint); border-color: rgba(229,169,60,.35); color: var(--champagne); }

.day { margin-bottom: 36px; }
.day-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.day-head h2 { font-size: 22px; line-height: 30px; }
.day-head .muted { font-size: 13px; }
.day-head .btn { height: 30px; padding: 0 10px; margin-left: auto; font-size: 12px; }
.day-tick { align-self: center; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 14px; background: transparent; color: transparent;
  box-shadow: inset 0 0 0 2px var(--line-2); transition: box-shadow .15s, background .15s; }
.day-tick:hover, .selecting .day-tick { box-shadow: inset 0 0 0 2px var(--text-2); color: var(--text-3); }
.day-tick.sel { background: var(--amber); box-shadow: none; color: var(--bg); }

/* Justified grid: each tile grows in proportion to its aspect ratio. */
.grid { display: flex; flex-wrap: wrap; gap: 6px; }
.grid::after { content: ''; flex-grow: 999999; }
.tile { --ar: 1.5; position: relative; flex-grow: calc(var(--ar) * 100); width: calc(var(--ar) * var(--row));
  aspect-ratio: var(--ar); margin: 0; background: var(--s1); border: 1px solid var(--line); border-radius: 2px;
  overflow: hidden; cursor: zoom-in; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease, opacity .3s; opacity: 0; }
.tile img.loaded { opacity: 1; }
.tile:hover { border-color: var(--amber); }
.tile:hover img { transform: scale(1.015); }
.tile .badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r); background: rgba(12,13,15,.75);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.tile .tick, .tile .fav { position: absolute; top: 8px; width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; font-size: 13px; opacity: 0; transition: opacity .15s; }
.tile .tick { left: 8px; background: rgba(12,13,15,.6); box-shadow: inset 0 0 0 2px rgba(244,244,246,.85); color: transparent; }
.tile .fav { right: 8px; background: rgba(12,13,15,.6); color: var(--text); }
.tile:hover .tick, .tile:hover .fav, .selecting .tile .tick, .tile .fav.on { opacity: 1; }
.tile .fav.on { color: var(--amber); }
.tile.sel { border: 2px solid var(--amber); }
.tile.sel .tick { opacity: 1; background: var(--amber); box-shadow: none; color: var(--bg); }
.selecting .tile { cursor: pointer; }

.empty { text-align: center; padding: 80px 16px; color: var(--text-2); }
.empty h2 { font-size: 32px; line-height: 40px; color: var(--text); margin-bottom: 8px; }
.empty p { margin: 0 0 24px; }

/* Albums */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: 40px; line-height: 48px; }
.page-head .grow { flex: 1; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }
.album-card { text-decoration: none; display: block; }
.album-card .cover { aspect-ratio: 4/3; background: var(--s1); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; position: relative; }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.album-card:hover .cover { border-color: var(--amber); }
.album-card:hover .cover img { transform: scale(1.02); }
.album-card h3 { font-size: 20px; line-height: 28px; margin-top: 12px; }
.album-card p { margin: 0; color: var(--text-2); font-size: 13px; }
.album-card .play { position: absolute; right: 10px; bottom: 10px; }
.title-edit { background: none; border: 1px solid transparent; border-radius: var(--r); font-family: var(--serif); font-size: 40px;
  line-height: 48px; padding: 0 6px; margin-left: -7px; width: 100%; max-width: 720px; }
.title-edit:hover, .title-edit:focus { border-color: var(--line-2); outline: 0; }

/* Selection bar */
.selbar { position: fixed; left: calc(var(--side) + 50%); transform: translateX(calc(-50% - var(--side) / 2)); bottom: 24px; z-index: 6;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 18px; background: var(--s3); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); box-shadow: 0 16px 40px -10px rgba(0,0,0,.65), 0 0 1px 1px rgba(243,195,98,.08); }
.selbar strong { margin-right: 8px; font-weight: 600; white-space: nowrap; }

/* Uploader */
.uploader { position: fixed; right: 24px; bottom: 24px; width: min(400px, calc(100vw - 32px)); z-index: 7; background: var(--s2);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: 0 16px 40px -10px rgba(0,0,0,.65); }
.uploader header { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--line); }
.drop { margin: 16px; padding: 24px 16px; border: 1px dashed var(--line-2); border-radius: var(--r-lg); text-align: center; color: var(--text-2); }
.drop p { margin: 0 0 14px; }
.drop .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.up-status { padding: 0 18px 18px; }
.up-status p { margin: 8px 0 0; font-size: 13px; }
.bar { height: 4px; background: var(--s1); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .3s; }
.dropveil { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(12,13,15,.85);
  border: 2px dashed var(--amber); font-family: var(--serif); font-size: 32px; pointer-events: none; }

/* Slideshow */
.show { position: fixed; inset: 0; z-index: 20; background: #000; overflow: hidden; cursor: none; }
.show.awake { cursor: default; }
.stage, .slide { position: absolute; inset: 0; }
.slide { opacity: 0; display: grid; place-items: center; overflow: hidden; }
.slide.active { opacity: 1; z-index: 1; }
.show.fx-fade .slide, .show.fx-kenburns .slide { transition: opacity 1.2s ease; }
.slide img, .slide video { max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.show.fx-kenburns .slide img.kb { animation: kb var(--kb-dur, 6s) linear forwards; }
@keyframes kb {
  from { transform: scale(var(--kb-s0)) translate(var(--kb-x0), var(--kb-y0)); }
  to   { transform: scale(var(--kb-s1)) translate(var(--kb-x1), var(--kb-y1)); }
}
.show-caption { position: absolute; left: 32px; bottom: 76px; z-index: 2; font-family: var(--serif); font-size: 22px; line-height: 30px;
  text-shadow: 0 1px 12px rgba(0,0,0,.8); transition: opacity .4s; max-width: 70vw; }
.show-caption small { display: block; font: 600 11px/16px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--champagne); }
.show-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 2; }
.show-progress i { display: block; height: 100%; width: 0; background: var(--amber); }
.show-controls { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 4px;
  padding: 6px; background: rgba(24,25,30,.9); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: opacity .4s; }
.show-controls select { height: 34px; background: var(--s2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 6px; }
.show-controls .on { color: var(--amber); }
.show-count { min-width: 64px; text-align: center; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.show:not(.awake) .show-controls, .show:not(.awake) .show-caption { opacity: 0; pointer-events: none; }

/* Modal + toast */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(12,13,15,.92); backdrop-filter: blur(24px); }
.modal-card { width: min(440px, 100%); max-height: 80vh; overflow: auto; background: var(--s2); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 24px; }
.modal-card h2 { font-size: 24px; line-height: 32px; margin-bottom: 16px; }
.modal-card .list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.modal-card .list button { text-align: left; padding: 10px 12px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; }
.modal-card .list button:hover { border-color: var(--amber); }
.modal-card .list small { color: var(--text-2); margin-left: 8px; }
.field { display: flex; gap: 8px; }
.field input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); }
.field input:focus { border-color: var(--amber); outline: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 40; padding: 10px 16px; background: var(--s3);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: 0 16px 40px -10px rgba(0,0,0,.65); }

/* Nav extras */
.nav .count { font-size: 11px; font-weight: 600; min-width: 20px; padding: 0 6px; border-radius: 999px; text-align: center;
  background: var(--amber); color: var(--bg); line-height: 18px; }
.side-foot .ana { color: var(--champagne); }

/* Timeline */
.month { font-size: 32px; line-height: 40px; margin: 40px 0 20px; padding-top: 8px; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.month:first-of-type { border-top: 0; }
.month .muted { font-family: var(--sans); font-size: 14px; margin-left: 8px; }
.day { scroll-margin-top: 90px; }
.rail { position: fixed; right: 12px; top: 96px; bottom: 24px; z-index: 3; display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
  padding: 8px 6px; font-size: 11px; text-align: right; scrollbar-width: none; }
.rail a { color: var(--text-3); cursor: pointer; padding: 1px 6px; border-radius: var(--r); text-decoration: none; }
.rail a:hover { color: var(--champagne); background: var(--amber-tint); }
.rail .rail-year { color: var(--text-2); font-weight: 600; margin-top: 8px; font-size: 12px; }
@media (min-width: 861px) { body:has(.rail) #view { padding-right: 84px; } }

/* Notes, checkboxes */
.note { padding: 12px 16px; border: 1px solid rgba(229,169,60,.25); background: var(--amber-tint); border-radius: var(--r-lg); color: var(--champagne); margin: 0 0 24px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 16px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--amber); }
.small { font-size: 12px; line-height: 18px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* Clean-up page */
.tile.rv { cursor: pointer; }
.tile.rv .badge { top: 8px; bottom: auto; }
.tile.rv.keep { border: 2px solid var(--amber); cursor: default; }
.tile.rv.keep .badge { background: var(--amber); color: var(--bg); }
.tile.rv.del { border: 2px solid #ff8a7a; }
.tile.rv.del img { opacity: .45 !important; filter: grayscale(.6); }
.tile.rv.del::after { content: 'Delete'; position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r);
  background: #ff8a7a; color: #2b0000; font-size: 11px; font-weight: 600; letter-spacing: .04em; }

/* Narrow screens */
@media (max-width: 860px) {
  :root { --side: 0px; --row: 110px; }
  .sidebar { position: sticky; top: 0; inset: auto; width: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px;
    border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand { font-size: 22px; padding: 0; }
  .brand .crest { width: 24px; height: 24px; }
  .nav { flex-direction: row; }
  .nav a { padding: 6px 10px; }
  .nav a.soon, .side-foot #who, .side-foot #driveLink { display: none; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; padding: 0; white-space: nowrap; }
  .main { margin: 0; }
  .topbar { top: 57px; padding: 12px 16px; gap: 8px; }
  .search { min-width: 0; }
  .topbar .btn { padding: 0 12px; }
  #view { padding: 20px 16px 120px; }
  /* Headings get the full width; their buttons wrap underneath. */
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head > .btn { align-self: flex-start; }
  .page-head:has(> .btn) { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .page-head:has(> .btn) > .grow { flex: 1 0 100%; }
  .hero { grid-template-columns: 1fr; }
  .hero-img { aspect-ratio: 16/9; }
  .hero-body { padding: 20px; }
  .hero h1, .page-head h1, .title-edit { font-size: 30px; line-height: 36px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .selbar { left: 16px; right: 16px; transform: none; flex-wrap: wrap; }
  .p-controls { left: 8px; right: 8px; transform: none; flex-wrap: wrap; justify-content: center; }
  .sh-settings .music { margin-left: 0; }
  .uploader { right: 16px; bottom: 16px; }
  .rail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .show.fx-kenburns .slide img.kb { animation: none; }
  .tile img, .album-card .cover img { transition: none; }
}

/* Storage meter */
.storage { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; color: var(--text-2); }
.storage .bar { height: 4px; }
.storage .bar.full i { background: #ff8a7a; }
.storage a { color: var(--champagne) !important; }

/* People */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 24px; margin-bottom: 16px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; text-align: center; }
.person b { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 28px; margin-top: 8px; }
.person small { color: var(--text-2); }
.person small em { font-style: normal; color: var(--champagne); }
.face { display: inline-block; flex: none; border-radius: 50%; background-color: var(--s2); background-repeat: no-repeat;
  border: 1px solid var(--line-2); }
.person:hover .face { border-color: var(--amber); box-shadow: 0 0 20px -4px rgba(229,169,60,.35); }
.face-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.face-group { padding: 16px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 12px; }
.crops { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crops .more { color: var(--text-2); font-size: 12px; }
.crops.pick .face { cursor: pointer; position: relative; }
.crops.pick .face.no { opacity: .35; border: 2px solid #ff8a7a; }
.row-actions { display: flex; gap: 8px; margin: 16px 0 8px; }
@media (max-width: 860px) { .side-foot .storage { display: none; } .face-groups { grid-template-columns: 1fr; } }

/* Display rotation. A quarter-turned image is sized to the box's swapped
   dimensions using the box's aspect ratio (--box-ar, width / height), so no
   size containers are needed; those sent Chrome into layout loops in grids. */
.tile, .pick { --box-ar: var(--ar); }
.cover, .slide-card .thumbbox { --box-ar: 1.3333; }
img.rot180 { transform: rotate(180deg); }
img.rot90, img.rot270 { position: absolute; top: 50%; left: 50%; width: calc(100% / var(--box-ar, 1)) !important; height: calc(100% * var(--box-ar, 1)) !important; max-width: none; max-height: none; }
img.rot90 { transform: translate(-50%, -50%) rotate(90deg); }
img.rot270 { transform: translate(-50%, -50%) rotate(270deg); }
.tile:hover img.rot90 { transform: translate(-50%, -50%) rotate(90deg) scale(1.015); }
.tile:hover img.rot270 { transform: translate(-50%, -50%) rotate(270deg) scale(1.015); }
.tile:hover img.rot180 { transform: rotate(180deg) scale(1.015); }
.v-stage .frame { position: absolute; top: 50%; left: 50%; width: 100cqw; height: 100cqh; transform: translate(-50%, -50%); display: block; overflow: hidden; }
/* The frame has a definite size, so the picture can fill it and letterbox with contain. */
.v-stage .frame > img, .v-stage .frame > video { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; }
.v-stage .frame.rot90, .v-stage .frame.rot270 { width: 100cqh; height: 100cqw; }
.v-stage .frame.rot90 { transform: translate(-50%, -50%) rotate(90deg); }
.v-stage .frame.rot180 { transform: translate(-50%, -50%) rotate(180deg); }
.v-stage .frame.rot270 { transform: translate(-50%, -50%) rotate(270deg); }

/* Photo viewer */
.viewer { position: fixed; inset: 0; z-index: 25; background: #0c0d0f; display: flex; flex-direction: column; }
.v-top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--s1); flex: none; }
.v-info { display: flex; flex-direction: column; min-width: 0; }
.v-info b { font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-info small { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-count { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.v-tools { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.vbtn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 52px; height: 48px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--r); background: none; color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; text-decoration: none; }
.vbtn span { font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--text-2); }
.vbtn:hover { border-color: var(--line-2); background: var(--s2); }
.vbtn.on { color: var(--amber); }
.vbtn[disabled] { opacity: .3; pointer-events: none; }
.v-stage { position: relative; flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; overflow: hidden; }
.v-stage .frame img, .v-stage .frame video { width: 100%; height: 100%; object-fit: contain; }
.v-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 72px; border: 0; border-radius: var(--r);
  background: rgba(24,25,30,.6); color: var(--text); font-size: 32px; cursor: pointer; }
.v-nav:hover { background: rgba(41,43,52,.9); color: var(--champagne); }
.v-nav.prev { left: 12px; }
.v-nav.next { right: 12px; }
.viewer.cropping .v-nav, .viewer.cropping .v-tools .vbtn:not([data-v="close"]) { display: none; }

/* Crop */
.crop-wrap { position: relative; overflow: hidden; touch-action: none; }
.crop-wrap img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.crop-box { position: absolute; box-shadow: 0 0 0 9999px rgba(0,0,0,.6); outline: 2px solid var(--amber); cursor: move; touch-action: none;
  background-image: linear-gradient(rgba(255,255,255,.25), rgba(255,255,255,.25)), linear-gradient(rgba(255,255,255,.25), rgba(255,255,255,.25)),
    linear-gradient(90deg, rgba(255,255,255,.25), rgba(255,255,255,.25)), linear-gradient(90deg, rgba(255,255,255,.25), rgba(255,255,255,.25));
  background-size: 100% 1px, 100% 1px, 1px 100%, 1px 100%; background-position: 0 33.33%, 0 66.66%, 33.33% 0, 66.66% 0; background-repeat: no-repeat; }
.crop-box i { position: absolute; width: 18px; height: 18px; background: var(--amber); border: 2px solid #0c0d0f; border-radius: 3px; }
.crop-box i[data-h="nw"] { left: -9px; top: -9px; cursor: nwse-resize; }
.crop-box i[data-h="ne"] { right: -9px; top: -9px; cursor: nesw-resize; }
.crop-box i[data-h="se"] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.crop-box i[data-h="sw"] { left: -9px; bottom: -9px; cursor: nesw-resize; }
.crop-box i[data-h="n"] { left: calc(50% - 9px); top: -9px; cursor: ns-resize; }
.crop-box i[data-h="s"] { left: calc(50% - 9px); bottom: -9px; cursor: ns-resize; }
.crop-box i[data-h="e"] { right: -9px; top: calc(50% - 9px); cursor: ew-resize; }
.crop-box i[data-h="w"] { left: -9px; top: calc(50% - 9px); cursor: ew-resize; }
.v-cropbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px;
  background: var(--s1); border-top: 1px solid var(--line); }
.v-cropbar .aspects, .v-cropbar .row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .v-top { flex-wrap: wrap; }
  .v-tools { width: 100%; justify-content: space-between; margin: 0; }
  .vbtn { min-width: 0; flex: 1; height: 44px; font-size: 20px; }
  .vbtn span { display: none; }
  .v-nav { display: none; }
}

/* Full-screen slideshow player (player.js) */
.player { position: fixed; inset: 0; z-index: 40; background: #000; cursor: none; }
.player.awake { cursor: default; }
.player canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.p-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 2; }
.p-progress i { display: block; height: 100%; width: 0; background: var(--amber); }
.p-controls { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 2; display: flex; align-items: center; gap: 4px; padding: 6px;
  background: rgba(24,25,30,.9); backdrop-filter: blur(16px); border: 1px solid var(--line); border-radius: var(--r-lg); transition: opacity .4s; }
.p-count { min-width: 64px; text-align: center; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.player:not(.awake) .p-controls { opacity: 0; pointer-events: none; }

/* Photo picker */
.modal-card.wide { width: min(1100px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.picker { overflow-y: auto; flex: 1; min-height: 200px; padding-right: 4px; }
.picker h3 { font-size: 16px; margin: 16px 0 8px; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.pick-grid::after { content: ''; flex-grow: 999999; }
.pick { --ar: 1.5; position: relative; flex-grow: calc(var(--ar) * 100); width: calc(var(--ar) * 110px); aspect-ratio: var(--ar); padding: 0; border: 2px solid transparent;
  border-radius: 2px; background: var(--s1); overflow: hidden; cursor: pointer; }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick.on { border-color: var(--amber); }
.pick.on::after { content: '\2713'; position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--amber); color: var(--bg);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.pick .badge { position: absolute; left: 6px; bottom: 6px; padding: 0 6px; border-radius: var(--r); background: rgba(12,13,15,.75); font-size: 11px; }
.modal-actions .grow { flex: 1; align-self: center; }

/* Slideshow builder */
.sub-edit { display: block; width: 100%; max-width: 720px; background: none; border: 1px solid transparent; border-radius: var(--r); padding: 2px 6px; margin: 2px 0 0 -7px;
  font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--text-2); }
.sub-edit:hover, .sub-edit:focus { border-color: var(--line-2); outline: 0; }
.sh-settings { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 16px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.sh-settings label:not(.btn):not(.check) { display: flex; gap: 8px; align-items: center; color: var(--text-2); }
.sh-settings select, .pr-options select { height: 36px; background: var(--s2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 0 8px; color: var(--text); }
.sh-settings .check { margin: 0; }
.sh-settings .music { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.slides { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.slide-card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; cursor: grab; display: flex; flex-direction: column; }
.slide-card.drop-before { border-color: var(--amber); box-shadow: -4px 0 0 var(--amber); }
.slide-card .thumbbox { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--s2); }
.slide-card .thumbbox img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slide-card .num { position: absolute; top: 8px; left: 8px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: rgba(12,13,15,.75);
  font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.slide-card .badge { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: var(--r); background: rgba(12,13,15,.75); font-size: 11px; font-weight: 600; }
.slide-card .cap { margin: 8px; height: 34px; padding: 0 10px; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r); font-size: 13px; }
.slide-card .cap:focus { border-color: var(--amber); outline: 0; }
.slide-tools { display: flex; justify-content: space-between; padding: 0 4px 6px; }
.slide-tools .icon-btn { width: 34px; height: 30px; font-size: 15px; }

/* Sharing */
.share-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.share-form input { flex: 1; min-width: 160px; height: 38px; padding: 0 12px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); }
.share-form select { height: 38px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 0 8px; }
.new-link { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; margin-bottom: 8px; background: var(--amber-tint); border: 1px solid rgba(229,169,60,.3); border-radius: var(--r-lg); }
.new-link input { flex: 1; min-width: 200px; height: 38px; padding: 0 10px; background: var(--s1); border: 1px solid var(--line-2); border-radius: var(--r); font-size: 12px; }
.sub-h { font-size: 18px; margin: 20px 0 8px; }
.share-list { display: flex; flex-direction: column; gap: 8px; }
.share-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.share-row .grow { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.share-row small { color: var(--text-2); font-size: 12px; }
.share-row.off { opacity: .5; }

/* Guest page */
body.guest { min-height: 100vh; }
.guest-top { padding: 16px 24px; border-bottom: 1px solid var(--line); }
.guest-top .brand { font-size: 22px; }
.guest-top .crest { width: 24px; height: 24px; }
.guest-main { max-width: 1400px; margin: 0 auto; padding: 32px 24px 80px; }
.guest-head { text-align: center; margin: 16px auto 32px; max-width: 720px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.guest-head h1 { font-size: 48px; line-height: 56px; }
.guest-head .lede { margin: 0; }
.guest-head .btn { margin-top: 12px; }
.lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(12,13,15,.97); display: grid; place-items: center; padding: 56px 72px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; }
.lb-caption { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; font-family: var(--serif); font-size: 18px; color: var(--text-2); margin: 0; }
.lb-close { position: absolute; top: 12px; right: 12px; }
@media (max-width: 860px) { .guest-head h1 { font-size: 32px; line-height: 40px; } .lightbox { padding: 48px 8px; } .lightbox .v-nav { display: none; } }

/* Studio */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.st-stage { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; display: grid; place-items: center; min-height: 60vh; }
.st-stage canvas { max-width: 100%; max-height: 72vh; box-shadow: 0 16px 40px -10px rgba(0,0,0,.65); cursor: grab; touch-action: none; }
.st-panel { display: flex; flex-direction: column; gap: 10px; padding: 20px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); position: sticky; top: 90px; }
.st-panel h3 { font-size: 16px; margin-top: 8px; }
.st-panel .chips { margin: 0; gap: 6px; }
.st-panel .chip { height: 30px; font-size: 12px; }
.st-input { width: 100%; padding: 8px 10px; background: var(--s2); border: 1px solid var(--line); border-radius: var(--r); font: inherit; resize: vertical; }
.st-input:focus { border-color: var(--amber); outline: 0; }
.st-panel input[type=range] { accent-color: var(--amber); }
@media (max-width: 1000px) { .studio { grid-template-columns: 1fr; } .st-panel { position: static; } }

/* Print */
.pr-options { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 16px; margin-bottom: 24px; background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); }
.pr-options label:not(.check) { display: flex; gap: 8px; align-items: center; color: var(--text-2); }
.pr-options .check { margin: 0; }
.pr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; margin-bottom: 24px; }
.pr-item { display: flex; flex-direction: column; gap: 10px; }
.pr-paper { background: #fff; box-shadow: 0 10px 30px -10px rgba(0,0,0,.7); margin: 0 auto; width: 100%; display: grid; overflow: hidden; }
.pr-paper.bordered { padding: 4%; }
.pr-photo { overflow: hidden; position: relative; width: 100%; height: 100%; }
.pr-photo img { width: 100%; height: 100%; display: block; }
.pr-photo.fill img { object-fit: cover; }
.pr-photo.fit img { object-fit: contain; }
.pr-meta { display: flex; flex-direction: column; gap: 2px; }
.pr-meta b { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-meta .btn { align-self: flex-start; height: auto; padding: 0; }
.pr-q { font-size: 12px; font-weight: 600; }
.pr-q.ok { color: #8fd18f; }
.pr-q.warn { color: var(--champagne); }
.pr-q.bad { color: #ff8a7a; }
