/* Keepframe — site styles. One stylesheet, no external fonts, no frameworks. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --text: #1b1b19;
  --text-2: #55554f;
  --text-3: #7a7a73;
  --line: #e3e3de;
  --line-strong: #cfcfc8;
  --ink: #1b1b19;
  --ink-text: #ffffff;
  --accent: #0f6b4f;
  --accent-soft: #e3f1ec;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --focus: #2b59c3;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 18, .05);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --max: 1080px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121211;
  --surface: #1a1a19;
  --surface-2: #222220;
  --text: #ececea;
  --text-2: #b4b4ad;
  --text-3: #8b8b84;
  --line: #2b2b29;
  --line-strong: #3a3a37;
  --ink: #ececea;
  --ink-text: #121211;
  --accent: #4cc39a;
  --accent-soft: #15302a;
  --danger: #f27a6f;
  --danger-soft: #3a1c19;
  --warn: #e0b45c;
  --focus: #7aa2ff;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text-3); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -48px; background: var(--ink); color: var(--ink-text); padding: 8px 12px; border-radius: var(--radius); z-index: 10; }
.skip:focus { top: 12px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ------------------------------------------------------------------ header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; letter-spacing: -0.01em; font-size: 17px; }
.brand svg { width: 22px; height: 22px; flex: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button {
  font: inherit; font-size: 14px; color: var(--text-2); text-decoration: none; background: none; border: 0;
  padding: 8px 10px; border-radius: var(--radius); cursor: pointer;
}
.nav a:hover, .nav button:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ------------------------------------------------------------------ hero + tool */
.hero { padding: 72px 0 40px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; margin: 0 0 14px; }
h1 { font-size: clamp(32px, 4.6vw, 50px); line-height: 1.07; letter-spacing: -0.03em; font-weight: 680; margin: 0 0 16px; max-width: 18ch; }
.lede { font-size: 18px; color: var(--text-2); max-width: 56ch; margin: 0 0 32px; }

.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.url-form { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.field {
  width: 100%; height: 48px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color .15s ease, background-color .15s ease;
}
.field::placeholder { color: var(--text-3); }
.field:hover { border-color: var(--text-3); }
.field:focus { outline: none; border-color: var(--focus); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px;
  font: inherit; font-size: 15px; font-weight: 600; border-radius: var(--radius); cursor: pointer; white-space: nowrap;
  border: 1px solid transparent; text-decoration: none; transition: background-color .15s ease, border-color .15s ease, opacity .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); color: var(--ink-text); }
.btn-primary:hover:not([disabled]) { opacity: .88; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover:not([disabled]) { border-color: var(--text-3); }
.btn-quiet { background: none; color: var(--text-2); border-color: transparent; height: 36px; padding: 0 10px; font-weight: 500; font-size: 14px; }
.btn-quiet:hover:not([disabled]) { color: var(--text); background: var(--surface-2); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tool-note { margin: 12px 2px 0; font-size: 13px; color: var(--text-3); }
.alert { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.alert[hidden] { display: none; }

.login-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.login-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.login-help { font-size: 14px; color: var(--text-2); margin: 0 0 14px; }

/* ------------------------------------------------------------------ analysis result */
.result { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; animation: rise .25s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.media { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.thumb { aspect-ratio: 16 / 9; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.empty { display: grid; place-items: center; color: var(--text-3); font-size: 13px; }
.media h2 { font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; margin: 0 0 8px; font-weight: 640; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font-size: 14px; color: var(--text-2); }
.meta dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.meta dd { margin: 0; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .01em; padding: 2px 7px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.tag-strong { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }

.formats { margin: 20px 0 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.formats legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.formats fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.fmt-head, .fmt {
  display: grid; grid-template-columns: 28px minmax(110px, 1.1fr) minmax(120px, 1.2fr) minmax(130px, 1.3fr) minmax(90px, .8fr);
  gap: 12px; align-items: center; padding: 12px 14px;
}
.fmt-head { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.fmt { border-top: 1px solid var(--line); cursor: pointer; font-size: 14px; transition: background-color .12s ease; }
.fmt:first-of-type { border-top: 0; }
.fmt:hover { background: var(--surface-2); }
.fmt:has(input:checked) { background: var(--accent-soft); }
.fmt input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.fmt .res { font-weight: 650; }
.fmt .res small { display: block; font-weight: 400; color: var(--text-3); font-size: 12px; }
.fmt .dim, .fmt .size { font-variant-numeric: tabular-nums; color: var(--text-2); }
.fmt .codec { color: var(--text-2); }
.fmt .size { text-align: right; }
.fmt-head .size { text-align: right; }

.confirm { display: flex; gap: 10px; align-items: flex-start; margin: 16px 2px 0; font-size: 14px; color: var(--text-2); }
.confirm input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 16px; }
.actions .hint { font-size: 13px; color: var(--text-3); }

/* ------------------------------------------------------------------ jobs */
.jobs { margin-top: 28px; }
.jobs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; margin-bottom: 8px; }
.jobs-head h2 { font-size: 15px; font-weight: 640; margin: 0; }
.job { border-top: 1px solid var(--line); padding: 16px 0; }
.job:last-child { border-bottom: 1px solid var(--line); }
.job-top { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.job-title { font-weight: 600; font-size: 15px; margin: 0 0 2px; overflow-wrap: anywhere; }
.job-sub { font-size: 13px; color: var(--text-3); margin: 0; }
.job-status { font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text-2); }
.job-status.ok { color: var(--accent); }
.job-status.err { color: var(--danger); }
.bar { position: relative; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin: 12px 0 8px; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); border-radius: 2px; transition: width .4s ease; }
.bar.done > i { background: var(--accent); }
.bar.indeterminate > i { width: 30%; animation: slide 1.4s ease-in-out infinite; opacity: .55; }
@keyframes slide { from { left: -30%; } to { left: 100%; } }
.job-stats { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.job-stats .k { color: var(--text-3); }
.job-error { margin: 10px 0 0; font-size: 14px; color: var(--danger); }
.job-verified { margin: 10px 0 0; font-size: 13px; color: var(--text-2); }
.job-verified b { color: var(--accent); font-weight: 600; }
.job-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.empty-jobs { font-size: 14px; color: var(--text-3); padding: 14px 0; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ content sections */
section.block { padding: 64px 0; border-top: 1px solid var(--line); }
.block h2.section { font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 8px; font-weight: 660; }
.block .section-lede { color: var(--text-2); margin: 0 0 32px; max-width: 60ch; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: step; }
.steps li { border-top: 2px solid var(--ink); padding-top: 16px; counter-increment: step; }
.steps li::before { content: "0" counter(step); font: 600 13px var(--mono); color: var(--text-3); display: block; margin-bottom: 8px; }
.steps h3 { font-size: 16px; margin: 0 0 6px; font-weight: 640; }
.steps p { margin: 0; color: var(--text-2); font-size: 15px; }

.res-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.res-table th, .res-table td { text-align: left; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.res-table th { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .02em; }
.res-table td:first-child { font-weight: 650; white-space: nowrap; }
.res-table td.num { font-family: var(--mono); font-size: 14px; color: var(--text-2); white-space: nowrap; }
.res-table td.note { color: var(--text-2); }
.fine { font-size: 14px; color: var(--text-3); margin: 16px 0 0; max-width: 70ch; }

.faq { max-width: 760px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 18px 32px 18px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; border-right: 1.5px solid var(--text-2); border-bottom: 1.5px solid var(--text-2); transform: translateY(-70%) rotate(45deg); transition: transform .2s ease; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { margin: 0 0 18px; color: var(--text-2); max-width: 66ch; }

/* ------------------------------------------------------------------ prose pages */
.prose { max-width: 720px; padding: 56px 0 80px; }
.prose h1 { font-size: clamp(30px, 4vw, 40px); max-width: none; }
.prose .updated { color: var(--text-3); font-size: 14px; margin: 0 0 32px; }
.prose h2 { font-size: 19px; margin: 36px 0 8px; letter-spacing: -0.01em; }
.prose p, .prose li { color: var(--text-2); }
.prose ul { padding-left: 20px; }
.prose li { margin: 4px 0; }
.prose code { font-family: var(--mono); font-size: 14px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.contact-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 20px; margin: 24px 0; }
.contact-card p { margin: 0 0 6px; }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: 14px; color: var(--text-3); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr; gap: 24px; }
  .media { grid-template-columns: 180px 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav .nav-link { display: none; }
  .hero { padding: 40px 0 28px; }
  .lede { font-size: 16px; margin-bottom: 24px; }
  .tool { padding: 14px; }
  .url-form { grid-template-columns: 1fr 1fr; }
  .url-form .field { grid-column: 1 / -1; }
  .login-form { grid-template-columns: 1fr; }
  .media { grid-template-columns: 1fr; gap: 12px; }
  .thumb.empty { display: none; }
  .fmt-head { display: none; }
  .fmt { grid-template-columns: 24px 1fr auto; grid-template-areas: "radio res size" "radio dim dim" "radio codec codec"; row-gap: 2px; }
  .fmt input { grid-area: radio; align-self: start; margin-top: 3px; }
  .fmt .res { grid-area: res; }
  .fmt .res small { display: inline; margin-left: 6px; }
  .fmt .dim { grid-area: dim; font-size: 13px; }
  .fmt .codec { grid-area: codec; font-size: 13px; }
  .fmt .size { grid-area: size; }
  .actions .btn { width: 100%; }
  .job-top { flex-direction: column; gap: 4px; }
  section.block { padding: 48px 0; }
  .res-table .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .bar.indeterminate > i { left: 0; width: 100%; opacity: .25; }
}
