/* ═══════════════════════════════════════════════════════════
   Kyro — inner pages + Studio app  (loaded after main.css)
   ═══════════════════════════════════════════════════════════ */

/* page hero (sub-pages) */
.page-hero { padding: 10rem clamp(1.2rem,5vw,4rem) 3rem; max-width: var(--maxw); margin: 0 auto; }
.page-hero h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem,7vw,5rem); line-height: .98; letter-spacing: -.02em; margin: 1rem 0; }
.page-hero p { color: var(--muted); max-width: 54ch; font-size: 1.1rem; line-height: 1.6; }
.page-hero.center { text-align: center; }
.page-hero.center p { margin-inline: auto; }

/* generic grid cards */
.cards { max-width: var(--maxw); margin: 0 auto; display: grid; gap: 1.4rem; }
.cards.c2 { grid-template-columns: repeat(2,1fr); }
.cards.c3 { grid-template-columns: repeat(3,1fr); }
.card { border: 1px solid var(--line); background: var(--panel); padding: 2rem; transition: transform .35s var(--ease), border-color .35s; }
.card:hover { transform: translateY(-5px); border-color: var(--line-strong); }
.card h3 { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: .6rem; }
.card p { color: var(--muted); line-height: 1.6; }
.card .tag { font-family: var(--font-display); font-size: .68rem; letter-spacing: .22em; color: var(--accent); }

/* legal / FAQ text pages */
.legal-body { max-width: 74ch; margin: 0 auto 6rem; padding: 0 clamp(1.2rem,5vw,4rem); }
.legal-body h3 { font-family: var(--font-display); font-size: 1.2rem; margin: 2.2rem 0 .6rem; }
.legal-body h3:first-child { margin-top: 0; }
.legal-body p { color: var(--muted); line-height: 1.7; }
.legal-body a { color: var(--accent); text-decoration: underline; }

/* pricing */
.pricing-grid { max-width: var(--maxw); margin: 2rem auto 5rem; padding: 0 clamp(1.2rem,5vw,4rem); display: grid; grid-template-columns: repeat(3,1fr); gap: 1.6rem; }
.price-card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 2.2rem 1.8rem; display: flex; flex-direction: column; gap: .5rem; transition: transform .35s var(--ease), border-color .35s; }
.price-card:hover { transform: translateY(-5px); border-color: var(--line-strong); }
.price-card--highlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 20px 50px -20px color-mix(in srgb, var(--accent) 45%, transparent); }
.price-card .tag { font-family: var(--font-display); font-size: .68rem; font-weight: 600; letter-spacing: .22em; color: var(--accent); text-transform: uppercase; }
.price-card h3 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; margin-top: .2rem; }
.price-num { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; letter-spacing: -.02em; }
.price-note { color: var(--muted); font-size: .92rem; line-height: 1.5; margin-bottom: .4rem; }
.price-card ul { list-style: none; margin: .2rem 0 1.4rem; flex: 1; }
.price-card li { padding: .35rem 0 .35rem 1.5rem; position: relative; color: var(--muted); font-size: .92rem; }
.price-card li::before { content: '\2713'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
@media (max-width: 860px) { .pricing-grid { grid-template-columns: 1fr; } }

/* account / profile settings */
.profile-body { max-width: 640px; margin: 0 auto 6rem; padding: 0 clamp(1.2rem,5vw,4rem); display: flex; flex-direction: column; gap: 1.4rem; }
.profile-card h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 1.2rem; }
.profile-card p { color: var(--muted); line-height: 1.6; margin-bottom: 1.2rem; }
.profile-card .btn { margin-top: .2rem; }

/* feature/detail service rows */
.feature { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; padding: 3rem 0; border-bottom: 1px solid var(--line); }
.feature:nth-child(even) .feat-visual { order: -1; }
.feat-visual { aspect-ratio: 4/3; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent), var(--accent-2)); width: 100%; object-fit: cover; display: block; }
.feature h3 { font-family: var(--font-display); font-size: clamp(1.6rem,3.4vw,2.6rem); margin-bottom: 1rem; }
.feature p { color: var(--muted); line-height: 1.7; margin-bottom: 1.2rem; }
.feature ul { list-style: none; }
.feature li { padding: .4rem 0 .4rem 1.6rem; position: relative; color: var(--muted); }
.feature li::before { content: '\2192'; position: absolute; left: 0; color: var(--accent); }

/* team */
.team { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(3,1fr); gap: 1.4rem; }
.member { border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.member .avatar { aspect-ratio: 1; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.member .m-body { padding: 1.2rem 1.4rem; }
.member h4 { font-family: var(--font-display); font-size: 1.2rem; }
.member span { color: var(--muted); font-size: .8rem; letter-spacing: .1em; }

/* contact form */
.contact-wrap { max-width: 640px; margin: 0 auto; }
.field { margin-bottom: 1.4rem; }
.field label { display: block; font-family: var(--font-display); font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.field input, .field textarea, .field select {
  width: 100%; padding: .9rem 1rem; background: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--font-body); font-size: 1rem;
  transition: border-color .25s;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 140px; resize: vertical; }
.form-note { color: var(--muted); font-size: .85rem; margin-top: 1rem; }

/* ── STUDIO ─────────────────────────────────────────── */
.studio { padding-top: 5rem; min-height: 100vh; }
.studio-shell { max-width: 1120px; margin: 0 auto; padding: 2rem clamp(1.2rem,4vw,3rem) 5rem; }
.studio-head { text-align: center; margin-bottom: 2.4rem; }
.studio-head h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(2rem,5vw,3.4rem); letter-spacing: -.02em; }
.studio-head p { color: var(--muted); margin-top: .6rem; }

.input-card {
  position: relative; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 20px 60px -24px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05);
}
.input-tabs { display: flex; border-bottom: 1px solid var(--line); }
.input-tabs button { flex: 1; padding: 1rem; background: none; border: 0; color: var(--muted); font-family: var(--font-display); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; border-bottom: 2px solid transparent; transition: .25s; }
.input-tabs button.active { color: var(--fg); border-bottom-color: var(--accent); }
.input-body { padding: 1.6rem; }
.input-pane { display: none; }
.input-pane.active { display: block; }
.big-input { width: 100%; border: 0; background: transparent; color: var(--fg); font-family: var(--font-body); font-size: 1.15rem; resize: vertical; min-height: 120px; }
.big-input:focus { outline: none; }
.url-input { width: 100%; padding: 1rem; font-size: 1.1rem; background: color-mix(in srgb, var(--bg-2) 70%, transparent); border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg); }
.url-input:focus { outline: none; border-color: var(--accent); }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 2.6rem; text-align: center; color: var(--muted); cursor: pointer; transition: .25s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); color: var(--fg); background: color-mix(in srgb, var(--bg-2) 70%, transparent); }
.file-list { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: .6rem; }
.file-chip { font-size: .8rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

.opt-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem;
  padding: 1.3rem; border-radius: 14px; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 55%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
/* min-width:0 lets the grid/flex track shrink BELOW the select's intrinsic width
   (a native <select> is as wide as its longest <option> — e.g. "AI-generated images
   per scene" — which would otherwise force the track past the viewport and cause the
   whole page to scroll sideways on mobile). */
.opt { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.opt label { font-family: var(--font-display); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.opt select {
  width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box;
  padding: .75rem .9rem; color: var(--fg); border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--font-body); cursor: pointer;
  background: color-mix(in srgb, var(--panel) 60%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .25s, box-shadow .25s, background-color .25s;
  /* keep a long option label from visually blowing out the closed control */
  text-overflow: ellipsis;
}
.opt select:hover { border-color: var(--line-strong); background: color-mix(in srgb, var(--panel) 80%, transparent); }
.opt select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

.generate-row { margin-top: 1.8rem; display: flex; justify-content: center; }
.btn-generate { font-size: .95rem; padding: 1.1rem 2.6rem; }

/* progress — one current step at a time (not a growing checklist), a slim dot-progress
   row underneath, and a ✕ to cancel the run — see frontend/scripts/studio.js STEP_SETS */
.pipeline { display: none; max-width: 620px; margin: 2rem auto 0; }
.pipeline.show { display: block; }
.pipeline-head { display: flex; align-items: center; justify-content: center; gap: 1rem; position: relative; }
.pipeline-label { font-family: var(--font-display); font-size: 1.05rem; color: var(--fg); text-align: center; }
.pipeline-cancel { position: absolute; right: 0; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; font-size: .95rem; line-height: 1; transition: .2s; }
.pipeline-cancel:hover { border-color: var(--accent); color: var(--fg); }
.pipeline-cancel:disabled { opacity: .5; cursor: default; }
.pipeline-dots { display: flex; justify-content: center; gap: .5rem; margin-top: 1.2rem; }
.pdot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); transition: .3s; }
.pdot.active { background: var(--accent); transform: scale(1.3); }
.pdot.done { background: var(--accent); }

/* result */
.result { display: none; max-width: 760px; margin: 2rem auto 0; text-align: center; }
.result.show { display: block; }
.result .player { aspect-ratio: 16/9; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(135deg,#5B4BFF44,#00E0B844); display: grid; place-items: center; position: relative; overflow: hidden; }
.result .player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.result .play-badge { width: 74px; height: 74px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; }
.result .play-badge i { border-left: 20px solid #111; border-top: 12px solid transparent; border-bottom: 12px solid transparent; margin-left: 5px; }
.result-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.6rem; flex-wrap: wrap; }
.edit-fields { display: none; text-align: left; margin-top: 1.6rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); }
.edit-fields.show { display: block; }
.edit-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.edit-field { display: flex; flex-direction: column; gap: .35rem; }
.edit-field.wide { grid-column: 1 / -1; }
.edit-field label { font-family: var(--font-display); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.edit-field input, .edit-field textarea { padding: .65rem .8rem; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--font-body); font-size: .9rem; }
.edit-field textarea { resize: vertical; min-height: 4.5rem; }
.edit-fields-logo { display: flex; align-items: center; gap: 1rem; margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.edit-fields-logo .logo-status { font-size: .85rem; color: var(--muted); flex: 1; }
.edit-fields-actions { display: flex; gap: 1rem; margin-top: 1.4rem; }

@media (max-width: 720px) {
  .cards.c2, .cards.c3, .team { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; }
  .feature:nth-child(even) .feat-visual { order: 0; }
  .opt-row { grid-template-columns: 1fr 1fr; }
  .edit-fields-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  /* phones — one option per row so long dropdown labels never overflow, and the
     glass padding tightens so the card fits a 320-375px viewport comfortably. */
  .opt-row { grid-template-columns: 1fr; gap: .9rem; padding: 1rem; }
  .result-actions, .edit-fields-actions { flex-direction: column; }
  .result-actions .btn, .edit-fields-actions .btn { width: 100%; }
  .edit-fields-logo { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Templates page — the design catalogue (templates.html + scripts/templates.js)
   ══════════════════════════════════════════════════════════════════════════ */
.tpl-stats { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 2.4rem; }
.tpl-stat { flex: 1 1 150px; background: var(--bg); padding: 1.3rem 1.1rem; text-align: center; }
.tpl-stat b { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1; margin-bottom: .35rem; }
.tpl-stat span { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.tpl-filters { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.4rem; }
.tpl-filter-row { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.tpl-filter-label { flex: 0 0 68px; font-size: .7rem; letter-spacing: .14em; color: var(--muted); font-family: var(--font-display); }
#tplSearch { flex: 1 1 260px; max-width: 420px; padding: .62rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-family: var(--font-body); font-size: .9rem; }
#tplSearch:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }

.tpl-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.tpl-chip { padding: .38rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .78rem; font-family: var(--font-body); cursor: pointer; transition: .2s; }
.tpl-chip:hover { border-color: var(--accent); color: var(--fg); }
.tpl-chip.is-on { background: var(--fg); border-color: var(--fg); color: var(--bg); }

.tpl-result-count { font-size: .8rem; color: var(--muted); margin-bottom: 1rem; }
.tpl-empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.1rem; }
.tpl-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); transition: transform .25s var(--ease), border-color .25s; }
.tpl-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.tpl-body { padding: .95rem 1rem 1.1rem; }
.tpl-body h3 { font-family: var(--font-display); font-size: 1rem; margin-bottom: .55rem; }
.tpl-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem; }
.tpl-tag { font-size: .68rem; padding: .16rem .5rem; border-radius: 4px; background: color-mix(in srgb, var(--fg) 8%, transparent); color: var(--muted); }
.tpl-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; font-size: .72rem; color: var(--muted); }
.tpl-aspect { font-family: var(--font-display); letter-spacing: .04em; }
.tpl-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }

/* Miniature preview. The registry ships no thumbnails, so each card draws a small abstract
   of its own design — layout, palette and accent are derived from a stable hash of the
   template id in scripts/templates.js, so a design always renders the same miniature. */
.tpl-mini { position: relative; aspect-ratio: 16/10; background: var(--g); overflow: hidden; }
.tpl-mini i { position: absolute; display: block; background: var(--ink); opacity: .82; border-radius: 3px; }
.tpl-mini i.a { background: var(--a); opacity: 1; }
.tpl-mini i.o { background: none; border: 2px solid var(--ink); opacity: .5; border-radius: 4px; }

@media (max-width: 640px) {
  .tpl-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
  .tpl-filter-label { flex-basis: 100%; }
  .tpl-stat { flex-basis: 45%; padding: 1rem .7rem; }
  .tpl-stat b { font-size: 1.5rem; }
}
