/* Ilmtech / Maktabati website
   The palette and components mirror the app's Theme.swift: sepia background,
   paper cards with a hairline gold border, and outlined gold buttons. */

@font-face {
  font-family: "Amiri";
  src: url("assets/fonts/Amiri-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("assets/fonts/Amiri-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #F5EDD9;
  --bg-light: #F8F2E4;
  --paper: #FEFAF2;
  --text: #664D33;
  --heading: #4A3424;
  --muted: #736B61;
  --gold: #D9A621;
  --gold-deep: #A87A08;
  --gold-light: #E6BF4D;
  --border: rgba(217, 166, 33, 0.3);
  --inset: rgba(217, 166, 33, 0.09);
  --green: #5E8F50;
  --shadow: 0 6px 24px rgba(102, 77, 51, 0.08);
  --shadow-lift: 0 14px 40px rgba(102, 77, 51, 0.14);

  --radius: 20px;
  --radius-sm: 14px;
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 32px);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "New York", ui-serif, Georgia, "Times New Roman", serif;
  --font-arabic: "Amiri", "Noto Naskh Arabic", "Geeza Pro", serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-light) 100%) fixed;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--gold-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--heading); }

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

h1, h2, h3 { color: var(--heading); font-family: var(--font-serif); line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.3rem, 5.4vw, 3.6rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-family: var(--font-ui); font-weight: 700; letter-spacing: 0; }
p { margin: 0 0 1em; }

.ar { font-family: var(--font-arabic); direction: rtl; unicode-bidi: isolate; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--paper); border: 2px solid var(--gold); color: var(--heading);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }

/* ---------- Buttons: the app's outlined style ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  font: 600 1rem/1 var(--font-ui);
  color: var(--gold-deep); background: var(--paper);
  border: 2px solid var(--gold); border-radius: 16px;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 14px rgba(102, 77, 51, 0.08);
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn:hover { background: #FDF3DA; color: var(--gold-deep); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(184, 133, 10, 0.16); }
.btn:active { transform: translateY(0); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-lg { min-height: 58px; padding: 0 28px; font-size: 1.06rem; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: .94rem; border-radius: 12px; box-shadow: none; }
.btn-quiet { border-color: var(--border); box-shadow: none; color: var(--text); }
.btn-quiet:hover { border-color: var(--gold); }
/* A store that isn't live yet: looks like a button, does nothing */
.btn-soon, .btn-soon:hover { border-color: var(--border); color: var(--muted); background: var(--paper); box-shadow: none; transform: none; cursor: default; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold-deep); background: var(--paper); border: 1.5px solid var(--gold);
}
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 14px; }

.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 237, 217, 0.86);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--heading); }
.brand img { width: 30px; height: auto; }
.brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; }

.nav { display: flex; align-items: center; gap: 6px; }
.nav a:not(.btn) {
  color: var(--text); text-decoration: none; font-weight: 500; font-size: .96rem;
  padding: 8px 12px; border-radius: 10px;
}
.nav a:not(.btn):hover, .nav a[aria-current="page"] { background: var(--inset); color: var(--heading); }

.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--paper); color: var(--heading); cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; margin: auto; }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav {
    position: absolute; left: 0; right: 0; top: 68px;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 12px var(--gutter) 20px;
    background: var(--bg-light); border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 30px rgba(102, 77, 51, 0.10);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a:not(.btn) { padding: 12px; font-size: 1.02rem; }
  .nav .btn { margin-top: 8px; }
}

/* ---------- Sections ---------- */

section { padding: clamp(56px, 9vw, 104px) 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto clamp(32px, 5vw, 56px); }
.section-head p { color: var(--muted); font-size: 1.08rem; }

/* Hero */
.hero { padding-top: clamp(40px, 7vw, 80px); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 6vw, 72px); align-items: center; }
.hero-greeting { font-size: clamp(2rem, 4vw, 2.6rem); color: var(--gold-deep); line-height: 1.4; margin-bottom: 4px; }
.hero-lead { font-size: clamp(1.08rem, 1.6vw, 1.22rem); color: var(--muted); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 14px; }
.hero-note { font-size: .92rem; color: var(--muted); }
.hero-visual { position: relative; display: flex; justify-content: center; }
.hero-visual::before {
  content: ""; position: absolute; inset: 8% 6% 4%;
  background: radial-gradient(closest-side, rgba(230, 191, 77, 0.35), rgba(230, 191, 77, 0));
  z-index: 0;
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-lead { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
}

/* Phone frame around real screenshots */
.phone {
  position: relative; z-index: 1;
  width: min(300px, 78vw); aspect-ratio: 1206 / 2622;
  padding: 10px; border-radius: 48px;
  background: #2E2116;
  box-shadow: 0 30px 60px rgba(74, 52, 36, 0.28), inset 0 0 0 2px #5A4430;
}
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 38px; background: var(--bg); }
.phone-sm { width: min(260px, 70vw); }

/* Try-it demo: tap a word */
.demo { padding: clamp(22px, 4vw, 34px); text-align: center; }
.demo-sentence {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px;
  font-size: clamp(1.9rem, 4.6vw, 2.6rem); line-height: 1.9; color: var(--text);
  margin: 6px 0 18px;
}
.demo-word {
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
  padding: 0 8px; border-radius: 10px; transition: background-color .15s ease, color .15s ease;
}
.demo-word:hover { background: var(--inset); }
.demo-word[aria-pressed="true"] { background: rgba(217, 166, 33, 0.28); color: #2E2116; font-weight: 700; }
.demo-panel {
  display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  min-height: 92px; padding: 16px 20px; border-radius: var(--radius-sm);
  background: var(--inset); border: 1px solid var(--border);
}
.demo-panel .ar { font-size: 2rem; color: var(--heading); font-weight: 700; line-height: 1.3; }
.demo-gloss { text-align: left; }
.demo-gloss .translit { font-size: .9rem; color: var(--gold-deep); font-weight: 600; }
.demo-gloss .meaning { font-size: 1.2rem; font-weight: 700; color: var(--heading); }
.demo-source { font-size: .85rem; color: var(--muted); margin: 14px 0 0; }
.demo-hint { font-size: .95rem; color: var(--muted); margin: 0; }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }
.feature { padding: 24px; }
.feature p { color: var(--muted); margin: 0; font-size: .98rem; }
.feature-icon {
  width: 46px; height: 46px; border-radius: 13px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--inset); color: var(--gold-deep);
}
.feature-icon svg { width: 24px; height: 24px; }
.feature h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Showcase rows */
.showcase { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.showcase + .showcase { margin-top: clamp(56px, 8vw, 96px); }
.showcase.flip .showcase-media { order: 2; }
.showcase-media { display: flex; justify-content: center; }
.showcase-copy p { color: var(--muted); font-size: 1.06rem; }
.checks { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.checks li { display: flex; gap: 12px; align-items: flex-start; }
.checks li::before {
  content: ""; flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%;
  background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23FEFAF2' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat;
}
@media (max-width: 860px) {
  .showcase { grid-template-columns: 1fr; }
  .showcase.flip .showcase-media { order: 0; }
  .showcase-copy { text-align: center; }
  .checks { text-align: left; max-width: 420px; margin-left: auto; margin-right: auto; }
}

/* Library */
.book { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: clamp(22px, 4vw, 36px); }
.book-cover {
  width: 132px; aspect-ratio: 3 / 4; border-radius: 10px 16px 16px 10px;
  background: linear-gradient(160deg, #6B4E2E, #3E2C1C);
  border-left: 8px solid #2E2116;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  color: var(--gold-light); text-align: center; padding: 12px;
  box-shadow: 0 16px 30px rgba(62, 44, 28, 0.3);
}
.book-cover .ar { font-size: 1.5rem; line-height: 1.4; font-weight: 700; }
.book-cover small { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: #E6D3A3; }
.book h3 { font-family: var(--font-serif); font-size: 1.5rem; margin-bottom: 4px; }
.book .meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.tag { padding: 4px 10px; border-radius: 999px; background: var(--inset); font-size: .82rem; font-weight: 600; color: var(--text); }
@media (max-width: 600px) { .book { grid-template-columns: 1fr; justify-items: center; text-align: center; } .book .meta { justify-content: center; } }

/* Free vs Premium */
.compare { overflow: hidden; }
.compare table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.compare th, .compare td { padding: 15px 20px; text-align: center; border-top: 1px solid rgba(217, 166, 33, 0.16); }
.compare thead th { border-top: 0; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-top: 22px; }
.compare th[scope="row"] { text-align: left; color: var(--heading); font-weight: 600; }
.compare td.prem { color: var(--gold-deep); font-weight: 700; background: rgba(217, 166, 33, 0.06); }
.compare thead th.prem { background: rgba(217, 166, 33, 0.06); }
.compare .no { color: #B3A898; }
.compare-foot { text-align: center; margin-top: 22px; color: var(--muted); font-size: .96rem; }
@media (max-width: 520px) { .compare th, .compare td { padding: 13px 10px; font-size: .92rem; } }

/* FAQ */
.faq { display: grid; gap: 12px; }
.faq details { padding: 0; }
.faq summary {
  list-style: none; cursor: pointer; padding: 20px 56px 20px 22px; position: relative;
  font-weight: 650; color: var(--heading); font-size: 1.04rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 22px; top: 50%; width: 12px; height: 12px; margin-top: -8px;
  border-right: 2.5px solid var(--gold-deep); border-bottom: 2.5px solid var(--gold-deep);
  transform: rotate(45deg); transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq .answer { padding: 0 22px 20px; color: var(--muted); }
.faq .answer p:last-child { margin-bottom: 0; }

/* Final call to action */
.cta-band { text-align: center; padding: clamp(36px, 6vw, 60px) var(--gutter); }
.cta-band img { width: 64px; margin: 0 auto 18px; }
.cta-band p { color: var(--muted); max-width: 520px; margin: 0 auto 26px; }
.store-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* Support page */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card { padding: 26px; display: flex; flex-direction: column; gap: 6px; }
.contact-card p { color: var(--muted); font-size: .98rem; flex: 1; }
.contact-card .btn { align-self: flex-start; margin-top: 8px; }

/* Legal pages */
.page-head { padding: clamp(48px, 8vw, 88px) 0 clamp(20px, 3vw, 32px); text-align: center; }
.page-head p { color: var(--muted); }
.legal { padding-top: 0; }
.legal-body { padding: clamp(24px, 5vw, 52px); }
.legal-body h2 { font-size: 1.45rem; margin-top: 1.8em; }
.legal-body h2:first-child { margin-top: 0; }
.legal-body h3 { font-size: 1.06rem; margin-top: 1.4em; }
.legal-body ul { padding-left: 1.2em; }
.legal-body li { margin-bottom: .4em; }
.legal-body table { width: 100%; border-collapse: collapse; margin: 1em 0 1.4em; font-size: .95rem; }
.legal-body th, .legal-body td { text-align: left; vertical-align: top; padding: 10px 12px; border: 1px solid rgba(217, 166, 33, 0.25); }
.legal-body th { background: var(--inset); color: var(--heading); }
.legal-summary { background: var(--inset); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 22px; margin-bottom: 1.6em; }
.legal-summary p:last-child { margin-bottom: 0; }
.table-scroll { overflow-x: auto; }

/* 404 */
.not-found { text-align: center; padding: clamp(80px, 14vw, 160px) 0; }
.not-found .ar { font-size: 2.4rem; color: var(--gold-deep); margin-bottom: 8px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 44px 0 36px; font-size: .94rem; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 28px; }
.footer-grid h4 { margin: 0 0 10px; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--heading); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-grid a { color: var(--text); text-decoration: none; }
.footer-grid a:hover { color: var(--gold-deep); text-decoration: underline; }
.footer-legal { margin-top: 32px; padding-top: 20px; border-top: 1px solid rgba(217, 166, 33, 0.16); font-size: .86rem; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* Gentle reveal; content stays visible when JavaScript or motion is off */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
