@font-face {
  font-family: "Barlow Condensed";
  src: url("/assets/barlow-condensed-700.woff2") format("woff2");
  font-display: swap;
  font-weight: 700;
}

:root {
  color-scheme: dark;
  --page: #101012;
  --panel: #1c1a1e;
  --well: #151416;
  --field: #232125;
  --line: #40393f;
  --text: #fbf7f8;
  --muted: #c8c0c5;
  --accent: #ff91b8;
  --ink: #30111d;
  --radius: 18px;
  --control: 10px;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--page);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, fieldset { margin: 0; }
body { min-width: 280px; }
img, canvas { display: block; max-width: 100%; }
button, select, textarea, input { font: inherit; }
button, select, summary { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled, select:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#editor, #templates { scroll-margin-top: 16px; }

.container { width: min(100% - 64px, 1160px); margin-inline: auto; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; z-index: 5; top: 10px; left: 10px; background: var(--accent); color: var(--ink); padding: 10px; border-radius: var(--control); }

.site-header { background: #151416; border-bottom: 1px solid #363035; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; min-height: 68px; }
.brand { display: inline-flex; width: fit-content; align-items: center; gap: 9px; font: 700 26px/1 var(--display); white-space: nowrap; }
.brand-suffix { color: var(--accent); margin-left: 3px; }
.brand-mark { position: relative; display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 8px; background: var(--accent); }
.brand-mark::before { content: ""; border: 1.5px solid var(--ink); border-radius: 3px; width: 16px; height: 13px; }
.brand-mark::after { content: ""; position: absolute; margin-left: 2px; border: 3px solid transparent; border-right: 0; border-left: 4px solid var(--ink); }
.topbar nav { display: flex; align-items: center; gap: 30px; font-size: 14px; font-weight: 550; }
.topbar nav a { color: var(--muted); white-space: nowrap; padding-block: 12px; }
.topbar nav a:is(:hover, [aria-current]) { color: var(--text); }
.topbar nav a[aria-current] { box-shadow: inset 0 -1px var(--accent); }
.nav-templates { justify-self: end; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.nav-templates span { margin-left: 3px; color: var(--accent); }
.nav-templates:hover { border-color: var(--accent); }

.tool-page { position: relative; isolation: isolate; }
.tool-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("/assets/grain.png") repeat;
  opacity: .035;
  pointer-events: none;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(325px, 1fr);
  align-items: start;
  gap: clamp(30px, 5vw, 78px);
  padding-block: clamp(32px, 4vw, 62px) 12px;
}
.hero-left { display: grid; gap: 27px; min-width: 0; }
.hero-copy { display: grid; justify-items: start; gap: 14px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 700; line-height: 1.4; text-transform: uppercase; letter-spacing: .14em; }
h1 { font: 700 clamp(44px, 6.5vw, 92px)/.91 var(--display); letter-spacing: -.027em; text-transform: uppercase; }
.hero h1 span { display: block; color: var(--accent); }
.intro { color: var(--muted); font-size: 16px; line-height: 1.5; max-width: 49ch; }
.hero-copy .button { min-height: 41px; padding-inline: 17px; }
h2 { font: 700 clamp(30px, 3vw, 42px)/1.02 var(--display); letter-spacing: .005em; }
h3 { font-size: 15px; font-weight: 650; line-height: 1.3; }

.editor { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 36px #0004; }
.workspace { min-width: 0; }
.stage { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; background: #141315; border: 1px solid var(--line); border-radius: 12px; }
.pane { position: relative; display: grid; place-items: center; min-width: 0; }
.frame { width: 100%; aspect-ratio: 16/9; display: grid; overflow: hidden; }
.frame :is(img, canvas) { grid-area: 1/1; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; }
.stage[data-ratio="1:1"] .frame { aspect-ratio: 1; max-width: 235px; }
.stage[data-ratio="4:5"] .frame { aspect-ratio: 4/5; max-width: 195px; }
.stage[data-ratio="9:16"] .frame { aspect-ratio: 9/16; max-width: 146px; }
.pane-label { position: absolute; top: 8px; left: 8px; padding: 4px 7px; border-radius: 4px; background: #111015dc; color: #fff; font-size: 11px; font-weight: 650; }
.stage::before, .stage::after { position: absolute; left: calc(50% - 1px); z-index: 1; content: ""; width: 2px; pointer-events: none; }
.stage::before { inset-block: 0; background: var(--accent); opacity: .8; }
.stage::after { top: 0; height: 23%; background: #fff6fa; box-shadow: 0 0 10px var(--accent); animation: scan-seam 1.65s ease-in-out 2 forwards; }
@keyframes scan-seam { from { transform: translateY(-100%); } to { transform: translateY(440%); } }
.stage.is-drop { outline: 2px solid var(--accent); }
.preview-meta { display: flex; align-items: center; justify-content: space-between; min-height: 32px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.text-button { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 7px; color: var(--text); background: transparent; border: 0; border-radius: 5px; font-size: 12px; }
.text-button:hover { background: var(--field); }
.play-icon { width: 0; height: 0; border-block: 4px solid transparent; border-left: 6px solid currentColor; }
[aria-pressed="true"] .play-icon { width: 7px; height: 8px; border: 0; border-inline: 2px solid currentColor; }

.controls { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 22px; border: 0; }
.control, .ratio-control { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.control > label, .controls legend { color: var(--text); font-weight: 600; font-size: 13px; }
.ratio-control { min-width: 0; padding: 0; border: 0; }
.ratio-control legend { padding: 0; margin: 0 0 7px; }
.control > label { display: flex; justify-content: space-between; gap: 6px; }
select, textarea, .button { border: 1px solid var(--line); border-radius: var(--control); background: var(--field); color: var(--text); }
select { min-height: 38px; min-width: 0; padding: 0 9px; font-size: 13px; }
textarea { display: block; width: 100%; min-height: 58px; resize: vertical; padding: 9px 10px; font-size: 14px; line-height: 1.45; }
select:hover, textarea:hover { border-color: #a5788b; }
.ratio-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; padding: 3px; background: var(--well); border: 1px solid var(--line); border-radius: var(--control); }
.ratio-options label { position: relative; cursor: pointer; }
.ratio-options input { position: absolute; opacity: 0; }
.ratio-options span { display: grid; place-items: center; min-height: 31px; font-size: 12px; border-radius: 5px; color: var(--muted); }
.ratio-options input:checked + span { background: #463641; color: var(--text); }
.ratio-options input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.media-row { display: flex; min-width: 0; gap: 7px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 39px; padding-inline: 12px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.button.quiet { background: transparent; color: var(--muted); }
.button.quiet:hover { border-color: #4e5059; color: var(--text); }
.button.media-button { min-width: 0; min-height: 60px; flex: 1; justify-content: flex-start; gap: 11px; border: 1px dashed #786571; color: var(--text); background: #211e22; }
.button.media-button:is(:hover, :focus-visible), .media-row.is-drop .media-button { border-color: var(--accent); }
.media-button .plus-icon { display: grid; flex: 0 0 30px; height: 30px; place-items: center; border-radius: 8px; color: var(--accent); background: #382931; }
.media-button .plus-icon::before, .media-button .plus-icon::after { inset: 14px 8px auto; }
#media-name { overflow: hidden; text-overflow: ellipsis; }
.plus-icon { position: relative; flex: 0 0 12px; height: 12px; }
.plus-icon::before, .plus-icon::after { content: ""; position: absolute; inset: 5px 1px auto; height: 1px; background: currentColor; }
.plus-icon::after { transform: rotate(90deg); }
.icon-only { min-width: 38px; padding-inline: 8px; font-size: 20px; }
.animation-controls { display: grid; grid-template-columns: minmax(0, 1fr) 82px; gap: 8px; }
.clip-control input { width: 100%; margin: 0; accent-color: var(--accent); }
.clip-control output { color: var(--muted); font-variant-numeric: tabular-nums; }
.output-settings > summary { display: none; }
.output-settings > :is(.animation-controls, .clip-control):not([hidden]) { margin-top: 12px; }
.export-controls { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; margin-top: auto; padding-top: 6px; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); min-height: 42px; }
.button.primary:hover:not(:disabled) { background: #ffb4cf; border-color: #ffb4cf; }
.button.primary:disabled { opacity: .62; }
.download-icon { position: relative; width: 13px; height: 12px; border-bottom: 1.5px solid currentColor; }
.download-icon::before { content: ""; position: absolute; top: 0; left: 6px; height: 7px; border-left: 1.5px solid currentColor; }
.download-icon::after { content: ""; position: absolute; top: 3px; left: 4px; width: 5px; height: 5px; transform: rotate(45deg); border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.status { color: var(--muted); font-size: 12px; line-height: 1.4; }
.status:empty { margin-top: -14px; }
.status[data-error] { color: #ff9797; }
.download-again { align-self: flex-start; border-bottom: 1px solid currentColor; font-size: 13px; }
.script-note { grid-column: 1 / -1; padding: 12px 18px; color: var(--muted); font-size: 14px; }

.section { margin-top: 56px; }
.section h2 { margin-bottom: 20px; }

.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 14px; }
.template-card { min-width: 0; }
.template-art { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #211b30; }
.template-art img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }
.template-card h3 { margin-top: 11px; }
.remix { position: absolute; top: 7px; right: 7px; padding: 6px 7px; border: 1px solid #b6b3c572; border-radius: 6px; color: #fff; background: #171419ee; font-size: 11px; font-weight: 680; line-height: 1.2; transition: transform 120ms ease, background 120ms ease, color 120ms ease; }
.template-link:is(:hover, :focus-visible) .remix { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.template-link:active .remix { transform: scale(.92) rotate(-5deg); }
.template-link { display: block; border-radius: 10px; }

.guide ol { list-style: none; counter-reset: steps; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.guide li { display: flex; gap: 14px; padding: 12px 0; counter-increment: steps; }
.guide li::before { content: counter(steps, decimal-leading-zero); display: grid; flex: 0 0 24px; height: 24px; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--accent); font-size: 12px; }
.guide p, .faq p, .policy p { max-width: 70ch; color: var(--muted); font-size: 15px; line-height: 1.65; }
.guide h3 { margin-bottom: 5px; }
.faq { max-width: 820px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 14px; padding: 13px 2px; font-size: 14px; font-weight: 580; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 16px; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq p { padding: 0 24px 14px 2px; }
.related { display: flex; flex-wrap: wrap; gap: 12px 24px; padding-bottom: 44px; }
.related a { color: var(--text); font-size: 14px; font-weight: 600; }
.related span { color: var(--muted); }
.related a:hover, .site-footer nav a:hover { color: var(--accent); }
.policy { padding-block: 50px 70px; min-height: 50vh; }
.policy h2 { margin-block: 24px 10px; }
.policy p { margin-top: 10px; }
.policy a { text-decoration: underline; }
.site-footer { border-top: 1px solid var(--line); padding-block: 28px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; align-items: start; gap: 12px; }
.site-footer nav { display: grid; justify-items: start; gap: 10px; font-size: 13px; }
.site-footer nav a { color: var(--muted); }
.site-footer p { margin-top: 26px; color: var(--muted); font-size: 12px; line-height: 1.4; }

@media (max-width: 960px) {
  .container { width: calc(100% - 40px); }
  .topbar nav { gap: 18px; }
  .controls { padding: 16px; }
  .hero { gap: 24px; }
}
@media (max-width: 720px) {
  .container { width: calc(100% - 32px); }
  .topbar { display: flex; justify-content: space-between; min-height: 58px; gap: 12px; }
  .nav-templates { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 15px; padding-block: 25px 0; }
  .hero-left { gap: 12px; }
  .controls { gap: 10px; }
  .status:empty { margin-top: -10px; }
  .output-settings > summary { display: list-item; padding-block: 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
  .output-settings[open] > summary { margin-bottom: 8px; }
  .hero-copy { gap: 9px; }
  .hero h1 { font-size: clamp(43px, 10.8vw, 61px); }
  .hero h1 span { display: block; }
  .intro { font-size: 14px; }
  .stage[data-ratio="1:1"] .frame { max-width: 165px; }
  .stage[data-ratio="4:5"] .frame { max-width: 132px; }
  .stage[data-ratio="9:16"] .frame { max-width: 84px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 11px; }
  .guide ol { grid-template-columns: 1fr; gap: 0; }
  .section { margin-top: 36px; }
  .section h2 { margin-bottom: 14px; }
}

@media (max-width: 440px) {
  .container { width: calc(100% - 28px); }
  .topbar { gap: 8px; }
  .topbar nav { gap: 10px; font-size: 11px; }
  .brand { gap: 6px; font-size: 21px; }
  .brand-mark { width: 23px; height: 23px; border-radius: 6px; }
  .brand-mark::before { width: 14px; height: 11px; }
  .controls { padding: 13px; }
  select, textarea { font-size: 16px; }
  .footer-grid { grid-template-columns: 1.15fr 1fr .75fr; }
}

@media (max-width: 360px) {
  .topbar nav { gap: 7px; font-size: 10px; }
  .brand { gap: 4px; font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .remix { transition: none; }
  .stage::after { animation: none; opacity: 0; }
}
