/* =========================================================
   Molaqu Matbakh — Tunisian recipe journal
   Structural variant: Tavola
   ========================================================= */

:root {
  --cream: #FBF3E4;
  --cream-deep: #F1E2C4;
  --white: #FFFDF8;
  --ink: #241E17;
  --ink-soft: #5C5040;
  --blue: #1C5D82;
  --blue-deep: #123E5A;
  --terracotta: #C1481E;
  --terracotta-deep: #97370F;
  --gold: #C99A46;
  --olive: #6E7C3D;
  --line: #E4D3AC;

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-sans: 'Karla', 'Segoe UI', Helvetica, Arial, sans-serif;

  --max-width: 1240px;
  --radius: 6px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; scroll-behavior: smooth; } /* 18px base */
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3, h4, blockquote, p { margin: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--white);
  padding: 0.75rem 1.25rem;
  z-index: 999;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Kicker / shared type ---------- */
.kicker {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--terracotta-deep);
  margin: 0 0 0.85rem;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); font-weight: 500; }
em { font-style: italic; color: var(--terracotta); }

/* =========================================================
   Header / Tavola mega-menu nav
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(251, 243, 228, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.65rem; }
.brand-mark { font-size: 1.7rem; line-height: 1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--blue-deep);
}
.brand-sub {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--terracotta);
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 2.1rem;
  list-style: none;
}
.main-nav > ul > li > a {
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.4rem 0;
  position: relative;
}
.main-nav > ul > li > a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.main-nav > ul > li > a:hover::after,
.main-nav > ul > li:focus-within > a::after { transform: scaleX(1); }

/* Mega menu: pure CSS, hover / focus-within */
.has-mega { position: relative; }
.mega-menu {
  position: absolute;
  top: calc(100% + 1.05rem);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: 560px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 22px 44px rgba(36, 30, 23, 0.14);
  padding: 1.6rem 1.8rem;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.6rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 50;
}
.mega-menu::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 14px; height: 14px;
  background: var(--white);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.has-mega:hover .mega-menu,
.has-mega:focus-within .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.mega-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.7rem;
}
.mega-col { display: flex; flex-direction: column; gap: 0.55rem; }
.mega-col a { font-size: 0.92rem; font-weight: 500; color: var(--ink-soft); }
.mega-col a:hover { color: var(--terracotta); }
.mega-note p { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.5; font-weight: 400; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.4rem;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.7rem;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 3px;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-primary { background: var(--terracotta); color: var(--white); }
.btn-primary:hover { background: var(--terracotta-deep); transform: translateY(-2px); }
.btn-ghost { border: 1.5px solid var(--blue); color: var(--blue-deep); }
.btn-ghost:hover { background: var(--blue); color: var(--white); transform: translateY(-2px); }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2.1rem; }

/* =========================================================
   Hero — asymmetric two column, thin frame, no overlay
   ========================================================= */
.hero { padding: 4.6rem 2rem 3.4rem; }
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 4rem;
  align-items: center;
}
.hero-copy h1 {
  font-size: clamp(2.5rem, 1.6rem + 3.4vw, 4.1rem);
  line-height: 1.06;
  letter-spacing: -0.01em;
  margin-bottom: 1.35rem;
}
.hero-lede {
  max-width: 46ch;
  font-size: 1.14rem;
  color: var(--ink-soft);
}
.hero-media { position: relative; }
.hero-frame {
  position: relative;
  padding: 14px;
  border: 1px solid var(--gold);
  outline: 1px solid var(--line);
  outline-offset: 8px;
}
.hero-frame img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.hero-caption {
  margin-top: 1.1rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
  font-style: italic;
  padding-left: 4px;
}

/* =========================================================
   Principles — single inline row of SVG + word
   ========================================================= */
.principles { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 2.4rem 2rem; background: var(--cream-deep); }
.principles-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2.2rem;
}
.principle-item { display: flex; align-items: center; gap: 0.9rem; }
.principle-icon { width: 34px; height: 34px; color: var(--blue); flex-shrink: 0; }
.principle-text { display: flex; flex-direction: column; line-height: 1.3; }
.principle-word { font-family: var(--font-display); font-weight: 600; font-size: 1.03rem; color: var(--ink); }
.principle-desc { font-size: 0.82rem; color: var(--ink-soft); max-width: 26ch; }
.principle-divider { width: 1px; height: 40px; background: var(--line); }

/* =========================================================
   Recipes — Tavola tab interface
   ========================================================= */
.recipes { padding: 5.2rem 2rem; max-width: var(--max-width); margin: 0 auto; }
.section-head { max-width: 62ch; margin: 0 auto 3rem; text-align: center; }
.section-head h2 { font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.6rem); margin-bottom: 1rem; }
.section-sub { color: var(--ink-soft); font-size: 1.03rem; }

.tab-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2.6rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.6rem;
}
.tab-btn {
  padding: 0.62rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: all 0.2s ease;
}
.tab-btn:hover { border-color: var(--blue); color: var(--blue-deep); }
.tab-btn.active { background: var(--blue); border-color: var(--blue); color: var(--white); }

.recipe-panel { display: none; }
.recipe-panel.active {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 3rem;
  animation: fadeInUp 0.5s ease both;
}
.recipe-media { border: 1px solid var(--gold); padding: 10px; align-self: start; }
.recipe-media img { aspect-ratio: 4 / 3; object-fit: cover; }
.recipe-cat {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--olive);
  margin-bottom: 0.5rem;
}
.recipe-body h3 { font-size: 1.75rem; margin-bottom: 0.85rem; }
.recipe-desc { color: var(--ink-soft); margin-bottom: 1.3rem; }
.recipe-meta {
  display: flex;
  gap: 1.6rem;
  list-style: none;
  padding-bottom: 1.4rem;
  margin-bottom: 1.6rem;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.recipe-meta li { font-size: 0.86rem; color: var(--ink-soft); }
.recipe-meta strong { display: block; font-family: var(--font-display); color: var(--ink); font-size: 0.95rem; }

.recipe-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; }
.recipe-columns h4 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-deep);
  margin-bottom: 0.9rem;
}
.ingredient-list { list-style: none; }
.ingredient-list li {
  padding: 0.42rem 0 0.42rem 1.1rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  font-size: 0.94rem;
}
.ingredient-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 1rem;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--terracotta);
}
.step-list { list-style: none; counter-reset: step; }
.step-list li {
  counter-increment: step;
  padding-left: 2.3rem;
  position: relative;
  margin-bottom: 1rem;
  font-size: 0.94rem;
}
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -0.1rem;
  width: 1.6rem; height: 1.6rem;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   About — serif quote block
   ========================================================= */
.about { padding: 5.5rem 2rem; background: var(--blue-deep); color: var(--cream); }
.about-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.about-mark {
  font-family: var(--font-display);
  font-size: 6rem;
  line-height: 0.4;
  color: var(--gold);
  margin-bottom: 1.6rem;
  display: block;
}
.about-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem);
  line-height: 1.4;
  color: var(--white);
  margin-bottom: 2.4rem;
}
.about-body { display: flex; flex-direction: column; gap: 1.1rem; }
.about-body p { color: #D9E4EA; font-size: 1rem; line-height: 1.7; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer { background: var(--ink); color: #E9DFCB; padding: 4rem 2rem 0; }
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.1fr;
  gap: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(233, 223, 203, 0.15);
}
.footer-brand .brand-name { color: var(--cream); }
.footer-tag { margin-top: 1rem; font-size: 0.92rem; color: #B9AE96; max-width: 32ch; }
.footer-links { display: flex; gap: 3rem; }
.footer-col { display: flex; flex-direction: column; gap: 0.7rem; }
.footer-heading {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}
.footer-col a { font-size: 0.92rem; color: #D9CFB8; }
.footer-col a:hover { color: var(--white); }
.company-contact-box p { font-size: 0.88rem; color: #B9AE96; line-height: 1.6; }
.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.6rem 0;
  font-size: 0.82rem;
  color: #8B8069;
  text-align: center;
}

/* =========================================================
   Reveal — CSS only, staggered fadeInUp
   ========================================================= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
[data-reveal] { animation: fadeInUp 0.7s ease both; }
.site-header[data-reveal] { animation-delay: 0s; }
.hero[data-reveal] { animation-delay: 0.08s; }
.principles[data-reveal] { animation-delay: 0.16s; }
.recipes[data-reveal] { animation-delay: 0.22s; }
.about[data-reveal] { animation-delay: 0.28s; }
.site-footer[data-reveal] { animation-delay: 0.34s; }

.principle-item:nth-child(1) { animation: fadeInUp 0.6s ease both; animation-delay: 0.32s; }
.principle-item:nth-child(3) { animation: fadeInUp 0.6s ease both; animation-delay: 0.4s; }
.principle-item:nth-child(5) { animation: fadeInUp 0.6s ease both; animation-delay: 0.48s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal], .principle-item, .recipe-panel.active { animation: none !important; }
}

/* =========================================================
   Breakpoints — Tavola: 1080 / 780 / 460
   ========================================================= */
@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: 1fr; gap: 2.6rem; }
  .hero-media { order: -1; max-width: 480px; margin: 0 auto; }
  .recipe-panel.active { grid-template-columns: 1fr; }
  .recipe-media { max-width: 480px; margin: 0 auto; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 780px) {
  .main-nav {
    position: fixed;
    top: 68px; left: 0; right: 0; bottom: 0;
    background: var(--cream);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 2rem;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav ul { flex-direction: column; align-items: flex-start; gap: 0; width: 100%; }
  .main-nav > ul > li { width: 100%; border-bottom: 1px solid var(--line); }
  .main-nav > ul > li > a { display: block; padding: 1rem 0; }
  .mega-menu {
    position: static;
    transform: none;
    width: 100%;
    box-shadow: none;
    border: none;
    padding: 0 0 1rem;
    grid-template-columns: 1fr;
    gap: 1.2rem;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: none;
  }
  .mega-menu::before { display: none; }
  .has-mega:focus-within .mega-menu,
  .has-mega:hover .mega-menu { display: grid; }
  .nav-toggle { display: flex; }
  .recipe-columns { grid-template-columns: 1fr; gap: 1.8rem; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { flex-direction: column; gap: 1.8rem; }
  .principles-inner { gap: 1.6rem; }
  .principle-divider { display: none; }
}

@media (max-width: 460px) {
  .header-inner { padding: 0.85rem 1.2rem; }
  .hero { padding: 2.6rem 1.2rem 2.2rem; }
  .hero-copy h1 { font-size: 2.15rem; }
  .principles { padding: 1.8rem 1.2rem; }
  .principle-item { width: 100%; }
  .recipes { padding: 3.2rem 1.2rem; }
  .tab-list { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 1rem; }
  .tab-btn { flex-shrink: 0; }
  .about { padding: 3.4rem 1.2rem; }
  .about-mark { font-size: 4.4rem; }
  .site-footer { padding: 3rem 1.2rem 0; }
}
