:root {
  --orange:   #E65C00;
  --orange-d: #BF4B00;
  --orange-l: #FF8C42;
  --bg:       #FFF8F3;
  --card:     #FFFFFF;
  --text:     #1E293B;
  --muted:    #64748B;
  --border:   #F0D5C0;
  --accent:   #F9A825;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ─────────────────────────────── */
nav {
  background: var(--orange);
  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; }
.nav-brand span { color: #FFD6B0; }
.nav-links { display: flex; flex-wrap: wrap; gap: .15rem; }
.nav-links a { color: #ffe8d6; font-size: .82rem; padding: .25rem .55rem; border-radius: 4px; transition: background .15s; }
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,.2); color: #fff; text-decoration: none; }

/* ── Hero ────────────────────────────── */
.hero { background: var(--orange-d); 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: .98rem; 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(--orange); margin-bottom: .9rem; }
.field { margin-bottom: .85rem; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.field select, .field textarea { width: 100%; padding: .38rem .6rem; border: 1px solid var(--border); border-radius: 6px; font-size: .88rem; background: var(--card); }
.field textarea { height: 120px; resize: vertical; font-family: monospace; }
.btn-gen  { width: 100%; padding: .55rem; background: var(--orange); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: .95rem; font-weight: 600; margin-bottom: .45rem; transition: background .15s; }
.btn-gen:hover { background: var(--orange-d); }
.btn-dl   { width: 100%; padding: .5rem; background: transparent; color: var(--orange); border: 1.5px solid var(--orange); border-radius: 8px; cursor: pointer; font-size: .9rem; transition: background .15s, color .15s; }
.btn-dl:hover:not(:disabled) { background: var(--orange); color: #fff; }
.btn-dl:disabled { opacity: .4; cursor: default; }
canvas { max-width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: 4px; }

/* ── 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(230,92,0,.12); }
.gen-card .icon { font-size: 2.2rem; margin-bottom: .4rem; }
.gen-card h2 { font-size: .97rem; color: var(--orange); margin-bottom: .35rem; }
.gen-card p  { font-size: .82rem; color: var(--muted); margin-bottom: .7rem; }
.btn-go { display: inline-block; background: var(--orange); color: #fff; padding: .38rem .9rem; border-radius: 6px; font-size: .82rem; transition: background .15s; }
.btn-go:hover { background: var(--orange-d); text-decoration: none; }

/* ── 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(--orange); margin-bottom: .6rem; }
.info-section h3 { font-size: .98rem; color: var(--orange-d); margin-bottom: .4rem; }
.info-section p  { font-size: .88rem; color: var(--muted); }
.info-section ul { padding-left: 1.3rem; font-size: .88rem; color: var(--muted); }
.info-section li { margin-bottom: .35rem; }

/* ── Steps ───────────────────────────── */
.steps { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .6rem; }
.step  { background: var(--bg); border-radius: 8px; padding: .6rem .8rem; flex: 1; min-width: 130px; text-align: center; }
.step-num { background: var(--orange); color: #fff; 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: .82rem; color: var(--muted); }

/* ── Sister Sites ────────────────────── */
.sister-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; margin-top: .7rem; }
.sister-link { background: var(--bg); border-radius: 8px; padding: .8rem 1rem; }
.sister-link h3 { font-size: .9rem; color: var(--orange); margin-bottom: .3rem; }
.sister-link p  { font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }
.sister-link a  { font-size: .82rem; color: var(--orange); }

/* ── Color Swatch (header color picker) ── */
.color-swatches { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .3rem; }
.swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.swatch.selected { border-color: #333; }

/* ── Footer ──────────────────────────── */
footer { background: var(--orange-d); color: #ffd6b0; text-align: center; padding: 1rem; font-size: .78rem; }
footer a { color: #ffe8d6; }
footer a:hover { color: #fff; }

/* ============================================================
   W-2 ADDITIONS: dark mode / focus-visible / 44px taps
   ============================================================ */

/* 1. DARK MODE (prefers-color-scheme) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #0f1117;
    --card-bg: #1a1d27;
    --text:    #e8eaf0;
    --muted:   #8fa0bc;
    --border:  #2a3047;
    --shadow:  0 2px 12px rgba(0,0,0,0.4);
  }
  /* card / white surface overrides */
  .card, .card-bg, .white-bg { background: #1a1d27 !important; }
  /* ad placeholder dark */
  .ad-placeholder { background:#1a1d27; border-color:#2a3047; }
  /* form controls */
  select, input, textarea {
    background: #1e2233;
    color: var(--text);
    border-color: var(--border);
    color-scheme: dark;
  }
}

/* 2. FOCUS-VISIBLE (keyboard accessibility, WCAG 2.1 SC 2.4.7) */
/* Reset — pointer users see no ring; keyboard users see ring below */
a:focus, button:focus, input:focus, select:focus,
textarea:focus, [tabindex]:focus { outline: none; }
/* Keyboard ring */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--primary, #3d5af1);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 3. 44px MINIMUM TAP TARGETS (WCAG 2.5.5) */
.site-header nav a,
.nav-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
button,
.btn-primary,
.btn-secondary,
[role="button"] {
  min-height: 44px;
}
.site-footer a,
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.tap-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   W-3 ADDITIONS: font-size ≥16px body text + responsive nav
   ============================================================ */

/* ① Body text minimum 16px */
html { font-size: 16px; }
body { font-size: 1rem; }

/* Content paragraph text: was .82-.88rem → 1rem */
.info-section p,
.info-section ul,
.info-section li,
.step p,
.sister-link p,
.gen-card p,
.hero p { font-size: 1rem; }

/* Cards/descriptions subheads: small bump for readability */
.gen-card h2 { font-size: 1rem; }
.info-section h3 { font-size: 1.05rem; }

/* ② Responsive nav — hamburger toggle */
.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;
}

@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;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .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; }
}

/* E-37: Language switcher */
.lang-switch {
  font-size: 0.78rem;
  padding: 3px 8px;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  color: var(--muted, #666);
  text-decoration: none;
  white-space: nowrap;
}
.lang-switch:hover { background: var(--bg-alt, #f5f5f5); }
