@import url("identity.css");

/* Kinoe design system (redesign, decisions #81-83).
   Dark everywhere. Anton for the loud parts, Instrument Sans for the working parts.
   The accent comes from the user's own art (src/ui/accent.js); white until then. */

:root { --rail: 88px; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.mono { font-family: var(--ui); font-variant-numeric: tabular-nums; }
.label { font-size: 13px; color: var(--muted); }

/* ---------- Shell: tool rail + page ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 14px 8px; border-right: 1px solid var(--line); background: var(--bg);
}
.rail-mark { font: 400 26px/1 var(--poster); color: var(--text); text-decoration: none; text-align: center; padding: 6px 0 14px; letter-spacing: 0.01em; }
.rail a.tool {
  display: grid; justify-items: center; gap: 5px; padding: 9px 4px; border-radius: 3px;
  color: var(--muted); text-decoration: none; font-size: 11px; line-height: 1.15; text-align: center;
}
.rail a.tool svg { width: 23px; height: 23px; stroke-width: 1.8; }
.rail a.tool:hover { color: var(--text); background: var(--surface); }
.rail a.tool[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.rail a.tool[aria-current="page"] svg { color: var(--accent); }
.rail a.tool.studio { margin-top: auto; color: var(--text); }
.rail a.tool.studio svg { color: var(--accent); }
.rail-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.rail .local { display: grid; justify-items: center; gap: 4px; font-size: 10px; color: var(--muted); text-align: center; padding: 10px 2px 2px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.page { min-width: 0; padding: 0 clamp(16px, 3vw, 40px) 48px; }

/* ---------- Tool pages ---------- */
main.tool { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 0 28px; max-width: 1400px; }
.intro { grid-column: 1 / -1; padding: 28px 0 24px; display: grid; gap: 10px; }
.intro h1 { font: 400 clamp(36px, 4vw, 58px)/0.96 var(--poster); text-transform: uppercase; letter-spacing: 0.005em; margin: 0; text-wrap: balance; }
.intro p { margin: 0; max-width: 60ch; color: var(--muted); font-size: 16px; }
.limits { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 8px 0 0; font-size: 13px; }
.limits li { background: transparent; border-right: 1px solid var(--line); padding: 0 12px 0 0; margin-right: 6px; }
.limits li:last-child { border-right: 0; }

.panel { min-width: 0; display: grid; gap: 10px; align-content: start; padding-bottom: 32px; }
.stage { min-width: 0; position: sticky; top: 16px; align-self: start; display: grid; gap: 12px; }

.step { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 17px 0 20px; background: transparent; border-radius: 0; display: grid; gap: 12px; min-width: 0; }
.step:disabled { opacity: 0.45; }
.step legend { float: left; width: 100%; padding: 0; font-weight: 650; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.step legend + * { clear: both; }
.step .n { display: none; }

.drop {
  display: grid; gap: 6px; place-items: center; text-align: center; padding: 34px 16px; cursor: pointer;
  border-radius: 4px; background: #11171c; border: 1px dashed #59636d;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-main { font-weight: 650; font-size: 16px; }
.drop-sub { font-size: 13px; color: var(--muted); }

.meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 16px; margin: 0; font-size: 13px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); min-width: 0; }
.field > span { display: flex; justify-content: space-between; gap: 8px; }
.field output { color: var(--text); }
input[type="number"], select, input[type="search"], .field #gif-target-mb {
  font: 14px var(--ui); color: var(--text); background: var(--surface-2); border: 1px solid #2c2c2c;
  border-radius: 3px; padding: 9px 10px; width: 100%; min-width: 0;
}
select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%); background-position: right 15px center, right 10px center; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] { width: 100%; height: 38px; padding: 3px; border: 1px solid #46515b; border-radius: 3px; background: var(--surface-2); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.checks { display: grid; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { accent-color: var(--accent); width: 17px; height: 17px; }

/* Working controls share the Studio's geometry. */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.primary, .ghost {
  font: 600 14px var(--ui); border-radius: 4px; padding: 10px 18px; cursor: pointer;
  text-decoration: none; text-align: center; display: inline-block; border: 1px solid transparent;
}
.primary { background: var(--accent); color: var(--on-accent); }
.primary:hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--text); border-color: #333; padding: 9px 16px; font-size: 14px; }
.ghost:hover { border-color: var(--text); }
button:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid #46515b; border-radius: 4px; padding: 3px; justify-self: start; }
.seg label { position: relative; padding: 7px 18px; font-weight: 600; font-size: 14px; cursor: pointer; border-radius: 2px; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--text); color: var(--bg); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg label:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }
.options { display: grid; gap: 12px; }

.progress { display: grid; gap: 6px; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 120ms linear; }
#progress-label { font-size: 13px; color: var(--muted); }
.error { margin: 0; background: #2a1212; color: #ffb3a8; border-radius: 10px; padding: 10px 12px; font-size: 14px; }

/* Stage */
.screen {
  border-radius: 3px; border: 1px solid var(--line); min-height: 380px; display: grid; place-items: center; padding: 18px; overflow: hidden;
  background: repeating-conic-gradient(#141414 0 25%, #0e0e0e 0 50%) 0 0 / 22px 22px;
}
.screen video, .screen img { max-width: 100%; max-height: 72vh; display: block; border-radius: 6px; }
.empty { color: var(--muted); margin: 0; font-size: 15px; }
.out { display: grid; gap: 14px; background: var(--surface); border-radius: 16px; padding: 16px; }
.stats { border-collapse: collapse; font-size: 14px; width: 100%; max-width: 460px; }
.stats th { text-align: left; font-weight: 400; color: var(--muted); padding: 5px 16px 5px 0; width: 40%; }
.stats td { padding: 5px 0; }
.stats tr + tr { border-top: 1px solid var(--line); }
.fits { font-size: 13px; display: grid; gap: 3px; color: var(--muted); }
.fits strong { font-size: 15px; color: var(--text); margin-bottom: 2px; }
.fits .bad { color: #ffb3a8; }
.fit-steps { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: grid; gap: 2px; }

/* GIF Maker */
.choices { display: grid; gap: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 11px 12px; border-radius: 3px; background: var(--surface-2); cursor: pointer; border: 1px solid #46515b; }
.choice:has(input:checked) { border-color: var(--accent); }
.choice input { margin-top: 3px; accent-color: var(--accent); }
.screen:has(.frames:not([hidden])) { place-items: stretch; align-content: start; }
.frames { display: grid; gap: 12px; width: 100%; }
.frame-tools { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; background: var(--surface); border-radius: 3px; padding: 8px 10px; }
.frame-tools input { width: 60px; padding: 5px 6px; }
.frame-tools .ghost { padding: 6px 12px; font-size: 13px; }
.frame-tools .sep { width: 1px; height: 18px; background: var(--line); }
.frame-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; }
.frame { background: var(--surface); border-radius: 3px; display: grid; gap: 7px; padding: 8px; cursor: grab; min-width: 0; border: 1px solid var(--line); }
.frame canvas { width: 100%; height: 110px; object-fit: contain; display: block; border-radius: 6px; background: repeating-conic-gradient(#1c1c1c 0 25%, #121212 0 50%) 0 0 / 12px 12px; }
.frame.skipped canvas, .frame.skipped .frame-bar label, .frame.skipped .n, .frame.skipped .frame-name { opacity: 0.3; }
.frame.skipped { border-color: #333; border-style: dashed; }
.frame.dragging { border-color: var(--accent); }
.frame-bar { display: grid; gap: 5px; font-size: 12px; }
.frame-bar .n { color: var(--muted); }
.frame-bar .frame-name { font-weight: 600; overflow-wrap: anywhere; }
.frame-bar input { width: 70px; padding: 4px 6px; font-size: 12px; }
.frame-acts { display: flex; flex-wrap: wrap; gap: 4px; }
.frame-acts button { font: 600 11px var(--ui); border: 1px solid #46515b; background: var(--surface-2); color: var(--text); padding: 4px 8px; border-radius: 3px; cursor: pointer; }
.frame-acts button:hover { background: var(--text); color: var(--bg); }

/* ---------- Home ---------- */
.home { max-width: 1600px; }
.hero { position: relative; margin: 0 calc(-1 * clamp(16px, 3vw, 40px)); }
.hero canvas { display: block; width: 100%; height: clamp(260px, 43vh, 480px); }
.hero-copy { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 18px clamp(16px, 3vw, 40px) 0; }
.tagline { font: 400 clamp(34px, 4vw, 60px)/0.96 var(--poster); text-transform: uppercase; margin: 0; max-width: 15ch; }
.hero-side { display: grid; gap: 14px; max-width: 420px; }
.hero-side p { margin: 0; color: var(--muted); font-size: 16px; }
.look-name { position: absolute; left: clamp(16px, 3vw, 40px); top: 16px; font-size: 12px; color: var(--text); background: rgba(7, 7, 7, 0.75); padding: 5px 9px; border-radius: 3px; }

.section-title { font: 600 18px/1.3 var(--ui); text-transform: none; margin: 44px 0 15px; }
.carousel { display: flex; gap: 14px; overflow-x: auto; padding: 18px 4px 28px; perspective: 1400px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel figure { flex: 0 0 auto; width: clamp(180px, 20vw, 250px); margin: 0; transform: none; transition: opacity 120ms; }
.carousel figure:hover { transform: none; }
.carousel canvas { width: 100%; aspect-ratio: 4 / 5; display: block; border-radius: 3px; background: var(--surface); border: 1px solid var(--line); }
.carousel figcaption { font-size: 14px; font-weight: 650; padding-top: 8px; }
.carousel figcaption span { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 0; border-top: 1px solid var(--line); }
.card { display: grid; grid-template-columns: minmax(160px, 0.32fr) minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 17px 12px; height: 100%; border-radius: 0; background: transparent; color: var(--text); text-decoration: none; border: 0; border-bottom: 1px solid var(--line); }
.card svg { display: none; }
.card::after {
  content: ""; width: 16px; height: 16px; justify-self: end; background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E") center / contain no-repeat;
}
.card:hover { background: #171e25; }
.card-t { font: 600 16px/1.3 var(--ui); text-transform: none; }
.card-d { font-size: 13px; color: var(--muted); }
.card.studio { background: #1b242d; color: var(--text); padding-top: 23px; padding-bottom: 23px; border-left: 3px solid var(--accent); }
.card.studio .card-t { font-size: 22px; }
.card.studio .card-d { color: #bdc8d4; }

.promise { display: flex; flex-wrap: wrap; gap: 24px 36px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); }
.promise div { flex: 1 1 170px; background: transparent; border-radius: 0; padding: 0; }
.promise b { display: block; font: 600 13px/1.4 var(--ui); text-transform: none; margin-bottom: 5px; }
.promise p { margin: 0; color: var(--muted); font-size: 12px; max-width: 32ch; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 40px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- Small screens: rail becomes a top bar ---------- */
/* Shared identity refinement: soft working surfaces, compact branding and fewer rules. */
.rail { border-right: 0; padding: 16px 8px; gap: 3px; background: var(--bg); }
.rail-mark { font: 400 23px/1 var(--poster); letter-spacing: 0.01em; padding: 7px 0 20px; }
.rail a.tool { border-radius: 10px; padding: 9px 5px; color: var(--muted); }
.rail a.tool:hover { background: var(--surface); }
.rail a.tool[aria-current="page"] { background: var(--surface-2); }
.rail-sep { background: transparent; margin: 4px 6px; }
.rail .local { color: var(--muted); }
.page { padding-top: 4px; }
.intro { padding-top: 26px; padding-bottom: 25px; gap: 9px; }
.intro h1 { font: 600 clamp(26px, 3vw, 36px)/1.15 var(--ui); text-transform: none; letter-spacing: -0.03em; }
.intro p { font-size: 14px; line-height: 1.55; max-width: 65ch; }
.panel { gap: 14px; }
.step { border: 0; padding: 16px 0 22px; gap: 14px; }
.step legend { font-size: 14px; font-weight: 550; }
.drop { border: 1px dashed #555b65; border-radius: var(--radius-panel); background: var(--surface); padding: 30px 18px; }
.drop-main { font-size: 15px; font-weight: 550; }
.drop-sub, .hint { font-size: 12px; line-height: 1.55; }
.field { gap: 7px; font-size: 12px; }
input[type="number"], select, input[type="search"], .field #gif-target-mb { border: 1px solid transparent; border-radius: var(--radius-control); background-color: var(--surface-2); font-size: 13px; }
input[type="number"]:hover, select:hover, input[type="search"]:hover, .field #gif-target-mb:hover { background-color: var(--surface-hover); }
input[type="color"] { border-color: transparent; border-radius: var(--radius-control); background: var(--surface-2); }
.primary, .ghost { border-radius: var(--radius-control); font-size: 13px; font-weight: 550; padding: 10px 17px; border-color: transparent; }
.ghost { background: var(--surface); }
.ghost:hover { border-color: transparent; background: var(--surface-2); }
.seg { border: 0; border-radius: 10px; padding: 3px; background: var(--surface-2); }
.seg label { border-radius: 7px; font-size: 13px; font-weight: 500; }
.seg label:has(input:checked) { background: var(--selection); color: var(--text); }
.screen { border: 0; border-radius: var(--radius-panel); background-color: #111316; padding: 22px; }
.stage { gap: 15px; }
.result { border-radius: var(--radius-panel); }
.choice { border: 1px solid transparent; border-radius: 10px; padding: 13px; background: var(--surface-2); }
.choice:has(input:checked) { border-color: transparent; background: var(--selection); }
.frame-tools { border-radius: 10px; padding: 10px; }
.frame { border: 1px solid transparent; border-radius: 10px; background: var(--surface); padding: 9px; }
.frame canvas { border-radius: var(--radius-thumb); }
.frame-acts button { border-color: transparent; border-radius: 6px; padding: 5px 8px; }
.home { padding-top: 26px; }
.home-wordmark { font: 400 clamp(40px, 5vw, 60px)/1 var(--poster); letter-spacing: 0.01em; margin: 0; }
.hero-copy { padding: 0; align-items: center; gap: 26px; }
.hero-side { max-width: 490px; gap: 16px; }
.hero-side p { font-size: 14px; line-height: 1.6; }
.section-title { font-size: 16px; font-weight: 550; margin-top: 36px; margin-bottom: 17px; }
.hero { margin: 0; display: grid; gap: 9px; }
.hero canvas { height: clamp(240px, 36vh, 360px); border-radius: var(--radius-panel); background: var(--surface); }
.look-name { position: static; background: transparent; padding: 0 2px; color: var(--muted); font-size: 11px; border-radius: 0; }
.carousel { gap: 17px; padding-top: 16px; padding-bottom: 19px; }
.carousel canvas { border: 0; border-radius: var(--radius-thumb); }
.carousel figcaption { font-size: 13px; font-weight: 550; line-height: 1.45; padding-top: 10px; }
.carousel figcaption span { font-size: 12px; margin-top: 3px; }
.cards { border-top: 0; gap: 3px; }
.card { border: 0; border-radius: 9px; padding: 17px 13px; gap: 24px; }
.card:hover { background: var(--surface); }
.card-t { font-size: 14px; font-weight: 550; }
.card-d { font-size: 12px; line-height: 1.55; }
.card.studio { border-left: 0; border-radius: var(--radius-panel); padding: 23px 19px; margin-bottom: 10px; background: var(--surface); }
.card.studio .card-t { font-size: 18px; }
.card.studio .card-d { color: var(--muted); }
.foot { border-top: 0; padding-top: 30px; font-size: 11px; color: var(--muted); }
.error { border-radius: 9px; padding: 11px 13px; }
@media (max-width: 900px) { .home { padding-top: 20px; } .home-wordmark { font-size: 42px; } .hero-copy { align-items: flex-start; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 10px; gap: 4px; }
  .rail-mark { padding: 6px 10px 6px 2px; font-size: 22px; }
  .rail a.tool { min-width: 68px; padding: 6px 4px; }
  .rail a.tool.studio { margin-top: 0; }
  .rail-sep, .rail .local { display: none; }
  main.tool { grid-template-columns: 1fr; }
  .stage { position: static; }
  .card { grid-template-columns: minmax(130px, 0.45fr) minmax(0, 1fr) auto; gap: 15px; }
}
@media (max-width: 560px) { .card { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 16px 8px; } .card-d { grid-row: 2; grid-column: 1; } .card::after { grid-column: 2; grid-row: 1 / 3; } .hero-copy { padding-left: 0; padding-right: 0; } .tagline { max-width: none; } }
@media (prefers-reduced-motion: reduce) {
  .bar span, .carousel figure { transition: none; }
}

/* Public destinations remain available below each individual tool. */
.foot .tool-site-links { display:flex; flex-wrap:wrap; flex-basis:100%; gap:4px 20px; align-items:center; }
.tool-site-links a { display:inline-flex; align-items:center; min-height:44px; text-underline-offset:4px; }
