/*
Theme Name: Crispy Savors
Theme URI: https://example.com/
Author: ChatGPT
Description: Clean recipe blog theme with featured hero + grid homepage and sidebar cards.
Version: 1.0.0
License: GPLv2 or later
Text Domain: crispy-savors
Tags: blog, food-and-drink, two-columns, right-sidebar, custom-logo, custom-menu, featured-images
*/

/* ====== Color System (change anytime) ====== */
:root{
  --accent:#1F8A70;          /* teal */
  --accent-dark:#176B58;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --card:#ffffff;
  --bg:#ffffff;
}

*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
  line-height:1.6;
}
img{ max-width:100%; height:auto; }
a{ color:var(--text); text-decoration:none; }
a:hover{ color:var(--accent-dark); }

.container{
  width:min(1100px, calc(100% - 32px));
  margin-inline:auto;
}

/* ====== Header ====== */
.site-header{
  background:#fff;
  border-bottom:1px solid var(--border);
}
.site-header .top-accent{ height:6px; background:var(--accent); }
.header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 0;
}
.site-branding{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 180px;
}
.site-title{
  margin:0;
  font-size:22px;
  letter-spacing:.2px;
  font-weight:900;
}
.site-description{
  margin:0;
  color:var(--muted);
  font-size:13px;
}
.custom-logo{ height:44px; width:auto; }

.primary-nav{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.primary-nav a{
  display:inline-block;
  padding:10px 10px;
  font-weight:800;
  font-size:14px;
  border-radius:10px;
}
.primary-nav a:hover{
  background:rgba(31,138,112,.08);
}

.nav-toggle{
  display:none;
  border:1px solid var(--border);
  background:#fff;
  border-radius:10px;
  padding:10px 12px;
  font-weight:800;
}
@media (max-width: 900px){
  .nav-toggle{ display:inline-block; }
  .primary-nav{ display:none; width:100%; }
  .primary-nav.is-open{ display:flex; }
  .header-inner{ flex-wrap:wrap; }
}

/* ====== Layout ====== */
.site-main{
  padding:20px 0 36px;
}
.layout{
  display:block;
}
@media (min-width: 992px){
  .layout{
    display:grid;
    grid-template-columns: 1fr 320px;
    gap:28px;
    align-items:start;
  }
  .site-sidebar{ position:sticky; top:18px; align-self:start; }
}

/* ====== Buttons ====== */
.button, .read-more, .more-link, .wp-block-button__link{
  background:var(--accent);
  color:#fff !important;
  padding:10px 14px;
  border-radius:10px;
  font-weight:900;
  display:inline-block;
  border:1px solid rgba(0,0,0,.06);
  transition: transform .08s ease;
}
.button:hover, .read-more:hover, .more-link:hover, .wp-block-button__link:hover{
  background:var(--accent-dark);
}
.button:active, .read-more:active{ transform: translateY(1px); }

/* ====== Homepage Featured Hero ====== */
.featured-hero{
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  background:var(--card);
  box-shadow:0 12px 26px rgba(0,0,0,.06);
  margin:8px 0 26px;
}
.featured-hero .thumb img{ width:100%; display:block; }
.featured-hero .inner{ padding:18px 18px 16px; }
.featured-hero h2{
  margin:0 0 10px;
  font-size:28px;
  line-height:1.2;
}
.featured-hero p{ color:var(--muted); margin:0 0 12px; }

/* ====== Post Grid ====== */
.posts-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:26px;
}
@media (max-width: 767px){
  .posts-grid{ grid-template-columns:1fr; }
}
.post-card{
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  background:var(--card);
  box-shadow:0 10px 22px rgba(0,0,0,.05);
}
.post-card .thumb img{
  width:100%;
  aspect-ratio: 16/10;
  object-fit:cover;
  display:block;
}
.post-card .inner{ padding:14px 14px 16px; }
.post-card h3{
  margin:0 0 8px;
  font-size:18px;
  line-height:1.25;
}
.post-card .excerpt{ color:var(--muted); margin:0 0 12px; }

.meta{
  color:var(--muted);
  font-size:13px;
  margin:0 0 10px;
}

/* ====== Sidebar Cards ====== */
.sidebar-card, .widget{
  border:1px solid var(--border);
  border-radius:16px;
  background:#fff;
  padding:16px;
  margin:0 0 18px;
  box-shadow:0 10px 22px rgba(0,0,0,.05);
}
.widget-title{
  margin:0 0 10px;
  font-size:14px;
  letter-spacing:.3px;
  text-transform:uppercase;
  font-weight:900;
}
.sidebar-card .author-img{
  width:86px; height:86px; border-radius:999px;
  object-fit:cover; display:block; margin:0 auto 10px;
}
.sidebar-card h4{ margin:0 0 8px; text-align:center; }
.sidebar-card p{ color:var(--muted); font-size:14px; line-height:1.55; }

/* popular list (shortcode) */
.popular-list{ margin:0; padding:0; list-style:none; }
.popular-list li{ display:flex; gap:10px; padding:10px 0; border-top:1px solid var(--border); }
.popular-list li:first-child{ border-top:0; }
.popular-list img{ width:52px; height:52px; border-radius:12px; object-fit:cover; }
.popular-list a{ font-weight:900; font-size:14px; line-height:1.25; }

/* ====== Single / Page ====== */
.entry-header h1{
  margin:0 0 10px;
  font-size:32px;
  line-height:1.15;
}
.entry-content{
  font-size:16px;
}
.entry-content p{ margin:0 0 14px; }
.entry-content h2{ margin:26px 0 10px; font-size:22px; }
.entry-content h3{ margin:22px 0 8px; font-size:18px; }
.entry-content ul, .entry-content ol{ margin:0 0 14px 18px; }
.featured-image{
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  margin:14px 0 18px;
  box-shadow:0 10px 22px rgba(0,0,0,.05);
}

/* ====== Footer ====== */
.site-footer{
  border-top:1px solid var(--border);
  background:#fff;
  padding:18px 0;
}
.footer-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.footer-inner small{ color:var(--muted); }

/* ====== Pagination ====== */
.nav-links{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.page-numbers{
  border:1px solid var(--border);
  padding:8px 12px;
  border-radius:12px;
  font-weight:900;
}
.page-numbers.current{
  background:rgba(31,138,112,.10);
  border-color:rgba(31,138,112,.20);
}
/* =========================================================
   TABLET ONLY (768–1100px)
   Featured يبقى كيف ما هو، والgrid تحتو = 2 cards فالسطر
   ========================================================= */
@media (min-width: 768px) and (max-width: 1100px){

  .posts-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px; /* نتا بدّل القياس هنا */
  }

  /* باش الكارط يكونو منظمين ومتشابهين */
  .post-card{ 
    display:flex; 
    flex-direction:column; 
  }
  .post-card .inner{
    display:flex;
    flex-direction:column;
    height:100%;
  }
  .post-card .read-more{ 
    margin-top:auto; 
  }

  /* OPTIONAL: إلا بقى آخر كارط بوحدها، نخليها وسط/مزيانة (ماشي ضروري) */
  .posts-grid > .post-card:last-child:nth-child(odd){
    grid-column: 1 / -1;
    max-width: 560px;   /* بدّلها ولا حيّدها */
    justify-self: center;
  }

  /* OPTIONAL: تقدر تتحكم فقياس الصورة فالطابليط */
  .post-card .thumb img{
    aspect-ratio: 16/10; /* بدّلها كيف بغيتي */
    object-fit: cover;
  }
}
/* =========================
   PHONE: 1 card per row
   ========================= */
@media (max-width: 767px){
  .posts-grid{
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .post-card{
    width: 100% !important;
  }

  .post-card .thumb img{
    width: 100% !important;
    height: 220px !important;   /* نتا بدّل القياس اللي بغيتي */
    object-fit: cover !important;
    aspect-ratio: auto !important;
  }
}
/* PHONE: خلي كل post-card تشد السطر كامل (حتى إلا كانت grid فيها 2 أعمدة) */
@media (max-width: 767px){

  /* أهم سطر: كيجبر كل كارط تولي Full width داخل grid */
  .site-main .post-card{
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  /* إذا كان layout كيتستعمل flex بدل grid */
  .site-main .post-card{
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }

  /* اختياري: خليه زوين فالتلفون */
  .site-main .post-card .thumb img{
    height: 220px !important;   /* بدّل القياس اللي بغيتي */
    object-fit: cover !important;
    aspect-ratio: auto !important;
  }
}
/* PHONE ONLY: 1 card per row (full width) */
@media (max-width: 767px){
  .posts-grid{
    grid-template-columns: 1fr !important;
  }

  .post-card{
    width:100% !important;
  }
}
/* MOBILE ONLY: each card full width */
@media (max-width: 767px){

  /* force any grid to behave as 1 column */
  .posts-grid,
  .cs-tablet-grid,
  .recipes-grid,
  .archive .posts-grid{
    grid-template-columns: 1fr !important;
  }

  /* strongest fix: make every card span full row */
  .post-card{
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    grid-column: 1 / -1 !important;
  }
}
