/*
Theme Name: Mageirio
Theme URI: https://mageirio.com
Author: Mageirio
Description: A calm, Mediterranean-inspired theme for a kitchen, healthy-food, and home-gardening blog. Olive, sand, and clay tones; Fraunces + Karla type; light mode only, built for reliable automated publishing.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: mageirio
*/

/* ==========================================================================
   Fonts (self-hosted, no CDN)
   ========================================================================== */
@font-face {
  font-family: "Fraunces";
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
  src: url("assets/fonts/fraunces.woff2") format("woff2");
}
@font-face {
  font-family: "Karla";
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  src: url("assets/fonts/karla.woff2") format("woff2");
}

/* ==========================================================================
   Design tokens — light mode only, by design
   ========================================================================== */
:root {
  --paper: #faf7f2;
  --paper-raised: #f1ead9;
  --ink: #2f2c22;
  --ink-soft: #625c4c;
  --olive: #6b7f3e;
  --olive-deep: #4a5a2b;
  --olive-tint: #e3e8d2;
  --terracotta: #c1502e;
  --terracotta-deep: #9c3f23;
  --terracotta-tint: #f3ddce;
  --clay: #9c7a54;
  --line: rgba(47, 44, 34, 0.13);
  --shadow: rgba(60, 50, 20, 0.14);

  --measure: 68ch;
  --radius: 7px;
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html { color-scheme: light only; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Karla", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
::selection { background: var(--olive-tint); color: var(--olive-deep); }
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.screen-reader-text:focus {
  position: static; width: auto; height: auto; clip: auto; padding: 8px 12px;
  background: var(--ink); color: var(--paper); z-index: 100;
}
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }

h1, h2, h3 { font-family: "Fraunces", Georgia, serif; text-wrap: balance; margin: 0; font-weight: 600; color: var(--ink); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 56px); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px clamp(20px, 4vw, 56px); position: sticky; top: 0;
  background: rgba(250, 247, 242, 0.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); z-index: 50;
}
.site-logo {
  display: flex; align-items: center; text-decoration: none; flex: none;
}
.site-logo img { height: 36px; width: auto; display: block; }
.primary-nav { display: flex; }
.primary-nav ul { display: flex; gap: clamp(14px, 2vw, 28px); list-style: none; margin: 0; padding: 0; font-size: 0.88rem; font-weight: 700; }
.primary-nav a { text-decoration: none; color: var(--ink-soft); }
.primary-nav li.current-menu-item > a,
.primary-nav li.current-menu-parent > a,
.primary-nav a:hover { color: var(--terracotta-deep); }
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .primary-nav { display: none; }
}

/* ==========================================================================
   Photo placeholder convention (used until real media is attached)
   ========================================================================== */
.ph-photo {
  position: relative; border-radius: 6px; overflow: hidden;
  background:
    repeating-linear-gradient(135deg, rgba(107,127,62,0.10) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, var(--olive-tint), var(--paper-raised));
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--clay);
}
.ph-photo svg { width: 30%; max-width: 52px; color: var(--clay); opacity: 0.75; }
.ar-16-9 { aspect-ratio: 16/9; }
.ar-4-3 { aspect-ratio: 4/3; }

/* ==========================================================================
   Buttons / affiliate links / tags
   ========================================================================== */
.btn, .wp-block-button__link {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: "Karla", sans-serif; font-weight: 700; font-size: 0.88rem;
  padding: 12px 22px; border-radius: var(--radius); text-decoration: none; border: 1.5px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: var(--terracotta); color: #fff9f2;
}
.btn:hover, .wp-block-button__link:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgba(156,63,35,0.55); color: #fff9f2; }
.btn-ghost { background: transparent; border-color: var(--olive); color: var(--olive-deep); }
.btn-ghost:hover { background: var(--olive-tint); box-shadow: none; color: var(--olive-deep); }

/* Block style: Affiliate button (core/button -> is-style-affiliate) — soft, not aggressive */
.wp-block-button.is-style-affiliate .wp-block-button__link {
  background: transparent; border: 1.5px solid var(--terracotta); color: var(--terracotta-deep);
}
.wp-block-button.is-style-affiliate .wp-block-button__link:hover { background: var(--terracotta-tint); }

.aff-link, .post-body a.aff-link {
  color: var(--terracotta-deep);
  text-decoration: underline; text-decoration-style: dotted; text-decoration-thickness: 1.5px;
  text-underline-offset: 3px; font-weight: 700;
}
.tag-pill {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 5px 12px; border-radius: 999px; background: var(--olive-tint); color: var(--olive-deep);
  text-decoration: none;
}

/* ==========================================================================
   Highlight boxes — core/group block styles: Tip / Note / Warning
   ========================================================================== */
.wp-block-group.is-style-tip,
.wp-block-group.is-style-note,
.wp-block-group.is-style-warning {
  border-radius: 6px; padding: 18px 20px; margin: 26px 0; border-left: 4px solid;
}
.wp-block-group.is-style-tip::before,
.wp-block-group.is-style-note::before,
.wp-block-group.is-style-warning::before {
  display: block; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px;
}
.wp-block-group.is-style-tip { background: var(--olive-tint); border-color: var(--olive); color: var(--olive-deep); }
.wp-block-group.is-style-tip::before { content: "Tip"; }
.wp-block-group.is-style-note { background: #eef1ea; border-color: var(--clay); color: var(--ink); }
.wp-block-group.is-style-note::before { content: "Note"; color: var(--clay); }
.wp-block-group.is-style-warning { background: var(--terracotta-tint); border-color: var(--terracotta); color: var(--terracotta-deep); }
.wp-block-group.is-style-warning::before { content: "Warning"; }
.wp-block-group.is-style-tip p,
.wp-block-group.is-style-note p,
.wp-block-group.is-style-warning p { margin: 0; }

/* Auto-generated TOC box */
.post-toc {
  border: 1px solid var(--line); border-radius: 8px; padding: 18px 22px; margin: 28px 0;
  background: var(--paper-raised);
}
.post-toc .toc-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--clay); }
.post-toc ol { margin: 12px 0 0; padding-left: 20px; }
.post-toc li { font-size: 0.9rem; margin-bottom: 6px; }
.post-toc a { text-decoration: none; color: var(--ink); }
.post-toc a:hover { color: var(--terracotta-deep); }

/* Block style: ingredient checklist (core/list -> is-style-ingredients) */
ul.wp-block-list.is-style-ingredients { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 9px; }
ul.wp-block-list.is-style-ingredients li { position: relative; padding-left: 26px; font-size: 0.96rem; }
ul.wp-block-list.is-style-ingredients li::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 14px;
  border: 2px solid var(--olive); border-radius: 3px;
}

/* Block style: numbered steps (core/list -> is-style-steps) */
ol.wp-block-list.is-style-steps { margin: 18px 0; padding: 0; list-style: none; counter-reset: step; }
ol.wp-block-list.is-style-steps > li {
  position: relative; padding-left: 48px; min-height: 34px; counter-increment: step;
}
ol.wp-block-list.is-style-steps > li + li { margin-top: 18px; }
ol.wp-block-list.is-style-steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  font-family: "Fraunces"; font-weight: 600; color: var(--olive-deep);
  background: var(--olive-tint); width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: clamp(36px, 6vw, 64px) clamp(20px, 4vw, 56px); display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(24px, 4vw, 48px); align-items: center; }
.hero-eyebrow { color: var(--terracotta); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.1rem); color: var(--olive-deep); margin-top: 12px; line-height: 1.1; }
.hero p.sub { margin-top: 16px; color: var(--ink-soft); font-size: 1.05rem; max-width: 42ch; }
.hero-actions { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { position: relative; }
.hero-art .float-card {
  position: absolute; bottom: -18px; left: -18px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px;
  box-shadow: 0 14px 30px -14px var(--shadow); font-size: 0.8rem; display: flex; gap: 10px; align-items: center; max-width: 220px;
}
.hero-art .float-card svg { width: 22px; height: 22px; color: var(--olive); flex: none; }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
}

/* ==========================================================================
   Card grids (featured / latest / archives / related)
   ========================================================================== */
.site-block { padding: clamp(28px, 5vw, 48px) clamp(20px, 4vw, 56px); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.block-head h2 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
.block-head .view-all { font-size: 0.82rem; font-weight: 700; color: var(--terracotta-deep); text-decoration: none; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.card-grid.featured { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.post-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; }
.post-card .cat { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--olive-deep); }
.post-card h3 { font-size: 1.05rem; margin-top: 4px; line-height: 1.3; }
.post-card p { font-size: 0.87rem; color: var(--ink-soft); margin: 6px 0 0; }
.post-card .meta { font-size: 0.74rem; color: var(--clay); margin-top: 4px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.cat-tile { border-radius: 8px; padding: 22px 20px; display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); text-decoration: none; }
.cat-tile svg { width: 26px; height: 26px; }
.cat-tile h3 { font-size: 1rem; }
.cat-tile p { font-size: 0.8rem; color: var(--ink-soft); margin: 0; }
.cat-tile.c1 { background: var(--olive-tint); }
.cat-tile.c1 svg { color: var(--olive-deep); }
.cat-tile.c2 { background: #efe9d6; }
.cat-tile.c2 svg { color: var(--clay); }
.cat-tile.c3 { background: #e4ecda; }
.cat-tile.c3 svg { color: var(--olive); }
.cat-tile.c4 { background: var(--terracotta-tint); }
.cat-tile.c4 svg { color: var(--terracotta-deep); }

/* ==========================================================================
   Single post
   ========================================================================== */
.post-shell { max-width: 760px; margin: 0 auto; padding: clamp(32px, 5vw, 52px) clamp(18px, 4vw, 20px) 60px; }
.post-crumb { font-size: 0.78rem; color: var(--ink-soft); }
.post-crumb a { text-decoration: none; color: var(--olive-deep); font-weight: 700; }
.post-shell h1.post-title { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-top: 14px; line-height: 1.15; }
.post-dek { color: var(--ink-soft); font-size: 1.08rem; margin-top: 14px; max-width: 58ch; }
.post-meta-row { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.post-meta-row .avatar { border-radius: 50%; flex: none; }
.post-meta-row .who b { display: block; font-size: 0.86rem; }
.post-meta-row .who span { font-size: 0.76rem; color: var(--ink-soft); }
.recipe-chips { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.recipe-chip { font-size: 0.72rem; background: var(--paper-raised); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-weight: 700; color: var(--ink-soft); }

.post-hero-img { margin-top: 26px; }
.post-hero-img img { border-radius: 6px; width: 100%; }

.post-body { margin-top: 30px; font-size: 1.03rem; max-width: var(--measure); }
.post-body > p, .post-body > .wp-block-paragraph { margin: 0 0 22px; }
.post-body h2 { font-size: 1.5rem; margin: 46px 0 16px; }
.post-body h3 { font-size: 1.12rem; font-weight: 500; margin: 28px 0 12px; color: var(--olive-deep); }
.post-body figure { margin: 30px 0; }
.post-body figure img { border-radius: 6px; }
.post-body figcaption { font-size: 0.8rem; color: var(--ink-soft); margin-top: 8px; text-align: center; }
.post-body ul:not(.is-style-ingredients), .post-body ol:not(.is-style-steps) { padding-left: 22px; }

.affiliate-cta {
  margin: 34px 0; border: 1px solid var(--line); border-radius: 10px; padding: 24px;
  background: linear-gradient(180deg, var(--paper-raised), var(--paper));
}
.affiliate-cta .tag { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--terracotta-deep); }
.affiliate-cta h3 { font-size: 1.2rem; margin-top: 8px; }
.affiliate-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.aff-product { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: var(--paper); display: flex; flex-direction: column; gap: 8px; }
.aff-product .name { font-weight: 700; font-size: 0.92rem; }
.aff-product .why { font-size: 0.8rem; color: var(--ink-soft); flex: 1; }
.aff-product .btn { justify-content: center; font-size: 0.78rem; padding: 9px 14px; }
.disclosure { font-size: 0.74rem; color: var(--ink-soft); margin-top: 14px; font-style: italic; }

.related-head { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--clay); margin-bottom: 16px; }
.author-strip { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; gap: 14px; align-items: center; }
.author-strip .avatar { border-radius: 50%; flex: none; }
.author-strip p { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }

/* ==========================================================================
   Archive / index
   ========================================================================== */
.archive-header { padding: clamp(32px, 6vw, 56px) clamp(20px, 4vw, 56px) 0; }
.archive-header .eyebrow { color: var(--terracotta); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.archive-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-top: 10px; color: var(--olive-deep); }
.archive-header p { color: var(--ink-soft); margin-top: 10px; max-width: 60ch; }

.pagination { display: flex; gap: 10px; justify-content: center; padding: 40px 0; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-size: 0.85rem; }
.pagination .current { background: var(--olive); color: #fff; border-color: var(--olive); }

/* ==========================================================================
   Page template
   ========================================================================== */
.page-shell { max-width: 760px; margin: 0 auto; padding: clamp(32px, 5vw, 52px) 20px 60px; }
.page-shell h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 20px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; }
.footer-grid { padding: clamp(32px, 5vw, 48px) clamp(20px, 4vw, 56px); display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px; }
.footer-grid h4 { font-family: "Karla"; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--clay); margin-bottom: 12px; }
.footer-grid p, .footer-grid a { font-size: 0.88rem; color: var(--ink-soft); text-decoration: none; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-bottom { border-top: 1px solid var(--line); padding: 18px clamp(20px, 4vw, 56px); font-size: 0.78rem; color: var(--ink-soft); text-align: center; }
