/* svg.denys.fast host UI — built on denys.fast tokens (Obsidian default). */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
::selection { background: var(--selection-bg); }
a { color: inherit; text-decoration: none; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-sunken);
  padding: .12em .45em; border-radius: var(--radius-sm); color: var(--text-secondary); }

/* ---- topbar ---- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-6); background: var(--bg);
  border-bottom: 1px solid var(--divider); }
.topbar::after { /* brand hairline */ content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px; background: var(--gradient-brand); opacity: .5; }
.topbar .spacer { flex: 1; }
.brandline { display: flex; align-items: center; gap: var(--space-3); }
.brandline::after { content: ""; width: 1px; height: 22px; background: var(--divider); order: 1; }
.logo-slot { order: 0; transform: scale(.46); transform-origin: left center; width: 190px; height: 52px; overflow: visible; }
.svg-mark { order: 2; }

/* secondary SVG-animations mark */
.svg-mark { display: inline-flex; line-height: 0; }
.svg-mark .mk-frame { fill: none; stroke: var(--primary); stroke-width: 2; }
.svg-mark .mk-lines rect { fill: var(--accent); transform-box: fill-box; transform-origin: left center;
  animation: mk-slide 2.4s var(--ease-in-out) infinite; }
.svg-mark .mk-lines rect:nth-child(2) { animation-delay: .18s; }
.svg-mark .mk-lines rect:nth-child(3) { animation-delay: .36s; }
.svg-mark .mk-play { fill: var(--primary); transform-box: fill-box; transform-origin: center;
  animation: mk-pulse 2.4s var(--ease-in-out) infinite; }
@keyframes mk-slide { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes mk-pulse { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.1); opacity: 1; } }

/* theme dropdown */
.theme-pick { display: inline-flex; align-items: center; gap: var(--space-2); }
.theme-pick .th-ic { color: var(--text-muted); font-size: 15px; }
.theme-pick select { height: 36px; padding: 0 var(--space-6) 0 var(--space-3); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: var(--radius-md); cursor: pointer;
  font-family: inherit; font-size: var(--fs-body-sm); appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  transition: border-color var(--dur-fast); }
.theme-pick select:hover { border-color: var(--border-strong); }
.theme-pick select:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary); }

/* ---- layout ---- */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--space-7) var(--space-6); flex: 1; }
.overline { display: inline-block; font-size: var(--fs-overline); letter-spacing: var(--ls-overline);
  text-transform: uppercase; color: var(--primary); font-weight: var(--fw-bold); }
h1.page-title { font-size: var(--fs-h1); line-height: var(--lh-h1);
  margin: var(--space-2) 0 var(--space-5); font-weight: var(--fw-bold); letter-spacing: -.02em; }
.lead { color: var(--text-secondary); font-size: var(--fs-body-lg); max-width: 60ch; }
h2.cat-title { font-size: var(--fs-h4); margin: var(--space-7) 0 var(--space-4);
  display: flex; align-items: center; gap: var(--space-2); font-weight: var(--fw-bold); }
.chev, .cat-title .chev { color: var(--primary); font-weight: var(--fw-black); }

/* ---- hero (landing) ---- */
.landing { display: flex; align-items: center; justify-content: center; }
.hero { text-align: center; max-width: 600px; margin: auto; padding: var(--space-6) 0; }
.hero-mark { margin-bottom: var(--space-5); filter: drop-shadow(0 10px 26px color-mix(in srgb, var(--primary) 45%, transparent)); }
.hero-mark svg { width: 76px; height: 76px; }
.hero h1 { font-size: clamp(34px, 6vw, var(--fs-display)); line-height: var(--lh-display);
  margin: var(--space-3) 0; font-weight: var(--fw-black); letter-spacing: -.03em; }
.hero .lead { margin: 0 auto; color: var(--text-secondary); }

/* ---- cards / badges ---- */
.card { background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: var(--space-5); box-shadow: var(--shadow-sm); }
.badge { display: inline-block; font-size: var(--fs-caption); padding: .16em .65em;
  border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--text-secondary);
  margin: 0 var(--space-1) var(--space-1) 0; }
.tech { font-family: var(--font-mono); font-size: var(--fs-caption); color: var(--text-muted); }

/* ---- gallery grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-5); }
.work { position: relative; display: block; border-radius: var(--radius-xl); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-elevated); box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base), border-color var(--dur-base); }
.work:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.thumb { position: relative; aspect-ratio: 16/10; background: var(--surface-sunken); overflow: hidden;
  border-bottom: 1px solid var(--border); }
.thumb iframe { position: absolute; inset: 0; width: 250%; height: 250%; border: 0;
  transform: scale(.4); transform-origin: top left; pointer-events: none; }
.thumb-guard { position: absolute; inset: 0; }
.work-body { padding: var(--space-4); }
.work-title { font-weight: var(--fw-bold); margin-bottom: var(--space-2); letter-spacing: -.01em; }
.work-tags { line-height: 1.9; }

/* ---- player ---- */
.player .overline { margin-bottom: var(--space-2); }
.player .lead { margin: var(--space-3) 0; font-size: var(--fs-body); }
.player .work-tags { margin: var(--space-3) 0 var(--space-5); }
.stage-frame { position: relative; border: 1px solid var(--border); border-radius: var(--radius-xl);
  overflow: hidden; background: var(--surface-sunken); box-shadow: var(--shadow-lg); aspect-ratio: 4/3; }
.stage-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.stage-frame:fullscreen { border-radius: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); align-items: center; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0 var(--space-4); height: 44px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface-elevated); color: var(--text);
  font-family: inherit; font-weight: var(--fw-medium); font-size: var(--fs-body); cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast); }
.btn:hover { background: var(--surface); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: var(--fw-bold); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn .ic { display: block; }
.chev-i { font-weight: var(--fw-black); }

.menu { position: relative; }
.menu-pop { position: absolute; top: 50px; left: 0; min-width: 190px; z-index: 20;
  background: var(--surface-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: var(--space-2); display: none; }
.menu-pop.open { display: block; }
.menu-pop a { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: var(--fs-body-sm); }
.menu-pop a:hover { background: var(--surface); color: var(--text); }
.menu-empty { display: block; padding: var(--space-2) var(--space-3); color: var(--text-muted); font-size: var(--fs-caption); }

.share-out { margin-top: var(--space-4); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--primary); border-radius: var(--radius-md); background: var(--primary-soft);
  font-family: var(--font-mono); font-size: var(--fs-code); display: flex; gap: var(--space-3); align-items: center;
  word-break: break-all; }
.share-out button { margin-left: auto; flex: none; }

/* ---- landing token field ---- */
.token-form { display: flex; gap: var(--space-2); margin: var(--space-6) auto 0; max-width: 440px;
  padding: var(--space-1); border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.token-form input { flex: 1; height: 44px; padding: 0 var(--space-4); border: 0;
  background: transparent; color: var(--text); font-family: var(--font-mono); font-size: var(--fs-body); }
.token-form input:focus { outline: none; }
.token-form:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.token-err { color: var(--error); margin-top: var(--space-3); min-height: 1.2em; font-size: var(--fs-caption); }

/* ---- footer ---- */
.foot { padding: var(--space-5) var(--space-6); text-align: center; color: var(--text-muted);
  font-family: var(--font-mono); font-size: var(--fs-caption); border-top: 1px solid var(--divider); }

/* ---- download modal ---- */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: var(--space-4); background: var(--overlay); }
.modal-back[hidden] { display: none; }
.modal { width: min(440px, 94vw); background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--divider); }
.modal-title { font-weight: var(--fw-bold); font-size: var(--fs-h5); }
.icon-btn { width: 32px; height: 32px; border: 1px solid transparent; background: transparent;
  color: var(--text-muted); border-radius: var(--radius-md); cursor: pointer; font-size: 15px; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.modal-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); }

.seg-row { display: inline-flex; align-self: start; border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden; }
.seg { padding: var(--space-2) var(--space-5); border: 0; background: var(--surface); color: var(--text-secondary);
  font-family: inherit; font-weight: var(--fw-medium); font-size: var(--fs-body-sm); cursor: pointer; }
.seg + .seg { border-left: 1px solid var(--border); }
.seg[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-lbl { font-size: var(--fs-body-sm); color: var(--text-secondary); display: flex; justify-content: space-between; }
.field-lbl b { color: var(--text); font-family: var(--font-num); }
.field-hint { font-size: var(--fs-caption); color: var(--text-muted); }
.field input[type="range"] { width: 100%; accent-color: var(--primary); height: 22px; }
.field select { height: 40px; padding: 0 var(--space-3); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: var(--radius-md); font-family: inherit; font-size: var(--fs-body); cursor: pointer; }
.field select:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary); }

.progress { display: flex; flex-direction: column; gap: var(--space-2); }
.progress[hidden] { display: none; }
.progress-bar { height: 8px; background: var(--surface-sunken); border-radius: var(--radius-full); overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--gradient-brand);
  border-radius: var(--radius-full); transition: width var(--dur-base) var(--ease-out); }
.progress-txt { font-size: var(--fs-caption); color: var(--text-secondary); font-family: var(--font-num); }
.progress-txt.err { color: var(--error); }

.btn.block { width: 100%; height: 46px; }
.muted { color: var(--text-muted); }
.quick-row { display: flex; gap: var(--space-3); border-top: 1px solid var(--divider); padding-top: var(--space-4); }
.quick { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 40px; border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-secondary);
  font-size: var(--fs-body-sm); }
.quick:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.quick .ic { width: 16px; height: 16px; }

@media (max-width: 560px) {
  .wrap { padding: var(--space-5) var(--space-4); }
  .toolbar .btn span:not(.chev-i) { display: none; } /* icons-only toolbar on phones */
  .token-form { flex-wrap: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
