/* =========================================================================
 * UrduTools — stylesheet
 * Mobile-first, no frameworks. Edit the :root variables to re-theme.
 *
 * Palette: deep teal primary (#0f766e), warm amber accent (#b45309),
 * soft warm-neutral backgrounds, dark slate text. Contrast checked:
 * body text ~16:1, muted ~7:1, white-on-primary ~5:1, white-on-accent ~5:1.
 * ========================================================================= */

/* ===== EDIT COLORS HERE ===== */
:root {
  --bg:            #faf6f0;   /* soft warm neutral page background */
  --card-bg:       #fffdf9;   /* warm card surface */
  --text:          #1c1917;   /* dark slate body text (~16:1 on --bg) */
  --muted:         #57534e;   /* warm gray secondary text (~7:1 on --bg) */
  --primary:       #0f766e;   /* deep teal — buttons, links, active tabs */
  --primary-dark:  #115e59;   /* teal-800 — button hover */
  --accent:        #b45309;   /* warm amber — accent buttons (~5:1 w/ white) */
  --accent-soft:   #fef3c7;   /* pale amber — highlights */
  --border:        #e8e0d2;   /* warm neutral border */
  --input-bg:      #fffdf9;
  --nav-bg:        #134e4a;   /* deep teal-900 nav bar */
  --nav-text:      #f0fdfa;
  --nav-accent:    #fbbf24;   /* amber-400 brand highlight on dark nav */
  --footer-bg:     #134e4a;
  --footer-text:   #e7e5e4;
  --footer-link:   #fcd34d;   /* amber-300 links on dark footer */
  --footer-muted:  #a8a29e;
  --success:       #15803d;
  --radius:        12px;
  --shadow:        0 2px 10px rgba(120, 85, 40, 0.08);
  --font-body:     -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                   "Helvetica Neue", Arial, sans-serif;
  --font-urdu:     "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq",
                   "Urdu Typesetting", serif;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* Backstop: never allow horizontal page scroll (clip keeps sticky working) */
html, body { overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

h1, h2, h3 { line-height: 1.35; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.45rem, 6vw, 1.7rem); }
h2 { font-size: clamp(1.15rem, 4.6vw, 1.3rem); margin-top: 1.6em; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 12px;
}

/* Urdu-script text (RTL, Nastaliq) */
.urdu {
  font-family: var(--font-urdu);
  direction: rtl;
  line-height: 2.1;
  text-align: right;
}

/* ===== Sticky nav ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  color: var(--nav-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.site-nav .nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 12px;
}
.brand {
  color: var(--nav-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  flex-shrink: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.brand span { color: var(--nav-accent); }
/* Horizontally scrollable nav links on small screens — no wrapping, no squeeze */
.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links li { flex-shrink: 0; }
.nav-links a {
  color: var(--nav-text);
  text-decoration: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav-links a:hover,
.nav-links a.active { background: rgba(255, 255, 255, 0.14); }

/* ===== Cards & layout ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}

.hero { text-align: center; padding: 24px 16px; }
.hero p.lead { color: var(--muted); font-size: 1.05rem; }
.hero h1 .accent-word { color: var(--primary); }

.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 10px;
  margin: 18px 0;
  background: var(--card-bg);
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tab-btn {
  flex: 1 1 0;
  min-width: 150px;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--border);
  background: #f5f0e8;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== Converter ===== */
textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  font-size: 16px; /* 16px+ prevents iOS auto-zoom on focus */
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  background: var(--input-bg);
  color: var(--text);
}
textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
textarea.output {
  background: #fdfbf5;
  line-height: 1.9;
}
textarea.output.urdu {
  font-size: 1.15rem;
}

.field-label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
}
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 18px;
  min-height: 44px; /* ≥44px tap target */
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-row .btn { flex: 1 1 40%; } /* thumb-friendly: two buttons per row */
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: #f1ece1;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: #e7dfcd; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #92400e; }

/* Sticky bottom action bar for the converter's main buttons (mobile only) */
@media (max-width: 719px) {
  .action-bar {
    position: -webkit-sticky;
    position: sticky;
    bottom: 0;
    z-index: 40;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    margin: 16px -18px -18px;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  }
}

.counters {
  display: flex;
  gap: 12px 18px;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 8px;
  flex-wrap: wrap;
}
.counters strong { color: var(--text); }

.swap-hint { font-size: 0.88rem; color: var(--muted); }

/* ===== Content pages ===== */
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.5em; }
.prose blockquote {
  border-left: 4px solid var(--primary);
  margin: 1.2em 0;
  padding: 0.6em 1em;
  background: #f7f2e9;
  border-radius: 0 8px 8px 0;
}

.faq details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--card-bg);
}
.faq summary {
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* ===== Forms ===== */
.form label { display: block; font-weight: 600; margin: 12px 0 4px; }
.form input[type="text"],
.form input[type="email"],
.form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text);
}
.note {
  background: var(--accent-soft);
  border: 1px solid #f5d48a;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.92rem;
  color: #92400e;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  margin-top: 34px;
  padding: 26px 0 30px;
  font-size: 0.92rem;
}
.site-footer a { color: var(--footer-link); }
.footer-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.footer-grid nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px 14px;
  flex-wrap: wrap;
}
.footer-grid nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.copyright { margin-top: 16px; color: var(--footer-muted); font-size: 0.85rem; }

/* ===== Larger screens ===== */
@media (min-width: 720px) {
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.3rem; }
  .container { padding: 0 16px; }
  .card { padding: 28px; margin: 18px 0; }
  .hero { padding: 44px 28px; }
  .site-nav .nav-inner { padding: 10px 16px; }
  .brand { font-size: 1.15rem; }
  .nav-links { flex-wrap: wrap; overflow-x: visible; }
  .tabs { flex-direction: row; }
  .tab-btn { width: auto; }
  .btn-row .btn { flex: 0 1 auto; }
  textarea { min-height: 170px; }
  .footer-grid { flex-direction: row; flex-wrap: wrap; justify-content: space-between; }
  .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
}
