/* Halloween AI studio. Tokens mirror the homepage so the two surfaces share one palette.
   Add a token instead of a new literal colour. */

:root {
  color-scheme: dark;
  --bg: #050807;
  --surface: #0b1110;
  --surface-2: #111917;
  --surface-3: #16201d;
  --text: #edf4ec;
  --text-soft: #d6e2d8;
  --muted: #a6b3a9;
  --line: rgba(215, 232, 218, 0.12);
  --line-strong: rgba(158, 255, 111, 0.28);
  --green: #9eff6f;
  --green-soft: rgba(158, 255, 111, 0.12);
  --amber: #ffd56a;
  --amber-soft: rgba(255, 213, 106, 0.12);
  --cyan: #8eeeff;
  --cyan-soft: rgba(142, 238, 255, 0.10);
  --red: #ff8a8a;
  --red-soft: rgba(255, 107, 107, 0.12);
  --purple: #c7a4ff;
  --purple-soft: rgba(199, 164, 255, 0.12);
  --max: 1180px;
  --reading: 74ch;
  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 34px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

html, body {
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 82% -8%, var(--green-soft), transparent 62%),
    radial-gradient(760px 480px at 4% 12%, var(--purple-soft), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--green); }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--green);
  color: var(--bg);
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { left: 12px; }

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 210px;
}
.brand svg { width: 38px; height: 38px; flex: none; }
.brand strong { display: block; font-size: 15px; line-height: 1.2; }
.brand span span { display: block; color: var(--muted); font-size: 12px; }

.nav-links {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.nav-links a {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  background: var(--green-soft);
  color: var(--green);
}
.nav-links .nav-home {
  border: 1px solid var(--line);
  color: var(--muted);
}

.lang-switch {
  display: inline-flex;
  flex: none;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}
.lang-switch a {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.lang-switch a[aria-current="true"] {
  background: var(--green-soft);
  color: var(--green);
}

/* Breadcrumbs */
.breadcrumbs { padding: 18px 0 0; }
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
}
.breadcrumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.breadcrumbs a { color: var(--muted); }

/* Article head */
.article-head { max-width: var(--reading); padding: 42px 0 18px; }
.eyebrow {
  display: inline-block;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1 {
  margin: 10px 0 14px;
  font-size: clamp(2rem, 5.4vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.lede {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(1.05rem, 1.8vw, 1.22rem);
  line-height: 1.6;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

/* Figure */
.figure { margin: 18px 0 28px; }
.figure img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

/* Answer box */
.answer-box {
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 0 0 34px;
  box-shadow: var(--shadow);
}
.answer-box h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--green);
  letter-spacing: .02em;
}
.answer-box ul { margin: 0; padding-left: 1.2em; }
.answer-box li { margin: 6px 0; color: var(--text-soft); }

/* Prose */
.prose-section { max-width: var(--reading); margin: 0 0 40px; }
.prose-section h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -.02em;
}
.prose-section h3 {
  margin: 26px 0 8px;
  font-size: 1.15rem;
  color: var(--text);
}
.prose-section p { margin: 0 0 14px; color: var(--text-soft); }
.prose-section ul,
.prose-section ol { margin: 0 0 16px; padding-left: 1.35em; }
.prose-section li { margin: 6px 0; color: var(--text-soft); }
.prose-section li::marker { color: var(--green); }
.prose-section strong { color: var(--text); }

.note {
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
  margin: 18px 0;
}

.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  margin: 10px 0;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
  font-size: 12px;
}

.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; min-width: 560px; font-size: 14.5px; }
caption { text-align: left; padding: 12px 14px; color: var(--muted); font-size: 13px; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--green); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }

.compact { margin: 0; padding-left: 1.2em; }
.compact li { margin: 4px 0; font-size: 14.5px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; margin: 18px 0; }

pre.prompt-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  margin: 10px 0 14px;
}

.prompt-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin: 18px 0 0;
}
.prompt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.prompt-card details { margin-top: 8px; }
.prompt-card summary { cursor: pointer; color: var(--cyan); font-size: 14px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.btn.primary { background: var(--green); color: var(--bg); }
.btn.primary:hover { background: #d9ff8f; color: var(--bg); transform: translateY(-1px); }
.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-3); color: var(--green); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); min-height: 34px; padding: 4px 12px; font-size: 12px; }
.btn.ghost:hover { color: var(--green); border-color: var(--line-strong); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* Preset grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 18px 0 8px;
}
.preset-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color .16s ease, transform .16s ease;
}
.preset-card:hover { border-color: var(--line-strong); transform: translateY(-2px); color: var(--text); }
.preset-card img { border-radius: var(--radius-sm); aspect-ratio: 16 / 9; object-fit: cover; }
.preset-tag { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.preset-card strong { font-size: 1.02rem; }
.preset-card span:last-child { color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* Studio */
.studio {
  margin: 26px 0 0;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 240px at 90% 0%, var(--purple-soft), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: var(--shadow);
  max-width: 900px;
}
.studio-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.studio-head h2 { margin: 4px 0 0; font-size: clamp(1.3rem, 2.6vw, 1.7rem); }
.studio-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.studio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.field select,
.field textarea,
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
}
.field textarea { min-height: 160px; resize: vertical; line-height: 1.55; }
.field select:focus,
.field textarea:focus,
.field input:focus { border-color: var(--green); outline: none; box-shadow: 0 0 0 3px var(--green-soft); }

.upload-row { display: grid; grid-template-columns: minmax(180px, 240px) 1fr; gap: 14px; align-items: start; margin: 4px 0 12px; }
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 130px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  overflow: hidden;
}
.upload-zone:hover { border-color: var(--green); color: var(--green); }
.upload-zone img { width: 100%; max-height: 180px; object-fit: contain; border-radius: 10px; }
.upload-help p { margin: 0 0 6px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.quota { color: var(--amber) !important; }
.buy-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.buy-row .btn { padding: 8px 12px; font-size: 12.5px; }

.studio-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.studio-status { min-height: 22px; margin: 12px 0 0; color: var(--muted); font-size: 13.5px; }
.studio-status.is-error { color: var(--red); }
.studio-result { margin-top: 14px; }
.studio-result img,
.studio-result video {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
}
.studio-result .result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.result-note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }

/* FAQ */
.faq { max-width: var(--reading); margin: 12px 0 40px; }
.faq h2 { font-size: clamp(1.4rem, 2.8vw, 1.8rem); margin: 0 0 14px; }
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin: 8px 0;
  padding: 0 16px;
}
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; color: var(--text); }
.faq details[open] summary { color: var(--green); }
.faq details > div { padding: 0 0 14px; color: var(--text-soft); }
.faq details p { margin: 0; }

/* Related */
.related { margin: 0 0 54px; }
.related h2 { font-size: 1.35rem; margin: 0 0 12px; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.related a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}
.related a:hover { border-color: var(--line-strong); color: var(--text); }
.related a span { color: var(--muted); font-size: 13px; }

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 46px;
  color: var(--muted);
  font-size: 13px;
}
.footer p { margin: 0 0 8px; max-width: 80ch; }
.footer a { color: var(--muted); }

/* Mobile */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { width: min(var(--max), calc(100% - 28px)); }
  .nav-links { order: 3; width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .brand { min-width: 0; flex: 1 1 auto; }
  .nav-wrap { gap: 8px; }
  .nav-links a { font-size: 13px; }
  .lang-switch { margin-left: auto; }
  .article-head { padding-top: 28px; }
  .upload-row { grid-template-columns: 1fr; }
  .studio { padding: 16px; border-radius: var(--radius); }
  .studio-actions .btn { flex: 1 1 100%; }
  .table-wrap { margin-inline: -2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Print */
@media print {
  .site-header, .breadcrumbs, .studio, .related, .footer { display: none; }
  body { background: #fff; color: #111; }
  a { color: #111; }
  .answer-box, .prompt-card, .faq details { border-color: #bbb; background: #fff; }
}
