/* ============================================================
   AnaChef — أنا شيف
   Design system: "الكرم" (generosity)
   Palette: المطبخ — basil, olive, clay, plaster, flour, coffee
   Type: Aref Ruqaa (display) / Noto Naskh Arabic (editorial)
         / IBM Plex Sans Arabic (interface)
   ============================================================ */

:root {
  /* Color — each token has exactly one job */
  --basil:      #5CB449;  /* brand mark, large brand moments */
  --basil-soft: #EAF4E6;  /* pale basil tint for chips/marks */
  --olive:      #2E6B27;  /* actions: buttons, links, focus */
  --olive-dark: #235420;  /* action hover */
  --clay:       #CD6A42;  /* the human voice: names, quotes, display */
  --clay-deep:  #A34E2E;  /* clay at text-safe contrast */
  --clay-soft:  #F7E9E1;  /* pale clay tint for callouts */
  --plaster:    #FBF8F2;  /* page background */
  --flour:      #F2EADC;  /* alternating bands, cards */
  --coffee:     #2C241C;  /* body ink */
  --muted:      #6E6156;  /* secondary text */
  --line:       #E6DCCC;  /* hairlines */

  /* Type */
  --font-display: "Aref Ruqaa", serif;
  --font-editorial: "Noto Naskh Arabic", serif;
  --font-ui: "IBM Plex Sans Arabic", system-ui, sans-serif;

  /* Rhythm */
  --measure: 40rem;          /* max reading width */
  --section: clamp(4rem, 10vw, 8rem);
  --radius: 12px;
  --pill: 999px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--plaster);
  color: var(--coffee);
  font-family: var(--font-ui);
  font-size: 1.0625rem;         /* 17px */
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

html, body { overflow-x: hidden; }

a { color: var(--olive); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--olive-dark); }

::selection { background: var(--flour); }

:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  inset-inline-start: -999px;
  top: 0;
  background: var(--olive);
  color: #fff;
  padding: .6rem 1.2rem;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 100;
}
.skip-link:focus { inset-inline-start: 1rem; color: #fff; }

/* Visually hidden but present for screen readers and search engines —
   use when real text sits behind an image (e.g. the hero calligraphy). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Typography ---------- */
h1, h2, h3 { line-height: 1.5; margin: 0 0 1rem; font-weight: 700; }

h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); }
h2 { font-size: clamp(1.45rem, 3vw, 1.75rem); }
h3 { font-size: 1.2rem; }

.display {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--clay);
  font-size: clamp(3rem, 9vw, 4.75rem);
  line-height: 1.4;
  margin: 0;
}

.prose,
.prose p { font-family: var(--font-editorial); }
.prose p { margin: 0 0 1.25rem; max-width: var(--measure); }
.prose { font-size: 1.0625rem; }

.eyebrow {
  display: inline-block;
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--muted);
  margin-bottom: .75rem;
}

.byline { color: var(--clay-deep); font-weight: 500; }

.quote {
  font-family: var(--font-editorial);
  color: var(--clay-deep);
  font-size: 1.3rem;
  line-height: 1.9;
  border-inline-start: 3px solid var(--clay);
  padding-inline-start: 1.25rem;
  margin: 2rem 0;
  max-width: var(--measure);
}

/* Clay callout — the one sanctioned flexible use of clay */
.callout {
  background: var(--clay-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  max-width: var(--measure);
  margin: 2rem 0;
}
.callout strong { color: var(--clay-deep); }

.note {
  font-size: .9rem;
  color: var(--muted);
}

/* ---------- Layout ---------- */
.wrap {
  width: min(100% - 2.5rem, 72rem);
  margin-inline: auto;
}

.section { padding-block: var(--section); }

.band { background: var(--flour); }

.center { text-align: center; }

.stack-sm > * + * { margin-top: .5rem; }

/* ---------- Header ----------
   Layout model: logo anchored to one edge (the reading-start side -- the
   right, in RTL). On wide screens the nav sits inline, centered in the
   remaining space. Below 700px there simply isn't room for five links
   plus a pill button at any legible size, so instead of shrinking text
   until it's unreadable, the nav becomes a hamburger-triggered dropdown:
   logo stays put, a toggle button appears in its place, and the links
   list opens as a full-width panel below the header. Progressive
   enhancement: with JS disabled the toggle button still exists but does
   nothing, so give it a harmless fallback -- see the noscript note below. */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--plaster);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; flex-shrink: 0; }
.brand img { height: 44px; width: auto; }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--coffee);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--flour); }
.nav-toggle[aria-expanded="true"] { color: var(--olive); }

.site-nav { display: flex; align-items: center; justify-content: center; gap: 1.5rem; flex: 1 1 auto; }
.site-nav a {
  text-decoration: none;
  color: var(--coffee);
  font-size: .95rem;
  font-weight: 500;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--olive); }
.lang-switch { font-size: .85rem; color: var(--muted); }

@media (max-width: 700px) {
  .site-header .wrap { position: relative; justify-content: space-between; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline: 0;
    flex: none;
    flex-direction: column;
    align-items: stretch;
    background: var(--plaster);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(44,36,28,.08);
    padding: .5rem 1.5rem 1.25rem;
    gap: .15rem;
    z-index: 40;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: .7rem .25rem; text-align: center; width: 100%; }
  .site-nav a.btn-primary { width: auto; align-self: center; margin-top: .5rem; }
  /* No-JS fallback: the toggle button can't do anything without main.js,
     so keep the nav visible and static rather than hiding it behind a
     button that will never respond. */
  html.no-js .nav-toggle { display: none; }
  html.no-js .site-nav {
    display: flex;
    position: static;
    box-shadow: none;
    border-bottom: none;
    padding: 0;
  }
}

/* Primary buttons inside the nav must stay white in every state — without
   this, .site-nav a's own color rules above win on specificity and the
   "انضم إلينا" / "Join us" button text nearly disappears against its
   own olive background. */
.site-nav a.btn-primary,
.site-nav a.btn-primary:hover,
.site-nav a.btn-primary[aria-current="page"] {
  color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  padding: .8rem 2rem;
  border-radius: var(--pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s ease, transform .15s ease;
}
.btn-primary { background: var(--olive); color: #fff; }
.btn-primary:hover { background: var(--olive-dark); color: #fff; }
.btn:active { transform: scale(.98); }

.btn-quiet {
  display: inline-block;
  font-weight: 500;
  color: var(--olive);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}
.btn-quiet:hover { color: var(--olive-dark); }

/* ---------- Hero ---------- */
.hero { padding-block: var(--section); }
/* .hero-inner is nested INSIDE a plain .wrap (not combined onto the same
   element) so it sits at the wrap's own reading-start edge (right in RTL,
   left in LTR) by default, matching every other section's text position
   exactly -- rather than being independently centered/flushed, which is
   what caused it to drift out of alignment with the rest of the page. */
.hero-inner { max-width: 46rem; }
.hero-mark { margin: 0 0 1.25rem; }
.hero-mark img {
  width: clamp(118px, 22.5vw, 225px);
  height: auto;
}
.hero-lead {
  font-family: var(--font-editorial);
  font-size: 1.2rem;
  max-width: var(--measure);
  margin: 0 0 2.25rem;
}
.hero-actions { display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap; }

/* Steam: staged rise on load — the single orchestrated moment */
@media (prefers-reduced-motion: no-preference) {
  .rise { opacity: 0; transform: translateY(14px); animation: rise .7s ease-out forwards; }
  .rise-2 { animation-delay: .25s; }
  .rise-3 { animation-delay: .5s; }
  @keyframes rise { to { opacity: 1; transform: none; } }

  .reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease-out, transform .6s ease-out; }
  .reveal.visible { opacity: 1; transform: none; }
}

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.card {
  background: var(--plaster);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
}
.band .card { background: var(--plaster); }
.card h3 { margin-bottom: .5rem; }
.card p { margin: 0; font-size: .97rem; color: var(--muted); }

.flame-mark { margin-bottom: 1rem; }

/* Story cards (archive) */
.story-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--coffee);
  display: block;
  transition: border-color .2s ease;
}
.story-card:hover { border-color: var(--olive); color: var(--coffee); }
.story-card .thumb {
  aspect-ratio: 16 / 10;
  background: var(--flour);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .9rem;
}
.story-card .body { padding: 1.25rem 1.5rem; }
.story-card .dish { font-family: var(--font-editorial); font-weight: 700; font-size: 1.15rem; margin: 0 0 .25rem; }
.story-card .meta { font-size: .9rem; color: var(--muted); margin: 0; }

.badge {
  display: inline-block;
  background: var(--flour);
  color: var(--muted);
  border-radius: var(--pill);
  font-size: .8rem;
  padding: .2rem .9rem;
  margin-bottom: 1rem;
}

/* ---------- Recipe blocks ---------- */
.recipe-list { list-style: none; padding: 0; margin: 1rem 0 2rem; max-width: var(--measure); }
.recipe-list li {
  display: flex;
  gap: .75rem;
  align-items: baseline;
  padding-block: .5rem;
  font-family: var(--font-editorial);
}
.recipe-list li + li { border-top: 1px solid var(--line); }
.recipe-list .mark { flex-shrink: 0; transform: translateY(3px); }

/* ---------- Forms ---------- */
.join-form { max-width: 30rem; }
.join-form label { display: block; font-size: .95rem; font-weight: 500; margin-bottom: .4rem; }
.join-form input[type="text"],
.join-form input[type="email"] {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--coffee);
  margin-bottom: 1.25rem;
}
.join-form input:focus { border-color: var(--olive); outline: none; box-shadow: 0 0 0 3px var(--basil-soft); }
.check {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  font-size: .95rem;
  margin-bottom: 1.5rem;
}
.check input { margin-top: .35rem; accent-color: var(--olive); }
.form-confirm {
  background: var(--basil-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-family: var(--font-editorial);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 3rem;
  font-size: .9rem;
  color: var(--muted);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--olive); }
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* ---------- English (LTR) pages ---------- */
html[dir="ltr"] body { font-size: 1rem; line-height: 1.75; }
html[dir="ltr"] .prose,
html[dir="ltr"] .prose p,
html[dir="ltr"] .hero-lead,
html[dir="ltr"] .quote { font-family: var(--font-ui); }
html[dir="ltr"] .display { line-height: 1.3; }

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .hero-actions, .btn { display: none; }
  body { background: #fff; }
}

/* ---------- Recipe share page (Cloud Function: /recipe/{id}) ----------
   Added App Session 30. Scoped under .recipe-page / .not-found-page so
   nothing here can collide with existing site classes (e.g. .meta is
   already used inside .story-card with different rules elsewhere in this
   file -- these selectors never apply there). */
.recipe-page .cover {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  border: 1px solid var(--line);
}
.recipe-page ul,
.recipe-page ol {
  padding-inline-start: 1.4rem;
  max-width: var(--measure);
}
.recipe-page ul li,
.recipe-page ol li {
  margin-bottom: .6rem;
}
.recipe-cta-wrap { margin-top: 2rem; }
.recipe-cta { display: block; text-align: center; }

/* ---------- Join-form honeypot (functions/index.js joinSubmit) ----------
   Off-screen rather than display:none -- some bots skip display:none
   fields, far fewer skip ones that are merely positioned out of view. */
.hp-field {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Textarea (kitchens.html nomination form) ----------
   .join-form only styled text/email inputs before; the nomination form
   needs a multi-line field too. Kept under the same .join-form selector
   rather than a new class, since the rules are otherwise identical. */
.join-form textarea {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--coffee);
  margin-bottom: 1.25rem;
  resize: vertical;
  min-height: 6rem;
}
.join-form textarea:focus { border-color: var(--olive); outline: none; box-shadow: 0 0 0 3px var(--basil-soft); }

/* ---------- Image placeholders (kitchens.html Memory page) ----------
   Marks where real photography goes once Mazin sources it. Deliberately
   plain -- a dashed box, not a fake photo -- so it never gets mistaken
   for finished content if this ships before images arrive. */
.img-placeholder {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--flour);
  color: var(--muted);
  font-size: .9rem;
  padding: 3rem 1.5rem;
  text-align: center;
  margin: 1.75rem 0;
  max-width: var(--measure);
}
.img-placeholder--hero {
  max-width: none;
  padding: 5rem 1.5rem;
  margin-top: 2.5rem;
}

/* ---------- Real memory-page images (replacing placeholders) ----------
   Sized down from the original full-measure (40rem) width -- at that size
   these read as oversized on desktop/tablet. Capped narrower and centered
   so they sit as supporting images rather than full-bleed editorial photos. */
.memory-img {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 1.75rem auto;
  border-radius: var(--radius);
  object-fit: cover;
}
.memory-img--hero {
  max-width: 480px;
  margin: 2.5rem auto 0;
  max-height: 320px;
  width: 100%;
  object-fit: cover;
}

/* Phone-screenshot mockup (e.g. the profile page image) -- these are tall
   portrait screenshots, so letting them stretch to the same 40rem width
   as regular photos makes them enormous on desktop/tablet. Cap the width
   instead so it renders like a phone-sized mockup. */
.memory-img--phone {
  width: auto;
  max-width: 260px;
  margin-inline: auto;
  box-shadow: 0 8px 30px rgba(44,36,28,.12);
}
