/*
Theme Name: Kadence Child — UmbriaRicette
Template: kadence
Version:    1.0.5
Description: Child theme for UmbriaRicette.it. "Trattoria Umbra" brand identity.
Text Domain: kadence-child
*/

/* ===================================================
   1. CSS Custom Properties (tokens)
   =================================================== */

:root {
    /* Brand palette — 5 base + 7 derived; locked by UI-SPEC §Color */
    --ur-color-terracotta:       #B85C38;
    --ur-color-terracotta-dark:  #9A4A2D;
    --ur-color-terracotta-light: #F2D5C8;
    --ur-color-oliva:            #6B7A4F;
    --ur-color-oliva-dark:       #535E3B;
    --ur-color-oro:              #D9A441;
    --ur-color-crema:            #F4EBDD;
    --ur-color-crema-dark:       #E8D9C5;
    --ur-color-crema-border:     #D4C4B0;
    --ur-color-marrone:          #2E2A25;
    --ur-color-marrone-mid:      #5C524A;
    --ur-color-marrone-light:    #8C7F74;

    /* Font stacks */
    --ur-font-heading: 'Fraunces', 'Playfair Display', Georgia, serif;
    --ur-font-body:    'Source Sans 3', Inter, system-ui, sans-serif;

    /* Type scale — canonical tokens; NO values outside this list (UI-SPEC §Typography) */
    --ur-fs-2xs:        12px;
    --ur-fs-xs:         13px;
    --ur-fs-sm:         14px;
    --ur-fs-nav:        15px;
    --ur-fs-base:       17px;
    --ur-fs-lead:       18px;
    --ur-fs-h3:         20px;
    --ur-fs-recipe:     22px;
    --ur-fs-h2:         24px;
    --ur-fs-h2-section: 28px;
    --ur-fs-h1:         36px;
    --ur-fs-hero:       40px; /* overridden to 28px in @media (max-width:767px) */

    /* Spacing — multiples of 4 only; 12px does NOT appear (UI-SPEC §Spacing) */
    --ur-space-xs:   4px;
    --ur-space-sm:   8px;
    --ur-space-md:   16px;
    --ur-space-lg:   24px;
    --ur-space-xl:   32px;
    --ur-space-2xl:  48px;
    --ur-space-3xl:  64px;
}

/* ===================================================
   2. Base / Reset overrides
   =================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--ur-color-crema);
    color: var(--ur-color-marrone);
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-base);
    font-weight: 400;
    line-height: 1.65;
    margin: 0;
    padding: 0;
}

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

a {
    color: var(--ur-color-terracotta-dark);
    text-decoration: none;
    transition: color 150ms ease;
}

a:hover {
    color: var(--ur-color-terracotta);
    text-decoration: underline;
}

/* ===================================================
   3. Typography
   =================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ur-font-heading);
    color: var(--ur-color-marrone);
    line-height: 1.25;
    margin-top: 0;
}

h1 {
    font-size: var(--ur-fs-h1);
    font-weight: 700;
    line-height: 1.15;
}

h2 {
    font-size: var(--ur-fs-h2);
    font-weight: 600;
    line-height: 1.25;
}

h3 {
    font-size: var(--ur-fs-h3);
    font-weight: 600;
    line-height: 1.3;
}

h4 {
    font-size: var(--ur-fs-base);
    font-weight: 600;
}

p {
    margin-top: 0;
    margin-bottom: var(--ur-space-md);
}

/* Inline article body links use terracotta-dark (WCAG AA 5.24:1 on crema — Rule 1 */
.entry-content a,
.page-content a {
    color: var(--ur-color-terracotta-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.entry-content a:hover,
.page-content a:hover {
    color: var(--ur-color-terracotta);
}

/* ===================================================
   4. Header & Navigation
   =================================================== */

/* Header: restyle COLOR only — do NOT impose flex/align on Kadence's #masthead
   wrapper. Kadence lays out its header rows internally; forcing display:flex on
   the outer header forced the rows onto one horizontal line and overflowed the
   viewport on mobile ("header spagina"). Background + min-height are layout-safe. */
.site-header,
.kadence-header {
    background-color: var(--ur-color-marrone);
}

/* The row Kadence ACTUALLY paints is the inner row container, which Kadence
   leaves WHITE (#ffffff) by default — theme_mods_kadence has no header background
   key (verified). The outer .site-header marrone sat BEHIND this white row, so
   the visible header was white → white-on-white nav links + hamburger. Paint the
   REAL row. This selector (0,2,0 specificity) beats Kadence's inline (0,1,0)
   #ffffff without !important, and covers BOTH the desktop #main-header and mobile
   #mobile-header main rows (both nest .site-main-header-wrap > .site-header-row-container-inner). */
.site-main-header-wrap .site-header-row-container-inner {
    background-color: var(--ur-color-marrone);
}

/* Site logo / wordmark in header — cap the IMG (not just the container) so the
   wide source PNG (770x160) keeps the header compact and never overflows. */
.site-header .site-logo,
.kadence-header .site-logo {
    max-height: 44px;
}

.site-header .site-branding img.custom-logo,
.site-header .site-logo img,
img.custom-logo {
    max-height: 44px;
    width: auto;
    max-width: 100%;
}

/* Navigation links */
.header-navigation .menu-item a,
.primary-navigation a {
    color: #ffffff;
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-nav);
    font-weight: 400;
    text-decoration: none;
    padding: var(--ur-space-sm) var(--ur-space-md);
    display: inline-block;
    transition: color 150ms ease;
}

.header-navigation .menu-item a:hover,
.primary-navigation a:hover {
    color: var(--ur-color-terracotta);
    text-decoration: none;
}

/* Active / current nav item */
.header-navigation .current-menu-item > a,
.primary-navigation .current-menu-item > a {
    color: var(--ur-color-terracotta);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Mobile hamburger toggle — MUST be visible on the dark marrone header.
   Kadence colours the toggle with var(--global-palette5); after the brand palette
   remap that slot is marrone-mid (dark) → the icon was invisible on the dark
   header. The real classes are .menu-toggle-open / .menu-toggle-close /
   .drawer-toggle inside .mobile-toggle-open-container (NOT .menu-toggle). Force white. */
.mobile-toggle-open-container .menu-toggle-open,
.mobile-toggle-open-container .menu-toggle-open:focus,
.menu-toggle-open.drawer-toggle,
.menu-toggle-close.drawer-toggle,
.drawer-toggle .menu-toggle-icon {
    color: #ffffff !important;
    background: transparent;
    border: none;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
}

.mobile-toggle-open-container .menu-toggle-open:hover,
.mobile-toggle-open-container .menu-toggle-open:focus-visible {
    color: var(--ur-color-oro) !important;
}

/* Mobile expanded menu */
.kadence-mobile-menu,
.mobile-navigation {
    background-color: var(--ur-color-marrone);
}

.kadence-mobile-menu a,
.mobile-navigation a {
    color: #ffffff;
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-nav);
    font-weight: 400;
    text-decoration: none;
    padding: var(--ur-space-sm) var(--ur-space-md);
    display: block;
    transition: color 150ms ease;
}

.kadence-mobile-menu a:hover,
.mobile-navigation a:hover {
    color: var(--ur-color-terracotta);
}

/* --- Mobile drawer (#mobile-drawer.popup-drawer) ---
   Kadence default .drawer-inner is near-black #090c10 (cold slate, off-brand).
   Paint the FULL panel marrone with a terracotta accent so it matches the header,
   not just the inner <nav>. */
#mobile-drawer .drawer-inner {
    background-color: var(--ur-color-marrone);
    color: #ffffff;
    border-top: 3px solid var(--ur-color-terracotta);
}

/* Drawer header: align the close button to the right edge. */
#mobile-drawer .drawer-header {
    display: flex;
    justify-content: flex-end;
}

/* Close button (the two diagonal bars) — white on marrone, oro on hover/focus. */
#mobile-drawer .menu-toggle-close .toggle-close-bar {
    background-color: #ffffff;
}
#mobile-drawer .menu-toggle-close {
    color: #ffffff;
}
#mobile-drawer .menu-toggle-close:hover .toggle-close-bar,
#mobile-drawer .menu-toggle-close:focus-visible .toggle-close-bar {
    background-color: var(--ur-color-oro);
}

/* Drawer menu links — comfortable touch padding, white text, subtle separators,
   terracotta on hover / current item. */
#mobile-drawer .mobile-navigation .menu-item > a {
    padding: 0.9em 1.2em;
    color: #ffffff;
    border-bottom: 1px solid rgba(244, 235, 221, 0.12);
}
#mobile-drawer .mobile-navigation .menu-item > a:hover,
#mobile-drawer .mobile-navigation .current-menu-item > a {
    color: var(--ur-color-terracotta);
}

/* ===================================================
   5. Footer
   =================================================== */

.site-footer,
.kadence-footer {
    background-color: var(--ur-color-marrone);
    border-top: 2px solid var(--ur-color-terracotta);
    padding: var(--ur-space-2xl) var(--ur-space-lg) var(--ur-space-lg);
    color: var(--ur-color-crema);
}

.site-footer a,
.kadence-footer a {
    color: rgba(244, 235, 221, 0.80); /* crema at 80% opacity */
    text-decoration: none;
    font-size: var(--ur-fs-sm);
    transition: color 150ms ease;
}

.site-footer a:hover,
.kadence-footer a:hover {
    color: var(--ur-color-crema);
    text-decoration: underline;
}

/* Footer column headings */
.site-footer .widget-title,
.site-footer h3,
.kadence-footer .widget-title,
.kadence-footer h3 {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-base);
    font-weight: 600;
    color: var(--ur-color-terracotta-dark);
    margin-bottom: var(--ur-space-md);
}

/* Footer secondary text */
.site-footer p,
.site-footer li,
.kadence-footer p,
.kadence-footer li {
    font-size: var(--ur-fs-sm);
    color: var(--ur-color-crema);
    line-height: 1.4;
}

/* Footer bottom bar */
.site-footer .footer-bottom,
.kadence-footer .footer-bottom,
.site-footer .site-info {
    font-size: var(--ur-fs-xs);
    color: var(--ur-color-marrone-light);
    border-top: 1px solid rgba(140, 127, 116, 0.30);
    margin-top: var(--ur-space-xl);
    padding-top: var(--ur-space-md);
}

/* ===================================================
   6. Breadcrumb (Rank Math)
   =================================================== */

.rank-math-breadcrumb {
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-xs);
    font-weight: 400;
    background: transparent;
    padding: var(--ur-space-sm) 0;
    color: var(--ur-color-marrone-mid);
    line-height: 1.4;
}

.rank-math-breadcrumb p {
    margin: 0;
    color: var(--ur-color-marrone-mid);
}

/* Breadcrumb links — terracotta-dark (WCAG AA 5.24:1 on crema) */
.rank-math-breadcrumb a {
    color: var(--ur-color-terracotta-dark);
    text-decoration: none;
    transition: color 150ms ease;
}

.rank-math-breadcrumb a:hover {
    color: var(--ur-color-terracotta);
    text-decoration: underline;
}

/* Breadcrumb separators and non-linked crumbs */
.rank-math-breadcrumb .separator,
.rank-math-breadcrumb span:not([class]) {
    color: var(--ur-color-marrone-mid);
    margin: 0 var(--ur-space-xs);
}

/* ===================================================
   7. Home page (hero, categories, featured)
   =================================================== */

/* --- Hero section --- */
.home .wp-block-cover,
.home .entry-content > .wp-block-cover {
    background-color: #2E2A25; /* marrone fallback if no image */
    padding: var(--ur-space-3xl) var(--ur-space-lg) var(--ur-space-2xl);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home .wp-block-cover img {
    object-fit: cover;
}

/* Hero H1 */
.home .wp-block-cover h1,
.home .wp-block-cover .wp-block-cover__inner-container h1 {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-hero);
    font-weight: 700;
    color: var(--ur-color-crema);
    line-height: 1.15;
    margin-bottom: var(--ur-space-md);
}

/* Hero tagline */
.home .wp-block-cover p,
.home .wp-block-cover .wp-block-cover__inner-container p {
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-lead);
    font-weight: 400;
    color: rgba(244, 235, 221, 0.90); /* crema at 90% */
    line-height: 1.5;
}

/* --- Category section ("Esplora per Categoria") --- */
.home .wp-block-group.categories-section h2 {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-h2-section);
    font-weight: 600;
    color: var(--ur-color-marrone);
    margin-bottom: var(--ur-space-lg);
}

/* Categories grid: auto-fill, minimum 200px cards */
.home .wp-block-group.categories-section .wp-block-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--ur-space-lg);
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Category card */
.home .wp-block-group.categories-section .wp-block-list li {
    background-color: var(--ur-color-crema-dark);
    border: 1px solid var(--ur-color-crema-border);
    border-left: 4px solid var(--ur-color-oliva);
    border-radius: 6px;
    padding: var(--ur-space-md);
    min-height: 80px;
    display: flex;
    align-items: center;
    transition: background-color 150ms ease, border-left-color 150ms ease;
}

.home .wp-block-group.categories-section .wp-block-list li:hover {
    background-color: var(--ur-color-terracotta-light);
    border-left-color: var(--ur-color-terracotta);
}

/* Category card link */
.home .wp-block-group.categories-section .wp-block-list li a {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-base);
    font-weight: 600;
    color: var(--ur-color-marrone);
    text-decoration: none;
    width: 100%;
}

.home .wp-block-group.categories-section .wp-block-list li a:hover {
    color: var(--ur-color-marrone);
    text-decoration: none;
}

/* --- Featured recipes section ("Ricette in Evidenza") --- */
.home .wp-block-group.featured-section h2 {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-h2-section);
    font-weight: 600;
    color: var(--ur-color-marrone);
    margin-bottom: var(--ur-space-lg);
}

/* Featured 2-column grid desktop, 1-column mobile */
.home .wp-block-group.featured-section .wp-block-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--ur-space-md);
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Featured list item */
.home .wp-block-group.featured-section .wp-block-list li {
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-base);
    font-weight: 400;
    color: var(--ur-color-marrone);
    padding-left: var(--ur-space-md);
    position: relative;
}

/* Oro bullet via ::before */
.home .wp-block-group.featured-section .wp-block-list li::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background-color: var(--ur-color-oro);
    border-radius: 50%;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

/* Featured links */
.home .wp-block-group.featured-section .wp-block-list li a {
    color: var(--ur-color-terracotta-dark);
    text-decoration: none;
    font-weight: 400;
}

.home .wp-block-group.featured-section .wp-block-list li a:hover {
    color: var(--ur-color-terracotta-dark);
    text-decoration: underline;
}

/* ===================================================
   8. Archive grids (category + zona)
   =================================================== */

/* Archive main layout */
.archive .site-main {
    padding: var(--ur-space-lg) 0;
}

/* Archive grid container — applied to post loop wrapper */
.archive .site-main .posts-container,
.archive .site-main > .wp-block-query,
.archive .posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--ur-space-lg);
}

/* Individual archive post card */
.archive article.post,
.archive .post {
    background-color: var(--ur-color-crema);
    border: 1px solid var(--ur-color-crema-border);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 150ms ease, transform 150ms ease;
}

.archive article.post:hover,
.archive .post:hover {
    box-shadow: 0 4px 12px rgba(46, 42, 37, 0.12);
    transform: translateY(-2px);
}

/* Archive card thumbnail */
.archive article.post .wp-post-image,
.archive .post-thumbnail img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center;
    display: block;
    /* loading="lazy" is applied via WordPress (not hero — below fold on archive) */
}

/* Card body padding */
.archive article.post .entry-summary,
.archive article.post .post-content-wrapper,
.archive .entry-summary {
    padding: var(--ur-space-md);
}

/* Post title in card */
.archive article.post .entry-title,
.archive article.post h2.entry-title {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-base);
    font-weight: 600;
    color: var(--ur-color-marrone);
    line-height: 1.25;
    margin-bottom: var(--ur-space-xs);
}

.archive article.post .entry-title a {
    color: var(--ur-color-marrone);
    text-decoration: none;
}

.archive article.post .entry-title a:hover {
    color: var(--ur-color-terracotta-dark);
}

/* Meta line (date, reading time, category) */
.archive article.post .entry-meta,
.archive .post-meta {
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-xs);
    color: var(--ur-color-marrone-mid);
    margin-bottom: var(--ur-space-sm);
    line-height: 1.4;
}

/* Zona tag pill */
.archive .zona-tag,
.term-zona,
.tag-zona {
    display: inline-block;
    background-color: var(--ur-color-oliva);
    color: #ffffff;
    font-size: var(--ur-fs-2xs);
    padding: var(--ur-space-xs) var(--ur-space-sm);
    border-radius: 6px;
    line-height: 1.4;
    margin-left: var(--ur-space-xs);
    text-decoration: none;
}

/* Excerpt — 2-line clamp */
.archive article.post .entry-summary p,
.archive .entry-summary {
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-sm);
    color: var(--ur-color-marrone-mid);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 0;
    line-height: 1.4;
}

/* ===================================================
   9. Pillar pages
   =================================================== */

/* Pillar page content column */
.page .entry-content {
    max-width: 720px;
    margin: 0 auto;
}

/* Pillar H1 */
.page .entry-content h1 {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-h1);
    font-weight: 700;
    color: var(--ur-color-marrone);
    line-height: 1.15;
    margin-bottom: var(--ur-space-lg);
}

/* Pillar H2 — with optional terracotta ::after underline */
.page .entry-content h2 {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-h2);
    font-weight: 600;
    color: var(--ur-color-marrone);
    line-height: 1.25;
    margin-top: var(--ur-space-xl);
    margin-bottom: var(--ur-space-md);
    position: relative;
    padding-bottom: var(--ur-space-sm);
}

.page .entry-content h2::after {
    content: '';
    display: block;
    width: var(--ur-fs-h2); /* 24px — contained underline accent */
    height: 2px;
    background-color: var(--ur-color-terracotta);
    position: absolute;
    bottom: 0;
    left: 0;
}

/* Pillar H3 */
.page .entry-content h3 {
    font-family: var(--ur-font-heading);
    font-size: var(--ur-fs-h3);
    font-weight: 600;
    color: var(--ur-color-marrone);
    margin-top: var(--ur-space-lg);
    margin-bottom: var(--ur-space-sm);
}

/* Pillar body paragraphs */
.page .entry-content p {
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-base);
    font-weight: 400;
    color: var(--ur-color-marrone);
    line-height: 1.65;
    margin-bottom: var(--ur-space-md);
}

/* Lead paragraph — first <p> after H1 */
.page .entry-content > p:first-of-type {
    font-size: var(--ur-fs-lead);
    font-weight: 400;
    line-height: 1.5;
}

/* Pull quote / callout box — oro left border */
.page .entry-content blockquote {
    border-left: 4px solid var(--ur-color-oro);
    background-color: var(--ur-color-crema-dark);
    padding: var(--ur-space-md);
    border-radius: 0 6px 6px 0;
    margin: var(--ur-space-lg) 0;
    font-style: italic;
}

/* ===================================================
  10. Recipe content (Fa parte di, Ricette Correlate)
   =================================================== */

/* "Fa parte di" uplink callout — .pillar-uplink class set in Gutenberg block */
.pillar-uplink {
    display: block;
    background-color: var(--ur-color-crema-dark);
    border-left: 4px solid var(--ur-color-terracotta);
    border-radius: 0 4px 4px 0;
    padding: var(--ur-space-sm) var(--ur-space-md);
    margin: var(--ur-space-lg) 0;
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-sm);
    font-weight: 400;
    color: var(--ur-color-marrone-mid);
    font-style: italic;
}

/* Uplink callout link */
.pillar-uplink a {
    font-size: var(--ur-fs-sm);
    font-weight: 600;
    color: var(--ur-color-terracotta-dark);
    text-decoration: none;
    font-style: normal;
}

.pillar-uplink a:hover {
    text-decoration: underline;
}

/* "Ricette Correlate" section */
.entry-content .wp-block-heading + .wp-block-list,
.entry-content h2.ricette-correlate-heading {
    /* Section separator above Ricette Correlate H2 */
}

/* Apply top border + spacing to any H2 labeled Ricette Correlate via adjacent sibling or class */
.entry-content .wp-block-heading:is([id*="ricette-correlate"], [id*="correlate"]) {
    border-top: 2px solid var(--ur-color-crema-border);
    margin-top: var(--ur-space-xl);
    padding-top: var(--ur-space-lg);
}

/* Ricette Correlate list items */
.entry-content .wp-block-list li {
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-base);
    color: var(--ur-color-marrone);
    padding: var(--ur-space-sm) 0 var(--ur-space-sm) var(--ur-space-lg);
    border-bottom: 1px solid var(--ur-color-crema-border);
    position: relative;
    list-style: none;
}

/* Oro square bullet ::before (8x8) */
.entry-content .wp-block-list li::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background-color: var(--ur-color-oro);
    position: absolute;
    left: 0;
    top: calc(var(--ur-space-sm) + 7px); /* vertically centered with text */
}

/* State 1: <strong> name + <em>in arrivo</em> — no link */
.entry-content .wp-block-list li strong {
    color: var(--ur-color-marrone);
    font-weight: 600;
}

.entry-content .wp-block-list li em {
    color: var(--ur-color-marrone-mid);
    font-style: italic;
}

/* State 2: <a> link — terracotta-dark */
.entry-content .wp-block-list li a {
    color: var(--ur-color-terracotta-dark);
    text-decoration: none;
    font-weight: 400;
}

.entry-content .wp-block-list li a:hover {
    text-decoration: underline;
}

/* ===================================================
  11. WPRM Recipe Card
   =================================================== */

/* Card container — two-level nesting for specificity (Pitfall 6) */
.wprm-recipe-container {
    background: var(--ur-color-crema) !important;
    border: 1px solid var(--ur-color-crema-border) !important;
    border-radius: 8px;
    overflow: hidden;
    margin: var(--ur-space-xl) 0;
}

/* Section headers (Ingredienti / Procedimento / Note) — FLAT, no dark band.
   In the WPRM "Meadow" template `.wprm-recipe-header` is the per-SECTION header
   (not a top card band). A dark marrone background here put a heavy black box on
   every section → "troppo boxato". Flat: terracotta text + a thin rule reads
   cleanly on the crema card. (Section h3 colour rules below still apply; the
   transparent background is the key change.) */
.wprm-recipe-container .wprm-recipe-header {
    background: transparent !important;
    padding: 0 0 var(--ur-space-xs) !important;
    margin-top: var(--ur-space-md);
    border-bottom: 1px solid var(--ur-color-crema-border);
}

/* Recipe name */
.wprm-recipe-container .wprm-recipe-name {
    font-family: var(--ur-font-heading) !important;
    font-size: var(--ur-fs-recipe) !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    line-height: 1.2;
}

/* Recipe image */
.wprm-recipe-container .wprm-recipe-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* Recipe details row (prep/cook/total/servings) */
.wprm-recipe-container .wprm-recipe-block-container-columns {
    background-color: var(--ur-color-crema-dark);
    padding: var(--ur-space-sm) var(--ur-space-md);
}

/* Details label — ALL CAPS 13px */
.wprm-recipe-container .wprm-recipe-block-container .wprm-recipe-block-container-column .wprm-recipe-block-container-column-header {
    font-family: var(--ur-font-body) !important;
    font-size: var(--ur-fs-xs) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ur-color-marrone-mid) !important;
}

/* Details value */
.wprm-recipe-container .wprm-recipe-total-minutes,
.wprm-recipe-container .wprm-recipe-prep-minutes,
.wprm-recipe-container .wprm-recipe-cook-minutes,
.wprm-recipe-container .wprm-recipe-servings {
    font-family: var(--ur-font-body) !important;
    font-size: var(--ur-fs-sm) !important;
    font-weight: 600 !important;
    color: var(--ur-color-marrone) !important;
}

/* Recipe body spacing — light vertical rhythm only.
   A blanket 24px on EVERY .wprm-recipe-block-container (which in the Meadow
   template also matches the servings/course/cuisine PILL blocks and each time
   TABLE block) compounded into a heavy boxed card ("troppo padding"). Keep a
   small horizontal inset off the card edge + minimal vertical spacing. */
.wprm-recipe-container .wprm-recipe-block-container {
    padding: var(--ur-space-sm) var(--ur-space-md);
}

/* Compact the meta row: pills (servings/course/cuisine) + time tables don't need
   the section inset — they have their own compact layout in the Meadow template. */
.wprm-recipe-container .wprm-recipe-block-container-pills,
.wprm-recipe-container .wprm-recipe-block-container-table {
    padding-top: var(--ur-space-xs);
    padding-bottom: var(--ur-space-xs);
}

/* Ingredients H3 */
.wprm-recipe-container .wprm-recipe-ingredient-container > h3,
.wprm-recipe-container .wprm-recipe-ingredients-container h3 {
    font-family: var(--ur-font-heading) !important;
    font-size: var(--ur-fs-lead) !important;
    font-weight: 600 !important;
    color: var(--ur-color-marrone) !important;
    margin-bottom: var(--ur-space-sm);
}

/* Ingredient list items */
.wprm-recipe-container .wprm-recipe-ingredient {
    font-family: var(--ur-font-body) !important;
    font-size: var(--ur-fs-base) !important;
    color: var(--ur-color-marrone) !important;
    line-height: 1.65;
    padding-left: var(--ur-space-md);
    position: relative;
    margin-bottom: var(--ur-space-xs);
}

/* Terracotta circle bullet before ingredient */
.wprm-recipe-container .wprm-recipe-ingredient::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    background: var(--ur-color-terracotta);
    border-radius: 50%;
    position: absolute;
    left: 0;
    top: 8px;
}

/* Instructions H3 */
.wprm-recipe-container .wprm-recipe-instruction-container > h3,
.wprm-recipe-container .wprm-recipe-instructions-container h3 {
    font-family: var(--ur-font-heading) !important;
    font-size: var(--ur-fs-lead) !important;
    font-weight: 600 !important;
    color: var(--ur-color-marrone) !important;
    margin-bottom: var(--ur-space-sm);
}

/* Instructions list — NATIVE ordered-list numbering.
   WPRM/Meadow renders steps as <ol class="wprm-recipe-instructions"> with
   <li class="wprm-recipe-instruction"> and relies on the native list marker
   (the plugin only sets list-style-position:outside). A previous display:flex on
   the <li> removed that marker → steps lost their numbers. Keep each step a
   list-item and brand its number via ::marker. The :not(...-tip) guard leaves
   WPRM "tip" rows (which are intentionally unnumbered) alone. */
.wprm-recipe-container .wprm-recipe-instructions {
    list-style: decimal outside !important;
    margin: 0;
    padding-left: var(--ur-space-lg);
}

.wprm-recipe-container .wprm-recipe-instruction:not(.wprm-recipe-instruction-tip) {
    display: list-item !important;
    list-style: decimal outside !important;
    margin-bottom: var(--ur-space-md);
    padding-left: var(--ur-space-xs);
    background: none;
    border: none;
}

/* Brand the step number (the ::marker of each numbered <li>) */
.wprm-recipe-container .wprm-recipe-instruction:not(.wprm-recipe-instruction-tip)::marker {
    color: var(--ur-color-terracotta);
    font-family: var(--ur-font-heading);
    font-weight: 700;
}

/* Instruction step text */
.wprm-recipe-container .wprm-recipe-instruction-text {
    font-family: var(--ur-font-body) !important;
    font-size: var(--ur-fs-base) !important;
    color: var(--ur-color-marrone) !important;
    line-height: 1.65;
}

/* Print button — ghost style */
.wprm-recipe-container .wprm-print-recipe-container .wprm-print-recipe-button,
.wprm-recipe-container a.wprm-print-recipe-button {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--ur-color-terracotta) !important;
    color: var(--ur-color-terracotta-dark) !important;
    background: transparent !important;
    font-family: var(--ur-font-body) !important;
    font-size: var(--ur-fs-sm) !important;
    font-weight: 400;
    padding: var(--ur-space-xs) var(--ur-space-md);
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 150ms ease, color 150ms ease;
    min-height: 44px;
    cursor: pointer;
}

.wprm-recipe-container .wprm-print-recipe-container .wprm-print-recipe-button:hover,
.wprm-recipe-container a.wprm-print-recipe-button:hover {
    background-color: var(--ur-color-terracotta-light) !important;
    color: var(--ur-color-marrone) !important;
}

/* ===================================================
  12. Buttons & CTAs
   =================================================== */

/* Primary CTA — terracotta fill, white text */
.wp-block-button .wp-block-button__link,
.wp-block-button__link,
.button,
button[type="submit"] {
    background-color: var(--ur-color-terracotta);
    color: #ffffff;
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-base);
    font-weight: 600;
    letter-spacing: 0.02em;
    border: none;
    border-radius: 4px;
    padding: var(--ur-space-sm) var(--ur-space-lg);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 150ms ease;
    /* No box-shadow — flat button per "Trattoria Umbra" rustic aesthetic */
}

.wp-block-button .wp-block-button__link:hover,
.wp-block-button__link:hover,
.button:hover,
button[type="submit"]:hover {
    background-color: var(--ur-color-terracotta-dark);
    color: #ffffff;
    text-decoration: none;
}

/* Keyboard focus — accessibility */
.wp-block-button .wp-block-button__link:focus,
.wp-block-button__link:focus,
.button:focus,
button[type="submit"]:focus {
    outline: 2px solid #9A4A2D;
    outline-offset: 2px;
}

/* ===================================================
  13. Image placeholder treatment
   =================================================== */

/*
 * Placeholder images generated by GD (content/recipes/_placeholder.jpg).
 * When the src contains "placeholder", hide the broken <img> and show a
 * crema-dark background with SVG plate icon + "Foto in arrivo" caption
 * via ::before / ::after on the parent <figure> element.
 */

/* Hide placeholder <img> content (keep the element in layout) */
.wp-post-image[src*="placeholder"] {
    visibility: hidden;
    background-color: var(--ur-color-crema-dark);
}

/* Parent figure — show fallback background + centered icon */
figure:has(.wp-post-image[src*="placeholder"]),
.wp-block-post-featured-image:has(img[src*="placeholder"]) {
    background-color: var(--ur-color-crema-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    position: relative;
}

/* Plate/bowl SVG icon as background on parent figure */
figure:has(.wp-post-image[src*="placeholder"])::before,
.wp-block-post-featured-image:has(img[src*="placeholder"])::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    /* Plate outline: SVG encoded as data-URI, marrone-mid stroke */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none' stroke='%235C524A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='24' cy='24' rx='18' ry='18'/%3E%3Cellipse cx='24' cy='24' rx='12' ry='12'/%3E%3Cline x1='24' y1='6' x2='24' y2='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    margin-bottom: var(--ur-space-xs);
}

/* "Foto in arrivo" caption */
figure:has(.wp-post-image[src*="placeholder"])::after,
.wp-block-post-featured-image:has(img[src*="placeholder"])::after {
    content: 'Foto in arrivo';
    font-family: var(--ur-font-body);
    font-size: var(--ur-fs-2xs);
    color: var(--ur-color-marrone-light);
    text-align: center;
}

/*
 * Fallback for browsers where :has() is not supported:
 * Apply a crema-dark background directly on the figure using the
 * overflow:hidden container approach — graceful degradation.
 */
.wp-post-image[src*="placeholder"] {
    background-color: var(--ur-color-crema-dark);
}

/* Archive card placeholder — maintain 16:9 container */
.archive article.post .post-thumbnail:has(img[src*="placeholder"]) {
    aspect-ratio: 16 / 9;
    background-color: var(--ur-color-crema-dark);
    overflow: hidden;
}

/* WPRM recipe card image placeholder — maintain 16:9 */
.wprm-recipe-container .wprm-recipe-image:has(img[src*="placeholder"]) {
    aspect-ratio: 16 / 9;
    background-color: var(--ur-color-crema-dark);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===================================================
  14. Responsive (mobile breakpoints)
   =================================================== */

/* --- Mobile: max-width 767px (Kadence default mobile breakpoint) --- */
@media (max-width: 767px) {
    :root {
        --ur-fs-hero: 28px; /* hero H1 smaller on mobile */
    }

    /* Header height reduced on mobile */
    .site-header,
    .kadence-header {
        min-height: 56px;
    }

    /* Hero padding reduced on mobile */
    .home .wp-block-cover,
    .home .entry-content > .wp-block-cover {
        padding: var(--ur-space-2xl) var(--ur-space-md) var(--ur-space-xl);
        min-height: 300px;
    }

    /* Archive grid: single column on mobile */
    .archive .site-main .posts-container,
    .archive .site-main > .wp-block-query,
    .archive .posts-grid {
        grid-template-columns: 1fr;
    }

    /* Categories: reduced min-width on mobile */
    .home .wp-block-group.categories-section .wp-block-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--ur-space-md);
    }

    /* Featured: 1 column on mobile */
    .home .wp-block-group.featured-section .wp-block-list {
        grid-template-columns: 1fr;
    }

    /* WPRM recipe card body padding tighter on mobile (less boxing) */
    .wprm-recipe-container .wprm-recipe-block-container {
        padding: var(--ur-space-xs) var(--ur-space-sm);
    }

    /* Pillar content: remove max-width constraint on mobile (full width) */
    .page .entry-content {
        max-width: 100%;
        padding: 0 var(--ur-space-md);
    }
}

/* --- Tablet: 768px–1024px ONLY ---
   Scoped with a min-width floor so these rules NEVER cascade onto mobile (<=767px).
   Previously this was `max-width: 1024px`, which also matched phones and — sitting
   after the 767px block — won the cascade, giving mobile the 2-column grid and
   desktop-ish hero padding ("tutto troppo boxato e troppo padding"). */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Archive grid: 2 columns on tablet */
    .archive .site-main .posts-container,
    .archive .site-main > .wp-block-query,
    .archive .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Hero padding: between desktop and mobile values */
    .home .wp-block-cover,
    .home .entry-content > .wp-block-cover {
        padding: var(--ur-space-xl) var(--ur-space-lg) var(--ur-space-xl);
    }
}

/* --- Desktop: min-width 1025px (Kadence default desktop breakpoint) --- */
@media (min-width: 1025px) {
    /* Enforce 3+ column archive grid on wider screens */
    .archive .site-main .posts-container,
    .archive .site-main > .wp-block-query,
    .archive .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}
