:root {
  --teal:    #14B8A6;
  --teal-d:  #0F9488;
  --orange:  #F97316;
  --bg:      #0B0D12;
  --card:    #171A23;
  --text:    #E8EAF0;
  --muted:   #8B93A7;
  --border:  #2A3047;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-size: 1rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Focus visibility (WCAG 2.4.7) */
a:focus, button:focus, input:focus, select:focus, textarea:focus, [tabindex]:focus { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 4px;
}

/* ── Nav ─────────────────────────────── */
nav {
  background: #0F1219;
  border-bottom: 1px solid var(--border);
  padding: .6rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .4rem;
}
.nav-brand { color: #fff; font-size: 1.15rem; font-weight: 700; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }
.nav-brand span { color: var(--orange); }
.nav-links { display: flex; flex-wrap: wrap; gap: .15rem; }
.nav-links a { color: #cbd5e1; font-size: .82rem; padding: .25rem .55rem; border-radius: 4px; transition: background .15s; min-height: 44px; display: inline-flex; align-items: center; }
.nav-links a:hover, .nav-links a.active { background: rgba(20,184,166,.18); color: #fff; text-decoration: none; }
.nav-toggle {
  display: none; background: transparent; border: none; color: #fff; font-size: 1.6rem; cursor: pointer;
  padding: .25rem .5rem; min-height: 44px; min-width: 44px; align-items: center; justify-content: center;
}

/* ── Hero ────────────────────────────── */
.hero { background: linear-gradient(135deg, #0F172A 0%, #164E4A 100%); color: #fff; text-align: center; padding: 2rem 1rem 1.8rem; }
.hero h1 { font-size: 1.7rem; font-weight: 800; }
.hero p  { margin-top: .5rem; font-size: 1rem; opacity: .85; }

/* ── Container ───────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 1rem 1rem 2.5rem; }

/* ── Ad Slot ─────────────────────────── */
.ad-slot {
  background: var(--card); border: 1px dashed var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .8rem; margin-bottom: 1rem;
}

/* ── Generator Page Layout ───────────── */
.gen-page { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 700px) { .gen-page { grid-template-columns: 1fr; } }
.controls-card, .preview-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem;
}
.controls-card h2, .preview-card h2 { font-size: 1rem; color: var(--teal); margin-bottom: .9rem; }
.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.field input[type=file], .field select { width: 100%; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; background: #1e2233; color: var(--text); }
.field input[type=range] { width: 100%; accent-color: var(--teal); }
.btn-gen { width: 100%; padding: .55rem; background: var(--teal); color: #06201c; border: none; border-radius: 8px; cursor: pointer; font-size: .95rem; font-weight: 700; margin-bottom: .45rem; transition: background .15s; min-height: 44px; }
.btn-gen:hover:not(:disabled) { background: var(--teal-d); }
.btn-gen:disabled { opacity: .4; cursor: default; }
.btn-dl  { width: 100%; padding: .5rem; background: transparent; color: var(--teal); border: 1.5px solid var(--teal); border-radius: 8px; cursor: pointer; font-size: .9rem; transition: background .15s, color .15s; min-height: 44px; }
.btn-dl:hover:not(:disabled) { background: var(--teal); color: #06201c; }
.btn-dl:disabled { opacity: .4; cursor: default; }
canvas { max-width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: 4px; }
.canvas-row { display: flex; gap: .8rem; flex-wrap: wrap; }
.canvas-row figure { flex: 1; min-width: 160px; margin: 0; }
.canvas-row figcaption { font-size: .78rem; color: var(--muted); margin-top: .3rem; text-align: center; }
#status { font-size: .85rem; color: var(--teal); min-height: 20px; margin-top: .5rem; }

/* ── Motion Overlay Live Preview ─────── */
.motion-preview { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #14182a; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.motion-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
.motion-preview img[src] { display: block; }
.motion-placeholder { color: var(--muted); font-size: .85rem; position: relative; z-index: 1; }

/* ── Home Grid ───────────────────────── */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.gen-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1rem; text-align: center; transition: box-shadow .15s; }
.gen-card:hover { box-shadow: 0 4px 16px rgba(20,184,166,.15); }
.gen-card.soon { opacity: .55; }
.gen-card .icon { font-size: 2.2rem; margin-bottom: .4rem; }
.gen-card h2 { font-size: 1rem; color: var(--teal); margin-bottom: .35rem; }
.gen-card p  { font-size: 1rem; color: var(--muted); margin-bottom: .7rem; }
.btn-go { display: inline-block; background: var(--teal); color: #06201c; padding: .38rem .9rem; border-radius: 6px; font-size: .82rem; font-weight: 700; transition: background .15s; min-height: 44px; align-items: center; }
.btn-go:hover { background: var(--teal-d); text-decoration: none; }
.badge-soon { display: inline-block; font-size: .72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: .3rem .7rem; }

/* ── Info Section ────────────────────── */
.info-section { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1.4rem; margin-top: 1.2rem; }
.info-section h2 { font-size: 1.1rem; color: var(--teal); margin-bottom: .6rem; }
.info-section h3 { font-size: 1.05rem; color: var(--orange); margin-bottom: .4rem; }
.info-section p  { font-size: 1rem; color: var(--muted); }
.info-section ul { padding-left: 1.3rem; font-size: 1rem; color: var(--muted); }
.info-section li { margin-bottom: .35rem; }

/* ── Steps ───────────────────────────── */
.steps { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .6rem; }
.step  { background: #1e2233; border-radius: 8px; padding: .6rem .8rem; flex: 1; min-width: 130px; text-align: center; }
.step-num { background: var(--teal); color: #06201c; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem; margin: 0 auto .4rem; }
.step p { font-size: 1rem; color: var(--muted); }

/* ── Pattern Generator ───────────────── */
.pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px,1fr)); gap: .4rem; }
.pattern-thumb {
  aspect-ratio: 1; border-radius: 6px; border: 2px solid var(--border);
  background-size: cover; background-position: center; cursor: pointer; padding: 0;
  min-height: 44px; transition: border-color .15s;
}
.pattern-thumb:hover { border-color: var(--teal-d); }
.pattern-thumb.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(20,184,166,.35); }
.swatch-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border);
  cursor: pointer; padding: 0; min-height: 32px; transition: border-color .15s, transform .1s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--teal); }

/* ── Sister Sites ────────────────────── */
.sister-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; margin-top: .7rem; }
.sister-link { background: #1e2233; border-radius: 8px; padding: .8rem 1rem; }
.sister-link h3 { font-size: .9rem; color: var(--teal); margin-bottom: .3rem; }
.sister-link p  { font-size: 1rem; color: var(--muted); margin-bottom: .4rem; }
.sister-link a  { font-size: .82rem; color: var(--teal); }

/* ── Footer ──────────────────────────── */
footer { background: #0F1219; border-top: 1px solid var(--border); color: var(--muted); text-align: center; padding: 1rem; font-size: .78rem; }
footer a { color: #cbd5e1; display: inline-flex; align-items: center; min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
footer a:hover { color: #fff; }

/* ── Error page ──────────────────────── */
.error-page { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 20px; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--teal); line-height: 1; margin-bottom: 16px; }
.error-page h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 12px; }
.error-page p { color: var(--muted); max-width: 420px; margin-bottom: 32px; }
.error-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.error-links a { padding: 12px 28px; border-radius: 8px; font-weight: 600; text-decoration: none; font-size: 0.97rem; transition: opacity .2s; min-height: 44px; display: inline-flex; align-items: center; }
.error-links a:hover { opacity: 0.85; text-decoration: none; }
.btn-home { background: var(--teal); color: #06201c; }
.btn-back { background: var(--card); color: var(--text); border: 1px solid var(--border); }

/* ── Responsive nav — hamburger toggle ── */
@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; }
  .nav-links { display: none; width: 100%; flex-direction: column; gap: 0; padding: .4rem 0 .2rem; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .55rem .8rem; font-size: 1rem; }
  .hero h1 { font-size: 1.35rem; }
  .hero p  { font-size: 1rem; }
  .container { padding: .75rem .75rem 2rem; }
}
@media (max-width: 480px) {
  .gen-grid { grid-template-columns: 1fr; }
  .sister-sites { grid-template-columns: 1fr; }
}

/* prefers dark already default; respect prefers-color-scheme:light users minimally by keeping contrast as-is (tool is designed dark-first for photo/video work) */

/* ── Language switch ─────────────────── */
.lang-switch { font-size: .78rem; padding: .25rem .5rem; border: 1px solid var(--border); border-radius: 4px; }
