/* ---------------------------------------------------------------------------
   flutter3d models — the documentation site's Impeller Dark, for a service.
   Same tokens, same mono headings; the difference is that this site has forms
   and cards, and the documentation has neither.
   --------------------------------------------------------------------------- */

:root {
  --bg: #0b0f14;
  --surface: #131a22;
  --well: #0e141b;
  --border: #22303c;
  --border-soft: #1a232c;
  --text: #e6edf3;
  --muted: #8a9ba8;
  --amber: #ff8a3d;
  --amber-dim: #b35d21;
  --cyan: #4dd0e1;
  --green: #7bd88f;
  --rose: #f2777a;
  --on-amber: #0b0f14;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 4px;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8f9;
    --surface: #ffffff;
    --well: #eef1f4;
    --border: #d8dfe6;
    --border-soft: #e6ebf0;
    --text: #10161c;
    --muted: #5c6c7a;
    --amber: #b8530e;
    --amber-dim: #9a4a13;
    --cyan: #0e7490;
    --green: #2c7a4b;
    --rose: #b3282c;
    --on-amber: #ffffff;
    color-scheme: light;
  }
  /* The arrow above is a literal colour baked into a data URI, since a
     background-image cannot read a custom property; this is its light-mode
     twin, `--muted` at this scheme's own value. */
  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%235c6c7a' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--mono); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--amber); color: var(--on-amber); padding: 10px 16px; font: 600 14px var(--mono);
}
.skip:focus { left: 8px; top: 8px; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

/* --- top bar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 0 clamp(16px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { font: 600 15px var(--mono); color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-tail { color: var(--amber); margin-left: 8px; }
.topbar nav { display: flex; align-items: center; gap: clamp(10px, 2vw, 20px); flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: var(--text); }
.topbar nav .who { color: var(--text); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar nav .cta {
  color: var(--on-amber); background: var(--amber); padding: 6px 12px; border-radius: var(--radius); font-weight: 600;
}
.topbar nav .cta:hover { color: var(--on-amber); background: var(--amber-dim); }

/* --- content -------------------------------------------------------------- */
.content {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  padding-block: clamp(28px, 6vw, 64px); padding-inline: clamp(16px, 4vw, 28px);
}
.content.wide { max-width: 1120px; }

.lead { font-size: 1.12rem; color: var(--muted); max-width: 62ch; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.hero { padding-bottom: clamp(24px, 5vw, 48px); border-bottom: 1px solid var(--border-soft); }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 28px; margin-top: 36px; }
.points p { color: var(--muted); margin: 0; }

/* --- buttons -------------------------------------------------------------- */
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px var(--sans); line-height: 1; padding: 11px 18px; min-height: 42px;
  border-radius: var(--radius); border: 1px solid var(--amber);
  background: var(--amber); color: var(--on-amber); text-decoration: none; cursor: pointer;
}
.button:hover, button:hover { background: var(--amber-dim); border-color: var(--amber-dim); color: var(--on-amber); }
.button.quiet, button.quiet { background: transparent; color: var(--text); border-color: var(--border); }
.button.quiet:hover, button.quiet:hover { border-color: var(--muted); color: var(--text); background: transparent; }
button.danger { background: transparent; color: var(--rose); border-color: var(--rose); }
button.danger:hover { background: var(--rose); color: var(--bg); }
button.link { background: none; border: none; color: var(--amber); padding: 0; min-height: 0; font-weight: 400; text-decoration: underline; }

/* --- forms ---------------------------------------------------------------- */
.auth { max-width: 420px; margin: 0 auto; }
.auth .below { margin-top: 20px; color: var(--muted); font-size: 14px; }

form.stack { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field .error { color: var(--rose); font-size: 13px; }

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; font: 400 16px var(--sans); color: var(--text);
  background: var(--well); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
/* A native select's own arrow is drawn by the platform, in the platform's own
   colours, on top of a background this rule just made dark — the one part of
   the control this file cannot repaint from here. `appearance: none` takes it
   off and a hand-drawn one goes on so the field still reads as a dropdown. */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%238a9ba8' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--cyan); }
.field.invalid input, .field.invalid textarea { border-color: var(--rose); }

/* The rules under a new password. Plain text until password.js marks them;
   marked lines get a tick, unmet ones stay muted rather than turning red while
   somebody is still typing. */
.checklist { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.checklist li { padding-left: 20px; position: relative; }
.checklist li::before { content: "·"; position: absolute; left: 6px; }
.checklist.live li[data-ok=true] { color: var(--green); }
.checklist.live li[data-ok=true]::before { content: "✓"; left: 2px; }
.checklist .extra { padding-left: 0; }
.checklist .extra::before { content: none; }

.notice {
  border: 1px solid var(--border); border-left: 3px solid var(--cyan);
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 14px; margin: 0 0 24px; font-size: 15px;
}
.notice[data-kind=ok] { border-left-color: var(--green); }
.notice[data-kind=error] { border-left-color: var(--rose); }
.notice form { display: inline; }

/* --- cabinet -------------------------------------------------------------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.page-head .count { color: var(--muted); font: 14px var(--mono); }

.upload {
  display: grid; gap: 6px; justify-items: center; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--well); padding: 28px 20px; margin-bottom: 32px;
  transition: border-color .15s, background .15s;
}
.upload.over { border-color: var(--amber); background: var(--surface); }
.upload.busy { opacity: .75; pointer-events: none; }
.upload input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload label.button { cursor: pointer; }
.upload .formats { color: var(--muted); font-size: 13px; margin: 0; }
.upload [data-upload-status] { min-height: 1.4em; font-size: 14px; margin: 4px 0 0; }
.upload [data-upload-status][data-kind=error] { color: var(--rose); }
.upload.locked { border-style: solid; pointer-events: auto; }

.owner-section { margin-top: 32px; }
.owner-section:first-of-type { margin-top: 0; }
.owner-section h2 { font-size: 16px; margin: 0 0 12px; }
.owner-section h2 a { color: inherit; text-decoration: none; }
.owner-section h2 a:hover { text-decoration: underline; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; list-style: none; padding: 0; margin: 0; }
.card {
  display: grid; grid-template-rows: auto 1fr; height: 100%;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  color: inherit; text-decoration: none; overflow: hidden;
}
.card:hover { border-color: var(--border); color: inherit; }
.card .thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, var(--surface), var(--well));
  font: 600 13px var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 12px 14px 14px; }
.card h2 { font-size: 15px; margin: 0 0 4px; overflow-wrap: anywhere; }
.card .meta { color: var(--muted); font: 12px var(--mono); }
.badge { display: inline-block; font: 600 11px var(--mono); padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border); color: var(--muted); }
.badge.public { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }

.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.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;
}

/* --- showcase --------------------------------------------------------------- */
.search-bar { display: flex; gap: 10px; max-width: 480px; margin-bottom: 16px; }
.search-bar input { flex: 1; }

.category-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.category-filter .chip {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); font-size: 13px; text-decoration: none;
}
.category-filter .chip:hover { border-color: var(--muted); color: var(--text); }
.category-filter .chip.active {
  border-color: var(--amber); color: var(--text);
  background: color-mix(in srgb, var(--amber) 14%, transparent);
}

.card .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* --- a model -------------------------------------------------------------- */
.model-head { margin-bottom: 20px; }
.model-head h1 { overflow-wrap: anywhere; margin-bottom: 6px; }
.model-head .by { color: var(--muted); margin: 0; }

.viewer {
  position: relative; aspect-ratio: 16 / 10; max-width: 100%;
  background: radial-gradient(circle at 50% 45%, var(--surface), var(--well) 70%);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  display: grid; place-items: center; overflow: hidden; margin-bottom: 28px;
}
.viewer .preview-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewer .poster {
  position: relative; z-index: 1; display: grid; gap: 14px;
  justify-items: center; text-align: center; padding: 20px;
}
.viewer .poster p { color: var(--muted); margin: 0; font-size: 14px; }
.viewer .poster.has-preview {
  background: color-mix(in srgb, var(--well) 80%, transparent);
  border-radius: var(--radius); padding: 20px 28px;
}
.viewer.live iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.viewer-fullscreen {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; min-height: 0; padding: 0;
  font-size: 18px; line-height: 1; border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  border: 1px solid var(--border-soft); color: var(--text);
}
.viewer-fullscreen:hover { background: var(--bg); border-color: var(--border); }
/* Fullscreen drops the boxed preview's own shape: no 16:10 crop, no rounded
   corners cut into a screen edge, and the fill colour is plain black so a
   model narrower than the window does not show the page's surface around it. */
.viewer:fullscreen { aspect-ratio: auto; border-radius: 0; border: 0; background: #000; }

.model-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
@media (max-width: 820px) { .model-grid { grid-template-columns: 1fr; } }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 20px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }

.description { white-space: pre-line; }
.muted { color: var(--muted); }

details.danger { margin-top: 36px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
details.danger summary { cursor: pointer; color: var(--rose); font-weight: 600; }
details.danger form { margin-top: 14px; }

details.publish { margin-top: 28px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
details.publish summary { cursor: pointer; color: var(--amber); font-weight: 600; }
details.publish form { margin-top: 14px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0; }
fieldset legend { font-weight: 600; font-size: 14px; padding: 0 4px; }
.radio-option { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; padding: 4px 0; }
.radio-option input { width: auto; }

section.revisions { margin-top: 36px; border-top: 1px solid var(--border-soft); padding-top: 20px; }
.revisions-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.revisions-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius);
  color: inherit; text-decoration: none; font-size: 14px;
}
.revisions-list a:hover { border-color: var(--border); }
.revisions-list .when { display: flex; align-items: center; gap: 8px; }
.revisions-list .bytes { color: var(--muted); font-family: var(--mono); font-size: 12px; }

section.settings { padding: 28px 0; border-top: 1px solid var(--border-soft); }
section.settings:first-of-type { border-top: none; padding-top: 0; }
section.settings > p { color: var(--muted); margin-top: 0; }

.prose p, .prose li { max-width: 66ch; }
.prose h2 { margin-top: 32px; }

/* --- footer --------------------------------------------------------------- */
.foot {
  display: flex; gap: 20px; flex-wrap: wrap; justify-content: center;
  padding: 24px 16px; border-top: 1px solid var(--border-soft); font-size: 14px;
}
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; }
}
