/* =============================================================================
   Modelab 3D — styles.css
   1 Tokens · 2 Reset · 3 Layout · 4 Header · 5 Hero · 6 Tool · 7 Content
   8 Ads · 9 Footer · 10 Responsive · 11 Reduced motion
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f1f7;
  --ink: #171a26;
  --ink-soft: #565c72;
  --line: #e3e5ef;
  --brand: #6c4cf1;
  --brand-ink: #ffffff;
  --brand-soft: #efeafe;
  --accent: #f4b740;
  --good: #12a06a;
  --warn-bg: #fdeede;
  --warn-ink: #96590c;
  --bad-bg: #fde8e6;
  --bad-ink: #a52e22;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 40, .06), 0 12px 32px rgba(20, 22, 40, .08);
  --shadow-sm: 0 1px 2px rgba(20, 22, 40, .06), 0 4px 14px rgba(20, 22, 40, .06);
  --maxw: 1180px;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1119;
    --surface: #181b27;
    --surface-2: #1f2333;
    --ink: #eef0f7;
    --ink-soft: #a4aac2;
    --line: #2a2f42;
    --brand: #8b73ff;
    --brand-soft: #221f3a;
    --warn-bg: #3a2c14;
    --warn-ink: #f2c377;
    --bad-bg: #3a1f1c;
    --bad-ink: #f0a79c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 14px rgba(0, 0, 0, .35);
  }
}

/* 2. Reset ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
p { text-wrap: pretty; }
input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand); color: #fff; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 999; background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }

/* 3. Layout ---------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(16px, 4vw, 32px); }
.section { padding-block: clamp(40px, 7vw, 72px); }
.eyebrow { color: var(--brand); font-weight: 600; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }

/* 4. Header ---------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; font-size: 1.12rem; }
.brand-badge { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: grid; place-items: center; color: #fff; font-size: 1rem; }
.nav-menu { display: flex; align-items: center; gap: 6px; }
.nav-menu a { padding: 8px 12px; border-radius: 8px; color: var(--ink-soft); font-size: .92rem; font-weight: 500; }
.nav-menu a:hover { color: var(--ink); background: var(--surface-2); }
.nav-toggle { display: none; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); font-size: 1.2rem; }

/* 5. Hero + object grid ---------------------------------------------------- */
.hero { padding-top: clamp(24px, 5vw, 44px); padding-bottom: 8px; }
.hero h1 { font-size: clamp(1.7rem, 4.6vw, 2.9rem); }
.hero .lead { color: var(--ink-soft); font-size: clamp(1rem, 2.4vw, 1.16rem); max-width: 62ch; margin-top: 12px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hero-tag { font-size: .8rem; font-weight: 600; color: var(--brand); background: var(--brand-soft); padding: 5px 11px; border-radius: 999px; }

.obj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 22px; }
.obj { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 14px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); text-align: center; transition: transform .2s var(--ease), border-color .2s, box-shadow .2s; }
.obj:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-sm); }
.obj.is-active { border-color: var(--brand); background: var(--brand-soft); }
.obj-emoji { font-size: 1.5rem; }
.obj-label { font-size: .84rem; font-weight: 600; color: var(--ink); }

/* 6. Tool ------------------------------------------------------------------ */
.tool { padding-top: 18px; }
.tool-card { display: grid; grid-template-columns: 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.controls { padding: clamp(16px, 3vw, 24px); border-bottom: 1px solid var(--line); max-height: none; }
.viewer-col { padding: clamp(16px, 3vw, 24px); display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); }

.cgroup { margin-bottom: 20px; }
.cgroup:last-child { margin-bottom: 0; }
.cgroup-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); margin-bottom: 10px; }
.field { margin-bottom: 12px; }
.field-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 5px; color: var(--ink); }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); }
.input:focus { border-color: var(--brand); outline: none; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 500; background: var(--bg); transition: .18s var(--ease); }
.chip:hover { border-color: var(--brand); color: var(--brand); }

.icon-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-mini { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: .82rem; font-weight: 500; background: var(--bg); }
.btn-mini:hover { border-color: var(--brand); }
.icon-preview { font-size: 1.3rem; min-width: 24px; }
.emoji-panel { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.emoji-panel[hidden] { display: none; }
[hidden] { display: none !important; }
.emoji-btn { font-size: 1.15rem; padding: 4px; border-radius: 6px; }
.emoji-btn:hover { background: var(--brand-soft); }

.range-wrap { display: flex; align-items: center; gap: 12px; }
.range { flex: 1; accent-color: var(--brand); }
.range-badge { min-width: 58px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; color: var(--ink-soft); }
.check-row { display: flex; align-items: center; gap: 9px; font-size: .9rem; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); }

.color-row { display: flex; gap: 14px; }
.color-item { display: flex; align-items: center; gap: 8px; }
.color-lbl { font-size: .85rem; color: var(--ink-soft); }
.color { width: 46px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--bg); }
.palette { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.swatch { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); }
.swatch:hover { transform: scale(1.08); }

.viewer { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); background:
  radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--brand) 10%, var(--surface)) 0%, var(--surface) 60%);
  border: 1px solid var(--line); overflow: hidden; min-height: 260px; }
.viewer canvas { width: 100%; height: 100%; touch-action: none; }
.viewer-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--ink-soft); font-size: .9rem; }
.viewer-hint { font-size: .78rem; color: var(--ink-soft); text-align: center; margin-top: -6px; }

.warnings { display: flex; flex-direction: column; gap: 7px; }
.warn { font-size: .84rem; padding: 8px 11px; border-radius: 9px; line-height: 1.4; }
.warn-bad { background: var(--bad-bg); color: var(--bad-ink); }
.warn-info { background: var(--warn-bg); color: var(--warn-ink); }

.downloads { display: flex; flex-direction: column; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 12px; font-weight: 600; transition: .18s var(--ease); text-align: center; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 40%, transparent); font-size: 1.02rem; }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.btn-ghost { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.dims { font-size: .86rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; text-align: center; }
.privacy-badge { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: .84rem; color: var(--ink-soft); margin-top: 14px; }

/* 7. Content --------------------------------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 28px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.step-num { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; margin-bottom: 12px; }
.step h3 { font-size: 1.08rem; margin-bottom: 6px; }
.step p { color: var(--ink-soft); font-size: .94rem; }

.prose { max-width: 74ch; }
.prose h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 12px; }
.prose h3 { font-size: 1.15rem; margin: 22px 0 8px; }
.prose p { color: var(--ink-soft); margin-bottom: 12px; }
.prose ul { color: var(--ink-soft); margin: 0 0 12px 20px; }
.prose li { margin-bottom: 5px; }

.uses { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 24px; }
.use { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.use-emoji { font-size: 1.5rem; }
.use h3 { font-size: 1rem; margin: 8px 0 4px; }
.use p { font-size: .88rem; color: var(--ink-soft); }

.faq { max-width: 80ch; margin-top: 22px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.faq summary { padding: 15px 18px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--brand); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 18px 16px; color: var(--ink-soft); }

.more-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 22px; }
.mt { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; font-weight: 600; font-size: .92rem; transition: .18s var(--ease); }
.mt:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }

/* 8. Ads ------------------------------------------------------------------- */
.ad-slot { margin: 22px auto; min-height: 90px; border: 1px dashed var(--line); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--surface-2); overflow: hidden; }
.ad-slot.ad-download { min-height: 110px; }
.ad-ph { font-size: .78rem; letter-spacing: .14em; font-weight: 600; color: var(--ink-soft); opacity: .7; }
.ad-sidebar { display: none; }

/* 9. Footer ---------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 20px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 18px 40px; justify-content: space-between; padding-block: 32px; }
.footer-col h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 10px; }
.footer-col a { display: block; color: var(--ink-soft); font-size: .9rem; padding: 3px 0; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--line); padding-block: 16px; font-size: .82rem; color: var(--ink-soft); text-align: center; }

/* 10. Responsive ----------------------------------------------------------- */
@media (min-width: 960px) {
  .tool-card { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .controls { border-bottom: 0; border-right: 1px solid var(--line); overflow-y: auto; max-height: 78vh; }
  .viewer-col { position: sticky; top: 80px; align-self: start; }
  .ad-sidebar { display: flex; flex-direction: column; }
  .layout-with-side { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
  .layout-with-side .ad-sidebar { position: sticky; top: 80px; min-height: 600px; }
}
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-menu { position: absolute; top: 64px; right: 0; left: 0; flex-direction: column; align-items: stretch; gap: 2px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px; box-shadow: var(--shadow); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: .2s var(--ease); }
  .nav-menu.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .emoji-panel { grid-template-columns: repeat(8, 1fr); }
}

/* 11. Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .obj, .mt, .btn-primary { transition: none; }
}
