/* ================================
   Design System (BarndoorTN palette)
   ================================ */

/* Color Scheme Variables */
:root{
  --primary:#A56A3A;        /* Warm wood (links/buttons) */
  --secondary:#4F1A10;      /* Dark cocoa (header/footer/headings) */
  --accent:#F5C04A;         /* Sunny gold accent */
  --background:#FFF0DD;     /* Cream background (from logo field) */
  --surface:#FFF9F2;        /* Soft off-white cards/surfaces */
  --text-main:#3B2416;      /* Deep barn brown */
  --text-light:#6E4E3E;     /* Softer brown for body copy */
  --muted:#9C7E6F;          /* Muted meta text */
  --ring: rgba(245,192,74,.40);  /* focus ring (accent gold) */

  /* Sidebars */
  --sidebar-left-w: 160px;   /* LEFT max width */
  --sidebar-right-w: 300px;  /* RIGHT max width */
  --sidebar-gap: 16px;       /* gap from viewport edge */
}

/* Optional dark-mode tweaks (warm dark, not blue) */
@media (prefers-color-scheme: dark){
  :root{
    --background:#1B120D;
    --surface:#231711;
    --text-main:#EFE4D6;
    --text-light:#D2C3B5;
    --muted:#BFA590;
    --secondary:#2A140F;
    --primary:#C78953;
    --ring: rgba(245,192,74,.45);
  }
}

/* ================================
   Base / Typography
   ================================ */

*{margin:0;padding:0;box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  font-family:'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background:var(--background);
  color:var(--text-main);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%;display:block}
.container{width:92%;max-width:1100px;margin:2rem auto}

/* Headings rhythm */
h1{font-size:2rem;line-height:1.2;margin-bottom:.6rem}
h2{font-size:1.5rem;line-height:1.3;margin:1.2rem 0 .6rem}
h3{font-size:1.15rem;line-height:1.35;margin:.5rem 0}

/* Utilities */
.visually-hidden{position:absolute!important;clip:rect(1px,1px,1px,1px);clip-path:inset(50%);height:1px;width:1px;overflow:hidden;white-space:nowrap}

/* Focus ring */
:where(a,button,input,select,textarea)[tabindex], :where(a,button,input,select,textarea):focus-visible{
  outline:2px solid var(--ring);
  outline-offset:2px;
}

/* ================================
   Header / Nav
   ================================ */

header{
  background:var(--secondary);
  position:sticky; top:0; z-index:200; /* above sidebars */
  box-shadow:0 2px 12px rgba(0,0,0,.08);
}
nav, .nav-bar{display:flex;align-items:center;justify-content:space-between;gap:1rem}
.logo{height:175px;vertical-align:middle;border-radius:4px}
nav a{color:#fff;margin-left:1rem;font-weight:600}
nav a:hover{opacity:.9;text-decoration:none}

/* ================================
   Hero
   ================================ */

.hero{text-align:center;margin-bottom:2rem}
.caption{margin-top:.5rem;color:var(--muted);font-style:italic}
.video-container{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;border-radius:10px;background:#000;box-shadow:0 8px 24px rgba(0,0,0,.12)}
.video-container iframe{position:absolute;top:0;left:0;width:100%;height:100%;border:0}

/* ================================
   Cards / Grid
   ================================ */

.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1.5rem}
.card{
  background:var(--surface);
  padding:1rem;
  border-radius:12px;
  box-shadow:0 6px 18px rgba(0,0,0,.08);
  transition:transform .15s ease, box-shadow .15s ease;
}
.card:hover{transform:translateY(-2px); box-shadow:0 10px 26px rgba(0,0,0,.10)}
.card h3{color:var(--secondary);margin-bottom:.35rem}
.card p{color:var(--text-light)}

/* Uniform thumbnail frames */
.thumb-wrap{
  aspect-ratio:16/10;
  width:100%; overflow:hidden;
  border-radius:8px; background:#F2E3D3; /* light cream frame */
  margin-bottom:.7rem
}
.thumb-wrap img{width:100%;height:100%;object-fit:cover;display:block}

/* ================================
   Buttons / Badges / Meta
   ================================ */

.button{
  display:inline-block;
  padding:.6rem 1rem;
  background:var(--primary);
  color:#fff; border:none; border-radius:10px;
  font-weight:700; letter-spacing:.01em;
  cursor:pointer; transition:transform .05s ease, opacity .15s ease;
}
.button:hover{opacity:.92;text-decoration:none}
.button:active{transform:translateY(1px)}
.button.secondary{background:var(--secondary)} /* was hard-coded blue */

.badge{
  display:inline-block;
  background:#FBEFD6;             /* pale gold */
  color:#5A3A2A;
  padding:.25rem .55rem; border-radius:999px;
  font-size:.85rem; font-weight:600;
}
.recipe-meta{display:flex;flex-wrap:wrap;gap:.5rem 1rem;margin:.6rem 0 1rem;color:var(--muted)}

/* ================================
   Search
   ================================ */

.search-filter{text-align:center;margin:.75rem 0 1rem}
#searchInput,
form input[name="q"]{
  width:100%;max-width:520px;
  padding:.65rem .8rem;
  border:1px solid #d7bda8;border-radius:8px;
  background:#fff;color:var(--text-main);
  box-shadow:0 1px 1px rgba(0,0,0,.02) inset;
}
#searchInput:focus,
form input[name="q"]:focus{outline:2px solid var(--ring)}

/* ================================
   Recipe Detail
   ================================ */

.recipe-detail{
  background:var(--surface);
  padding:2rem;
  border-radius:12px;
  box-shadow:0 8px 24px rgba(0,0,0,.08);
}
.recipe-detail .detail-thumb{
  width:100%; max-height:420px; object-fit:cover;
  border-radius:10px; margin-bottom:1rem
}
.recipe-detail .date{color:var(--text-light);font-size:.95rem;margin-bottom:1rem}
.recipe-detail h2{margin-top:1.3rem;color:var(--secondary)}
.ingredients{list-style:disc;padding-left:1.2rem}
.ingredients li{margin:.25rem 0}
.recipe-detail ol{padding-left:1.2rem}
.recipe-detail ol li{margin:.35rem 0}
.affiliate a{font-weight:700}

/* Comments */
.comments{margin-top:2rem}
.comments h2,.comments h3{margin-bottom:.5rem;color:var(--secondary)}
.comments ul{list-style:none;padding:0;margin-bottom:1rem}
.comments li{
  background:var(--surface);padding:1rem;border-radius:8px;margin-bottom:.6rem;
  box-shadow:0 2px 6px rgba(0,0,0,.08)
}
.comments form{margin-top:1rem}
.comments form label{display:block;margin-bottom:.5rem}
.comments form input[type="text"],
.comments form textarea,
.comments form select{
  width:100%;max-width:420px;
  padding:.55rem .7rem;border:1px solid #d7bda8;border-radius:8px;margin-bottom:.7rem;background:#fff
}
.comments form button{background:var(--primary);color:#fff;border:none;padding:.6rem 1.2rem;border-radius:8px;cursor:pointer}
.comments form button:hover{opacity:.92}

/* ================================
   Footer
   ================================ */

footer{
  background:var(--secondary);
  color:#fff; text-align:center;
  padding:1.1rem 0; font-size:.95rem;
  margin-top:2.5rem;
  position:relative; z-index:250; /* above sidebars */
}

/* Footer 3 columns */
.footer-cols{display:grid;grid-template-columns:repeat(3,1fr);gap:1.25rem;align-items:flex-start;padding:1rem 0}
.footer-col h4{margin-bottom:.4rem}
footer .copyright{border-top:1px solid rgba(255,255,255,.15);margin-top:.75rem;padding-top:.75rem;font-size:.95rem}
footer{padding-top:1.5rem;padding-bottom:1rem}

/* ================================
   Admin
   ================================ */

.admin-container{
  background:var(--background);
  padding:2rem;border-radius:12px;
  box-shadow:0 2px 8px rgba(0,0,0,.1); margin-bottom:2rem
}
.admin-actions{display:flex;gap:1rem;margin-bottom:1.2rem;flex-wrap:wrap}
.admin-table{width:100%;border-collapse:collapse;margin-top:1rem}
.admin-table th,.admin-table td{padding:.75rem 1rem;text-align:left;border-bottom:1px solid #e3e8ee}
.admin-table img.thumb{width:60px;height:60px;object-fit:cover;border-radius:6px}
.admin-form{
  display:flex;flex-direction:column;gap:1rem;
  background:var(--surface);padding:1.5rem;border-radius:12px;
  box-shadow:0 2px 6px rgba(0,0,0,.08);margin-bottom:2rem
}
.admin-form label{display:flex;flex-direction:column;font-weight:600;color:var(--secondary)}
.admin-form input[type="text"],
.admin-form input[type="date"],
.admin-form input[type="file"],
.admin-form textarea,
.admin-form select{
  margin-top:.25rem;padding:.6rem .7rem;border:1px solid #d7bda8;border-radius:8px;font-size:1rem;background:#fff
}
.admin-form button{align-self:flex-start}

/* ================================
   Responsive
   ================================ */

@media (max-width:900px){
  h1{font-size:1.75rem}
  .container{width:94%}
}
@media (max-width:600px){
  nav, .nav-bar{flex-direction:column;gap:.5rem}
  .grid{grid-template-columns:1fr}
  .admin-actions{flex-direction:column}
  .admin-table th,.admin-table td{padding:.5rem}
  .video-container{border-radius:8px}
  #searchInput, form input[name="q"]{width:100%}
}

/* ================================
   Print
   ================================ */

@media print{
  header, footer, .actions, .search-filter, .recipe-meta .badge, .comments, .affiliate, .video-container{display:none!important}
  body{background:#fff}
  .recipe-detail{box-shadow:none;padding:0}
}

/* ================================
   Sidebars (fixed)
   ================================ */

.fixed-sidebars{position:relative}

/* Hide sidebars on smaller screens */
@media (max-width:1399px){
  .sidebar-fixed{display:none}
}

/* Sidebars appear below sticky header and under footer */
.sidebar-fixed{
  position:fixed;
  top:100px;            /* below header */
  z-index:180;          /* below header/footer (which are 200/250) */
  max-height:calc(100vh - 140px);
  overflow:auto; scrollbar-width:thin;
}
.sidebar-fixed.left{
  left:var(--sidebar-gap);
  width:var(--sidebar-left-w);
  max-width:var(--sidebar-left-w);
}
.sidebar-fixed.right{
  right:var(--sidebar-gap);
  width:var(--sidebar-right-w);
  max-width:var(--sidebar-right-w);
}
.sidebar-fixed .banner{display:block;margin-bottom:12px}
.sidebar-fixed .banner img{width:100%;height:auto;display:block;border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,.12)}

/* Create lanes ONLY around main content (header/footer keep original width).
   Main expands to use remaining width, with ~2px clearance to sidebars. */
@media (min-width:1400px){
  main.container{
    width:100%;
    max-width:none;
    padding-left: calc(var(--sidebar-left-w) + var(--sidebar-gap) + 2px);
    padding-right: calc(var(--sidebar-right-w) + var(--sidebar-gap) + 2px);
  }
}
