/* ==========================================================================
   The Arabian Way Academy — typography system
   Single source of truth for font loading, the type scale and text rhythm.
   Loaded before main.css; every other stylesheet uses these tokens.

   Font: Lato (SIL OFL 1.1, see ../fonts/OFL.txt), self-hosted WOFF2.
   Only the faces the design uses are shipped: 400, 400 italic, 700
   (latin + latin-ext; latin-ext is only downloaded if such glyphs appear).
   ========================================================================== */

/* 1. Font faces ---------------------------------------------------------- */
@font-face {
	font-family: "Lato";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/lato-latin-400-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Lato";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/lato-latin-400-italic.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Lato";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/lato-latin-700-normal.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
	font-family: "Lato";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/lato-latin-ext-400-normal.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "Lato";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/lato-latin-ext-400-italic.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "Lato";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/lato-latin-ext-700-normal.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Metric-matched fallback: Arial resized to Lato's proportions so the
   swap from fallback to Lato causes (almost) no layout shift. */
@font-face {
	font-family: "Lato Fallback";
	src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
	size-adjust: 97.38%;
	ascent-override: 101.18%;
	descent-override: 21.83%;
	line-gap-override: 0%;
}

/* 2. Tokens -------------------------------------------------------------- */
:root {
	--tawa-font-primary: "Lato", "Lato Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

	/* Fluid scale (min @ ~360px → max @ ~1280px+). Approximate values:
	              360   390   768   1024  1440+
	   display    32    32    42    49    52
	   h1         30    30    39    46    48
	   h2         26    26    30    34    38
	   h3         22    22    24    26    28
	   h4         19    19    20    21    23
	   h5         17    17    18    18    19
	   h6         16    16    16    17    17   */
	--tawa-fs-display: clamp(2rem, 1.25rem + 2.8vw, 3.25rem);
	--tawa-fs-h1: clamp(1.875rem, 1.2rem + 2.6vw, 3rem);
	--tawa-fs-h2: clamp(1.625rem, 1.1rem + 1.6vw, 2.375rem);
	--tawa-fs-h3: clamp(1.375rem, 1rem + 1vw, 1.75rem);
	--tawa-fs-h4: clamp(1.1875rem, 0.95rem + 0.6vw, 1.4375rem);
	--tawa-fs-h5: clamp(1.0625rem, 0.95rem + 0.3vw, 1.1875rem);
	--tawa-fs-h6: clamp(1rem, 0.9rem + 0.2vw, 1.0625rem);

	/* Component titles (cards, list items) — sit between h4 and h6. */
	--tawa-fs-title-lg: clamp(1.1875rem, 1.1rem + 0.25vw, 1.25rem);
	--tawa-fs-title-md: 1.0625rem;

	--tawa-fs-lead: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);
	--tawa-fs-body: 1rem;
	--tawa-fs-body-lg: clamp(1rem, 0.95rem + 0.3vw, 1.0625rem); /* long-form articles */
	--tawa-fs-small: 0.875rem;
	--tawa-fs-xs: 0.8125rem;

	--tawa-lh-display: 1.15;
	--tawa-lh-heading: 1.25;
	--tawa-lh-subheading: 1.3;
	--tawa-lh-body: 1.7;
	--tawa-lh-ui: 1.4;

	--tawa-fw-regular: 400;
	--tawa-fw-bold: 700;

	--tawa-ls-heading: -0.01em;
	--tawa-ls-eyebrow: 0.08em;

	--tawa-measure: 72ch; /* comfortable line length for long-form text */
}

/* 3. Base ---------------------------------------------------------------- */
body.tawa {
	font-family: var(--tawa-font-primary);
	font-size: var(--tawa-fs-body);
	line-height: var(--tawa-lh-body);
	font-weight: var(--tawa-fw-regular);
	font-synthesis: none; /* never fake bold/italic */
	text-rendering: optimizeLegibility;
}

/* Form controls and buttons do not inherit the font by default. */
body.tawa :is(button, input, select, textarea, optgroup),
body.tawa .menu-toggle,
body.tawa .ast-button,
body.tawa .ast-custom-button {
	font-family: inherit;
}

body.tawa :is(button, .ast-button, .ast-custom-button, .wp-block-button__link, .uagb-buttons-repeater, input[type="submit"]) {
	line-height: var(--tawa-lh-ui);
}

body.tawa :is(strong, b) {
	font-weight: var(--tawa-fw-bold);
}

body.tawa small {
	font-size: var(--tawa-fs-small);
}

/* 4. Headings ------------------------------------------------------------ */
/* Specificity (0,1,0): ties with Astra's
   `h1, .entry-content :where(h1)` and wins because this file loads later, but lets component classes (.tawa-h2, .tawa-title-lg …,
   loaded after this file) set their own size. */
.tawa :where(h1, h2, h3, h4, h5, h6, .entry-title) {
	font-family: var(--tawa-font-primary);
	font-weight: var(--tawa-fw-bold);
	font-style: normal;
	text-transform: none;
	overflow-wrap: break-word;
	text-wrap: balance;
}

.tawa :where(h1) { font-size: var(--tawa-fs-h1); line-height: var(--tawa-lh-display); letter-spacing: var(--tawa-ls-heading); }
.tawa :where(h2) { font-size: var(--tawa-fs-h2); line-height: var(--tawa-lh-heading); letter-spacing: var(--tawa-ls-heading); }
.tawa :where(h3) { font-size: var(--tawa-fs-h3); line-height: var(--tawa-lh-heading); letter-spacing: 0; }
.tawa :where(h4) { font-size: var(--tawa-fs-h4); line-height: var(--tawa-lh-subheading); letter-spacing: 0; }
.tawa :where(h5) { font-size: var(--tawa-fs-h5); line-height: var(--tawa-lh-subheading); letter-spacing: 0; }
.tawa :where(h6) { font-size: var(--tawa-fs-h6); line-height: var(--tawa-lh-subheading); letter-spacing: 0; }

/* Page-builder content (Spectra advanced heading / info box / post grid)
   stores a fixed px size per block. Map every real heading back onto the
   scale by its level so all pages share one hierarchy. Non-heading uses
   of these blocks (<p class="uagb-heading-text">, e.g. prices) keep their
   own size. */
body.tawa .entry-content :is(h1, h2, h3, h4, h5, h6):is(.uagb-heading-text, .uagb-ifb-title, .uagb-post__title, .uagb-html-tag, .wp-block-heading) {
	font-family: var(--tawa-font-primary);
	font-weight: var(--tawa-fw-bold);
	text-transform: none;
}

body.tawa .entry-content h1:is(.uagb-heading-text, .uagb-ifb-title, .wp-block-heading) { font-size: var(--tawa-fs-h1); line-height: var(--tawa-lh-display); }
body.tawa .entry-content h2:is(.uagb-heading-text, .uagb-ifb-title, .wp-block-heading) { font-size: var(--tawa-fs-h2); line-height: var(--tawa-lh-heading); }
body.tawa .entry-content h3:is(.uagb-heading-text, .uagb-ifb-title, .wp-block-heading) { font-size: var(--tawa-fs-h3); line-height: var(--tawa-lh-heading); }
body.tawa .entry-content h4:is(.uagb-heading-text, .uagb-ifb-title, .wp-block-heading) { font-size: var(--tawa-fs-h4); line-height: var(--tawa-lh-subheading); }
body.tawa .entry-content h5:is(.uagb-heading-text, .uagb-ifb-title, .wp-block-heading) { font-size: var(--tawa-fs-h5); line-height: var(--tawa-lh-subheading); }
body.tawa .entry-content h6:is(.uagb-heading-text, .uagb-ifb-title, .wp-block-heading) { font-size: var(--tawa-fs-h6); line-height: var(--tawa-lh-subheading); }

/* Card titles in grids and sidebar widget titles are component titles:
   semantically they may be h2 (directly under the page H1), visually they
   use the component title size, not the section-heading size. */
body.tawa .entry-content .uagb-post-grid :is(h2, h3, h4, h5, h6).uagb-post__title,
body.tawa .entry-content .tawa-block-card :is(h2, h3, h4, h5, h6):is(.uagb-heading-text, .uagb-ifb-title),
body.tawa .entry-content .wp-block-uagb-container:has(> .wp-block-latest-posts, > .wp-block-categories) > .wp-block-uagb-advanced-heading :is(h2, h3, h4).uagb-heading-text {
	font-size: var(--tawa-fs-title-lg);
	line-height: var(--tawa-lh-subheading);
}

/* 5. Body copy ----------------------------------------------------------- */
body.tawa .entry-content :is(p, li, dd, blockquote, .uagb-desc-text, .uagb-ifb-desc, .uagb-tm__desc) {
	font-family: var(--tawa-font-primary);
	line-height: var(--tawa-lh-body);
}

/* Spectra stores per-block font families from old designs (Helvetica,
   Cactus Classical Serif) — text always uses the primary font. */
body.tawa :is(.uagb-heading-text, .uagb-desc-text, .uagb-ifb-title, .uagb-ifb-title-prefix, .uagb-ifb-desc, .uagb-icon-list__label, .uagb-tm__desc, .uagb-tm__author-name, .uagb-tm__company, .uagb-post__text, .uagb-html-tag, .uagb-button__link) {
	font-family: var(--tawa-font-primary);
}

/* Long-form reading: single posts + legal text. */
body.tawa.single-post .entry-content,
body.tawa.single-post .entry-content :is(p, li) {
	font-size: var(--tawa-fs-body-lg);
	line-height: var(--tawa-lh-body);
}

body.tawa.single-post .entry-content :is(p, li, blockquote) {
	max-width: var(--tawa-measure);
}

body.tawa .entry-content p {
	margin-bottom: 1em;
}

body.tawa .entry-content :is(p, li):last-child {
	margin-bottom: 0;
}

/* Heading → content spacing in running text (core headings / articles). */
body.tawa .entry-content > :is(h2, h3, h4).wp-block-heading,
body.tawa.single-post .entry-content :is(h2, h3, h4) {
	margin-top: 1.5em;
	margin-bottom: 0.5em;
}

/* 6. UI text ------------------------------------------------------------- */
body.tawa :is(.main-header-menu, .ast-builder-menu-mobile, .ast-mobile-popup-content) .menu-link {
	font-family: var(--tawa-font-primary);
}

/* Desktop top-level links keep Astra's full-height line box (hover area +
   dropdown alignment); only dropdown and mobile items get the UI rhythm. */
body.tawa :is(.ast-builder-menu-mobile, .ast-mobile-popup-content) .menu-link,
body.tawa .main-header-menu .sub-menu .menu-link {
	line-height: var(--tawa-lh-ui);
}

body.tawa :is(input, select, textarea) {
	font-size: var(--tawa-fs-body); /* 16px also prevents iOS zoom on focus */
	line-height: var(--tawa-lh-ui);
}

body.tawa :is(label, .ff-el-input--label label) {
	line-height: var(--tawa-lh-ui);
}

/* 7. Astra templates (archives, search, 404, single title) ---------------- */
body.tawa :is(.ast-archive-title, .page-title) {
	font-size: var(--tawa-fs-h1);
	font-weight: var(--tawa-fw-bold);
	line-height: var(--tawa-lh-display);
}

body.tawa:is(.archive, .search, .blog) .ast-article-post .entry-title {
	font-size: var(--tawa-fs-title-lg);
	line-height: var(--tawa-lh-subheading);
	font-weight: var(--tawa-fw-bold);
}

body.tawa .page-sub-title {
	font-size: var(--tawa-fs-lead);
	font-weight: var(--tawa-fw-regular);
	line-height: var(--tawa-lh-body);
}

body.tawa :is(.entry-meta, .posted-on, .byline, .cat-links, .tags-links, .wp-caption-text, figcaption) {
	font-size: var(--tawa-fs-small);
	line-height: var(--tawa-lh-ui);
}
