/* Public landing site. Fonts come from page-content.css (IBM Plex Sans Arabic, same as the app and the admin panel). */
:root {
    --primary: #157018;
    --primary-dark: #0d4f24;
    --on-primary: #ffffff;
    --deep: #2e5a27;
    --gold: #c9a24a;
    --lime: #9fc043;
    --bg: #ffffff;
    --surface: #f5f9f2;
    --card: #ffffff;
    --text: #263238;
    --muted: #626b66;
    --border: #d5ddd6;
    --on-deep: #f3f7ef;
    --shadow: 0 8px 24px rgb(21 112 24 / 0.08);
    /* Keyboard focus: blue reads on white and on the green (the gold did not, ~2:1). */
    --focus: #245f94;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #5cc162;
        --primary-dark: #7fd184;
        --on-primary: #0d1f10;
        --deep: #16261a;
        --gold: #d8b566;
        --bg: #121212;
        --surface: #1a1f1b;
        --card: #202622;
        --text: #e6ebe7;
        --muted: #a8b5ad;
        --border: #2f3a32;
        --on-deep: #e6ebe7;
        --shadow: none;
        --focus: #8ab8e6;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --primary: #5cc162;
    --primary-dark: #7fd184;
    --on-primary: #0d1f10;
    --deep: #16261a;
    --gold: #d8b566;
    --bg: #121212;
    --surface: #1a1f1b;
    --card: #202622;
    --text: #e6ebe7;
    --muted: #a8b5ad;
    --border: #2f3a32;
    --on-deep: #e6ebe7;
    --shadow: none;
    --focus: #8ab8e6;
    color-scheme: dark;
}

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

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

body {
    margin: 0;
    font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    /* The footer stays at the bottom of a short page. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5em; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: 1rem; }
.narrow { max-width: 50rem; }
.icon { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }

.skip { position: absolute; inset-inline-start: 1rem; top: -3rem; background: var(--primary); color: var(--on-primary); padding: .5rem 1rem; border-radius: .5rem; z-index: 10; }
.skip:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; gap: 1rem; min-height: 4.25rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); font-weight: 700; line-height: 1.2; }
.brand img { display: block; width: 2.75rem; height: 2.75rem; }
.brand small { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; }
.nav { display: flex; gap: 1.25rem; margin-inline-start: auto; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; min-height: 44px; }
.nav a:hover, .nav a.active { color: var(--primary); }
.lang { border: 1px solid var(--border); border-radius: 999px; padding: .25rem .9rem; text-decoration: none; font-weight: 600; white-space: nowrap; }
.lang:hover { border-color: var(--primary); }
/* Light/dark switch: a moon to go dark, a sun to come back. */
.theme-toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle .icon { width: 1.25rem; height: 1.25rem; }
.theme-sun, .brand .mark-dark { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) :is(.theme-moon, .brand .mark-light) { display: none; }
    :root:not([data-theme="light"]) :is(.theme-sun, .brand .mark-dark) { display: block; }
}
:root[data-theme="dark"] :is(.theme-moon, .brand .mark-light) { display: none; }
:root[data-theme="dark"] :is(.theme-sun, .brand .mark-dark) { display: block; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; gap: .5rem; padding: .7rem 1.4rem; border-radius: .75rem; font-weight: 700; text-decoration: none; border: 2px solid transparent; transition: background .15s, color .15s; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { border-color: var(--primary); color: var(--primary); }
.btn-ghost:hover { background: var(--surface); }
.btn-store { background: var(--text); color: var(--bg); }
.btn .icon { width: 1.25rem; height: 1.25rem; }
.link { font-weight: 700; }

/* Hero: the photo under the roof of the logo, a gold eave over a house-shaped crop. */
.hero { padding-block: 4rem 3.5rem; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.25; color: var(--primary-dark); margin-bottom: .6em; text-wrap: balance; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 34rem; }
.hero-house { margin: 0; width: min(100%, 28rem); justify-self: center; }
/* The eave's slope matches the crop's (30% rise over half the width), so the two stay parallel at any size. */
.hero-roof { display: block; width: 108%; margin-inline: -4%; aspect-ratio: 200 / 71; height: auto; overflow: visible; }
.hero-roof path { fill: none; stroke: var(--gold); stroke-width: 10px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hero-photo { width: 100%; aspect-ratio: 1; object-fit: cover; margin-top: -28.5%; clip-path: polygon(50% 0, 100% 30%, 100% 100%, 0 100%, 0 30%); border-radius: 0 0 1.25rem 1.25rem; }
.hero-logo { width: min(20rem, 80%); justify-self: center; background: #fff; border-radius: 2rem; padding: 1rem; }

/* Sections */
.section { padding-block: 3.5rem; }
.section-head { max-width: 40rem; margin-bottom: 2rem; }
.section-head h2, .about h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); color: var(--primary-dark); }
.section-head p { color: var(--muted); margin: 0; }
.about p { font-size: 1.15rem; max-width: 42rem; }
.activities, .contact { background: var(--surface); }

/* Activities: a plain two-column list, scanned by its icons and titles. */
.activity-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 3rem; }
.activity-list li { display: flex; gap: 1rem; padding-block: 1.25rem; border-top: 1px solid var(--border); }
.activity-icon { flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.activity-list h3 { font-size: 1.15rem; margin-bottom: .15rem; }
.activity-list p { color: var(--muted); margin: 0; }

.photos { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.photos img { border-radius: 1rem; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; display: block; }
.photos a { position: relative; display: block; overflow: hidden; border-radius: 1rem; background: var(--surface); color: var(--muted); -webkit-tap-highlight-color: transparent; }
/* The caption from the panel, over the bottom of the photo. Hidden from screen readers: it is the alt text. */
.photo-caption { position: absolute; inset-inline: 0; bottom: 0; padding: 2.25rem .85rem .65rem; background: linear-gradient(to top, rgb(0 0 0 / .78), rgb(0 0 0 / .35) 60%, transparent); color: #fff; font-size: .9rem; font-weight: 600; line-height: 1.45; text-shadow: 0 1px 2px rgb(0 0 0 / .5); pointer-events: none; transition: opacity .2s, transform .2s; }
/* Clamped inside the padding, so a third line never peeks out below the second. */
.photo-caption > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
/* With a mouse it shows on hover or keyboard focus; on touch screens, with no hover, always. */
@media (hover: hover) {
    .photo-caption { opacity: 0; transform: translateY(.5rem); }
    .photos a:hover .photo-caption, .photos a:focus-visible .photo-caption { opacity: 1; transform: none; }
}
.photos a:hover img { opacity: .9; }
.gallery-more { text-align: start; margin: 2rem 0 0; }
.gallery-empty { text-align: center; color: var(--muted); }

/* Gallery page */
.tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-bottom: 2rem; }
.tab { display: inline-flex; align-items: center; min-height: 44px; padding: .4rem 1.1rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; background: var(--card); }
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1rem; margin-top: 2rem; color: var(--muted); }

/* The app is for the field team only: a quiet strip at the end of the home page. */
.app-strip { border-top: 1px solid var(--border); padding-block: 1.5rem; }
.app-row { display: flex; align-items: center; gap: 1rem 1.25rem; }
.app-row img { flex: none; width: 3.5rem; height: 3.5rem; border-radius: .9rem; }
.app-row p { margin: 0; color: var(--muted); font-size: .95rem; max-width: 44rem; }
.app-row strong { display: block; color: var(--text); }
.store-links { display: flex; flex-wrap: wrap; gap: .5rem; margin-inline-start: auto; }

.contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 1rem; }
.contact-list > li { flex: 1 1 18rem; max-width: 22.5rem; }
/* Phone and WhatsApp, what most people use, lead in larger cards; the other channels follow. */
.contact-main > li { max-width: 28rem; }
.contact-main .contact-card { padding: 1.35rem 1.5rem; border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.contact-main .contact-card strong { font-size: 1.3rem; font-weight: 700; }
.contact-list + .contact-list { margin-top: 1rem; }
/* In a narrow column the cards share each row evenly. */
.narrow .contact-list > li { max-width: none; }
.contact-card { display: flex; align-items: center; gap: .9rem; height: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: 1.1rem 1.25rem; color: var(--text); text-decoration: none; }
.contact-card > span { min-width: 0; }
a.contact-card:hover { border-color: var(--primary); }
.contact-card .icon { width: 2.25rem; height: 2.25rem; padding: .45rem; border-radius: .7rem; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.contact-whatsapp .icon { color: #1f9d55; background: color-mix(in srgb, #25d366 16%, transparent); }
.contact-card small { display: block; color: var(--muted); }
.contact-card strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.contact-card strong[dir="ltr"] { text-align: start; unicode-bidi: isolate; }

/* Inner pages */
.page-hero { background: var(--surface); padding-block: 2.5rem 2rem; }
.page-hero h1 { color: var(--primary-dark); font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0; }
.page-hero p { color: var(--muted); margin: .5rem 0 0; }
.page-content-display.fi-prose { color: var(--text); max-width: none; }
.page-content-display.fi-prose :is(h1, h2, h3), .page-content-display.fi-prose a { color: var(--primary); }
.page-content-display.fi-prose :is(ul, ol) { padding-inline-start: 1.5rem; }
.page-content-display.fi-prose img { border-radius: 1rem; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .page-content-display.fi-prose blockquote { background: var(--card); color: var(--text); }
}
:root[data-theme="dark"] .page-content-display.fi-prose blockquote { background: var(--card); color: var(--text); }
/* 404: the logo over the message, with room before the footer. */
.not-found { padding-block: 4rem 5rem; text-align: center; }
.not-found img { display: block; width: 6rem; height: 6rem; margin: 0 auto 1rem; }
.not-found .actions { justify-content: center; }
.parent-note { display: flex; align-items: center; gap: 1rem; margin-top: 2.5rem; padding: 1.25rem; border: 1px solid var(--border); border-inline-start: 4px solid var(--gold); border-radius: 1rem; background: var(--surface); }
.parent-note img { width: 4.5rem; height: 4.5rem; border-radius: 50%; }
.parent-note p { margin: 0; font-weight: 600; }

/* Footer */
.site-footer { background: var(--deep); color: var(--on-deep); padding-top: 2.5rem; border-top: 4px solid var(--gold); }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1.2fr auto; gap: 2rem; align-items: center; }
.footer-brand, .footer-parent { display: flex; gap: 1rem; align-items: center; }
.footer-brand img { width: 4.5rem; height: 4.5rem; }
.footer-parent img { width: 4rem; height: 4rem; border-radius: 50%; }
.site-footer p { margin: .25rem 0 0; opacity: .85; font-size: .95rem; }
.footer-links { display: grid; grid-template-columns: repeat(2, auto); justify-content: start; column-gap: 2.5rem; }
.footer-links a { color: var(--on-deep); text-decoration: none; opacity: .9; display: inline-flex; align-items: center; min-height: 44px; }
.footer-links a:hover { color: var(--gold); opacity: 1; }
.footer-bottom { border-top: 1px solid rgb(255 255 255 / .12); margin-top: 2rem; padding-block: 1rem; font-size: .9rem; opacity: .75; text-align: center; }

/* Photo viewer: always dark, whatever the site's theme, so the photo stands out. */
html.lightbox-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(10 14 11 / .98); color: #fff; overscroll-behavior: contain; }
.lightbox::backdrop { background: rgb(0 0 0 / .6); }
.lightbox [hidden] { display: none !important; }
.lightbox-stage { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 4.5rem 5rem 1.5rem; }
.lightbox-image { max-width: 100%; max-height: calc(100dvh - 9rem); object-fit: contain; border-radius: .5rem; transition: opacity .2s; user-select: none; -webkit-user-drag: none; }
.lightbox.is-loading .lightbox-image { opacity: .25; }
.lightbox.is-loading .lightbox-stage::after { content: ''; position: absolute; top: 50%; left: 50%; width: 2.5rem; height: 2.5rem; margin: -1.25rem; border: 3px solid rgb(255 255 255 / .25); border-top-color: #fff; border-radius: 50%; animation: lightbox-spin .8s linear infinite; }
@keyframes lightbox-spin { to { transform: rotate(360deg); } }
.lightbox-error { margin: 0; padding: 1rem 1.5rem; border-radius: .75rem; background: rgb(255 255 255 / .08); }
.lightbox-info { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1rem; max-width: 48rem; text-align: center; min-height: 1.5rem; }
.lightbox-count { opacity: .75; font-size: .9rem; white-space: nowrap; }
.lightbox-button { -webkit-tap-highlight-color: transparent; position: absolute; display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 0; border-radius: 50%; background: rgb(255 255 255 / .12); color: #fff; cursor: pointer; transition: background .15s; }
.lightbox-button:hover { background: rgb(255 255 255 / .24); }
.lightbox-button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.lightbox-button svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.lightbox-close { top: 1rem; inset-inline-end: 1rem; }
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-prev { inset-inline-start: 1rem; }
.lightbox-next { inset-inline-end: 1rem; }
/* The chevrons point the way the reading goes. */
[dir="rtl"] .lightbox-nav svg { transform: scaleX(-1); }

@media (max-width: 52rem) {
    .hero-grid, .footer-grid { grid-template-columns: 1fr; }
    .hero { padding-block: 2.5rem; }
    .hero-grid { gap: 2rem; }
    .hero-house, .hero-logo { order: -1; width: min(78%, 20rem); }
    .app-row { flex-wrap: wrap; }
    .store-links { margin-inline-start: 0; }
}

@media (max-width: 40rem) {
    /* Two rows here: stuck to the top they would take ~120px of a phone screen while reading. */
    .site-header { position: static; }
    .header-row { flex-wrap: wrap; gap: .5rem 1rem; padding-block: .5rem; }
    .nav { order: 3; width: 100%; margin: 0; justify-content: space-between; font-size: .95rem; }
    .lang { margin-inline-start: auto; }
    /* Brand, language and theme share the first row; the brand's text wraps before the buttons do. */
    .header-row { gap: .5rem; }
    .brand { flex: 1; min-width: 0; }
    .lang, .theme-toggle { flex: none; }
    .section { padding-block: 2.5rem; }
    .photos { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    .activity-list { grid-template-columns: 1fr; }
    .contact-list > li { max-width: none; }
    /* One scrolling row of tabs instead of a wall of pills above the photos. */
    .tabs { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: thin; }
    .tab { flex: none; }
    .photo-caption { font-size: .8rem; padding: 1.75rem .6rem .5rem; }
    /* Arrows under the photo on phones, where the thumb is and the photo keeps the full width. */
    .lightbox-stage { padding: 4rem .75rem 5.5rem; }
    .lightbox-image { max-height: calc(100dvh - 12rem); }
    .lightbox-nav { top: auto; bottom: 1rem; transform: none; }
    .lightbox-prev { inset-inline-start: calc(50% - 4rem); }
    .lightbox-next { inset-inline-end: calc(50% - 4rem); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .lightbox-image, .photo-caption { transition: none; }
    .photo-caption { transform: none !important; }
    .lightbox.is-loading .lightbox-stage::after { animation-duration: 2.4s; }
}
