/*
Theme Name: Our Family Table
Theme URI: https://ourfamilytable.us
Author: Mike Justice
Description: A recipe-box theme for the Justice, Cox, and Chaney family recipe collection. Pairs with the Our Family Table Recipes plugin.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: oft
*/

:root {
  --walnut: #3f2a1d;
  --walnut-2: #5a3f2c;
  --ink: #2e2118;
  --muted: #6e5a48;
  --olive: #56662a;
  --olive-dk: #3f4c1c;
  --olive-lt: #e3e6cf;
  --kraft: #e8dbc1;
  --kraft-2: #dccba9;
  --card: #fffdf6;
  --rule-red: #c0503a;
  --rule-blue: #b5cbdb;
  --tan: #c9a77a;
  --serif: "Alegreya", Georgia, serif;
  --sans: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;
  --wrap: 1180px;
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--kraft);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.55;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--olive-dk); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--walnut); }
:focus-visible { outline: 3px solid var(--olive); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.15; color: var(--walnut); margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--card); padding: 8px 14px; width: auto; height: auto; clip: auto; }

/* ---------- Header ---------- */
.site-header { background: var(--walnut); color: #f3e8d2; }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 76px; flex-wrap: wrap; }
.brand { color: #f8eedb; text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand:hover { color: #fff; }
.brand img { max-height: 52px; width: auto; }
.brand-name { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1.75rem; letter-spacing: .01em; }
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
.main-nav a { display: block; color: #f3e8d2; text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-weight: 500; }
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav .current_page_item > a, .main-nav a[aria-current] { background: rgba(255,255,255,.1); color: #fff; }
.header-search { display: flex; }
.header-search input { width: 180px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; border-radius: var(--radius); padding: 7px 10px; font: inherit; font-size: 1rem; }
.header-search input::placeholder { color: #cdbda3; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: var(--radius); padding: 6px 12px; font: inherit; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .main-nav, .header-search { display: none; width: 100%; margin: 0; }
  .site-header.open .main-nav, .site-header.open .header-search { display: block; }
  .main-nav ul { flex-direction: column; padding-bottom: 8px; }
  .header-search { padding-bottom: 16px; }
  .header-search input { width: 100%; }
}

/* ---------- Hero ---------- */
.hero { background: var(--walnut); color: #f3e8d2; padding: 40px 0 96px; position: relative; }
.hero::after { /* table edge */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14px;
  background: repeating-linear-gradient(90deg, #4a3223 0 120px, #533a29 120px 260px, #45301f 260px 400px);
}
.hero h1 { color: #fbf1dc; font-style: italic; font-weight: 500; font-size: clamp(2.6rem, 7vw, 5rem); margin-bottom: .1em; }
.hero .lede { font-family: var(--serif); font-size: clamp(1.15rem, 2.2vw, 1.45rem); color: #e6d4b4; max-width: 34ch; }
.big-search { margin-top: 28px; display: flex; max-width: 640px; background: var(--card); border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.big-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 18px 20px; font: inherit; font-size: 1.2rem; color: var(--ink); border-radius: 6px 0 0 6px; }
.big-search input:focus { outline: none; }
.big-search:focus-within { outline: 3px solid #b7c27f; outline-offset: 2px; }
.big-search button { border: 0; background: var(--olive); color: #fff; font: inherit; font-weight: 700; padding: 0 26px; border-radius: 0 6px 6px 0; cursor: pointer; }
.big-search button:hover { background: var(--olive-dk); }
.hero .count { margin-top: 14px; color: #cdb995; font-size: 1rem; }

/* ---------- Divider tabs (the recipe box) ---------- */
.box-section { padding: 0 0 56px; }
.dividers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 34px 18px; margin-top: -58px; position: relative; z-index: 2; }
.divider {
  --tab-x: 0%;
  position: relative; display: block; text-decoration: none; color: var(--walnut);
  background: #f0e2c2; border: 1px solid #cdb68a; border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 22px 18px 18px; min-height: 120px; box-shadow: 0 2px 0 #cdb68a;
}
.divider::before { /* the tab */
  content: attr(data-tab); position: absolute; top: -26px; left: var(--tab-x);
  height: 26px; padding: 3px 14px 0; max-width: 70%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: #f0e2c2; border: 1px solid #cdb68a; border-bottom: 0; border-radius: 6px 6px 0 0;
  font-family: var(--hand); font-size: 1.1rem; line-height: 1.2; color: var(--muted);
}
.divider:nth-child(3n+2) { --tab-x: 30%; }
.divider:nth-child(3n+3) { --tab-x: 58%; }
.divider:hover { background: #f6ead0; color: var(--walnut); }
.divider:hover::before { background: #f6ead0; }
.divider strong { font-family: var(--serif); font-size: 1.4rem; display: block; line-height: 1.15; }
.divider span { color: var(--muted); }

/* ---------- Sections on home ---------- */
.band { padding: 56px 0; }
.band + .band { padding-top: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head h2 { margin: 0; }
.kitchens { display: flex; flex-wrap: wrap; gap: 10px 12px; list-style: none; padding: 0; margin: 0; }
.kitchens a { display: inline-flex; align-items: baseline; gap: 8px; text-decoration: none; background: var(--card); border: 1px solid var(--kraft-2); padding: 6px 14px 8px; border-radius: 999px; color: var(--ink); }
.kitchens a:hover { border-color: var(--olive); }
.kitchens .who { font-family: var(--hand); font-size: 1.45rem; line-height: 1; color: var(--walnut); }
.kitchens .n { font-size: .9rem; color: var(--muted); }
.notes-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.notes-links a { display: block; background: var(--card); padding: 22px; text-decoration: none; color: var(--ink); border-left: 4px solid var(--olive); }
.notes-links a:hover { border-left-color: var(--walnut); }
.notes-links strong { display: block; font-family: var(--serif); font-size: 1.35rem; color: var(--walnut); margin-bottom: 4px; }

/* ---------- Recipe card grid ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; list-style: none; margin: 0; padding: 0; }
.rcard { background: var(--card); position: relative; display: flex; flex-direction: column; box-shadow: 0 1px 2px rgba(63,42,29,.18); }
.rcard[hidden] { display: none; }
.rcard a.cover { position: absolute; inset: 0; z-index: 1; }
.rcard a.cover:focus-visible { outline-offset: -3px; }
.rcard .ph { aspect-ratio: 4 / 3; background: var(--kraft-2); overflow: hidden; }
.rcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.rcard .body { padding: 14px 16px 16px; border-top: 2px solid var(--rule-red); flex: 1; display: flex; flex-direction: column; }
.rcard h3 { font-size: 1.22rem; margin: 0 0 6px; }
.rcard .from { font-family: var(--hand); font-size: 1.3rem; color: var(--muted); line-height: 1.1; margin: 0; }
.rcard .cat { margin-top: auto; padding-top: 10px; font-size: .92rem; color: var(--olive-dk); }
.rcard:hover h3 { color: var(--olive-dk); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.rcard:not(.has-ph) .body { background-image: repeating-linear-gradient(transparent 0 27px, var(--rule-blue) 27px 28px); background-position: 0 6px; padding-top: 16px; min-height: 150px; }

/* ---------- Recipe box page ---------- */
.page-head { padding: 40px 0 20px; }
.page-head p { color: var(--muted); max-width: 60ch; }
.boxbar { background: var(--card); padding: 18px; margin-bottom: 18px; display: grid; gap: 14px; box-shadow: 0 1px 2px rgba(63,42,29,.15); }
.boxbar .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.boxbar input[type=search] { flex: 1 1 280px; font: inherit; padding: 12px 14px; border: 1px solid var(--tan); border-radius: var(--radius); background: #fff; }
.boxbar select { font: inherit; padding: 11px 12px; border: 1px solid var(--tan); border-radius: var(--radius); background: #fff; color: var(--ink); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button, .tabs a { font: inherit; font-size: 1rem; cursor: pointer; border: 1px solid var(--kraft-2); background: #f4ead6; color: var(--walnut); padding: 7px 14px; border-radius: 8px 8px 0 0; border-bottom-color: var(--tan); text-decoration: none; }
.tabs button[aria-pressed=true], .tabs a[aria-current] { background: var(--olive); border-color: var(--olive); color: #fff; }
.tabs .n { opacity: .75; font-size: .9em; margin-left: 4px; }
.status { color: var(--muted); margin: 0 0 14px; min-height: 1.5em; }
.empty { background: var(--card); padding: 28px; text-align: center; }
.empty button { font: inherit; background: var(--olive); color: #fff; border: 0; padding: 10px 18px; border-radius: var(--radius); cursor: pointer; }

/* ---------- Single recipe: the index card ---------- */
.crumbs { padding: 26px 0 10px; font-size: 1rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.index-card { background: var(--card); box-shadow: 0 2px 4px rgba(63,42,29,.18), 0 18px 40px -24px rgba(63,42,29,.5); margin-bottom: 40px; }
.card-top {
  position: relative; padding: 34px clamp(20px, 5vw, 56px) 22px;
  background:
    linear-gradient(var(--rule-red), var(--rule-red)) 0 100% / 100% 2px no-repeat,
    repeating-linear-gradient(transparent 0 35px, var(--rule-blue) 35px 36px);
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: start;
}
.card-top h1 { font-size: clamp(2rem, 4.6vw, 3rem); margin: 0 0 10px; }
.kitchen-line { font-size: 1.05rem; color: var(--muted); margin: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kitchen-line .hand { font-family: var(--hand); font-size: 2rem; color: var(--walnut); line-height: 1; }
.kitchen-line .hand a { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--tan); }
.kitchen-line .hand a:hover { color: var(--olive-dk); }
.snapshot { width: 230px; background: #fff; padding: 8px 8px 26px; transform: rotate(2.2deg); box-shadow: 0 6px 14px rgba(0,0,0,.18); position: relative; margin-top: -6px; }
.snapshot::before { content: ""; position: absolute; top: -12px; left: 50%; width: 86px; height: 24px; transform: translateX(-50%) rotate(-4deg); background: rgba(232,219,193,.85); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.snapshot img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.facts { display: flex; flex-wrap: wrap; gap: 0; margin: 0; padding: 0 clamp(20px, 5vw, 56px); border-bottom: 1px solid var(--kraft-2); }
.facts div { padding: 14px 26px 14px 0; margin-right: 26px; border-right: 1px solid var(--kraft-2); }
.facts div:last-child { border-right: 0; }
.facts dt { font-size: .85rem; color: var(--muted); }
.facts dd { margin: 0; font-family: var(--serif); font-size: 1.15rem; color: var(--walnut); }
.facts a { color: inherit; }
.card-body { display: grid; grid-template-columns: minmax(240px, 1fr) 1.6fr; gap: 0; }
.card-body > section { padding: 28px clamp(20px, 5vw, 56px) 34px; }
.card-body h2 { font-size: 1.5rem; margin-bottom: 14px; }
.card-body h3 { font-family: var(--sans); font-size: 1rem; font-weight: 700; color: var(--olive-dk); margin: 18px 0 8px; }
.ingredients { border-right: 1px solid var(--kraft-2); background: #fbf6ea; }
.ingredients ul { list-style: none; margin: 0; padding: 0; }
.ingredients li { border-bottom: 1px dotted var(--kraft-2); }
.ingredients label { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; cursor: pointer; }
.ingredients input { accent-color: var(--olive); width: 17px; height: 17px; flex: none; transform: translateY(2px); }
.ingredients input:checked + span { text-decoration: line-through; color: #9a8a78; }
.hint { font-size: .92rem; color: var(--muted); margin: -6px 0 12px; }
.directions ol { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.directions li { counter-increment: step; position: relative; padding: 4px 0 14px 46px; cursor: pointer; max-width: 68ch; }
.directions li::before { content: counter(step); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--olive); color: var(--olive-dk); font-family: var(--serif); font-weight: 700; display: grid; place-items: center; font-size: 1rem; }
.directions li.done { color: #9a8a78; }
.directions li.done::before { background: var(--olive); color: #fff; content: "✓"; }
.recipe-notes { grid-column: 1 / -1; border-top: 1px solid var(--kraft-2); }
.recipe-notes p { font-family: var(--serif); font-style: italic; font-size: 1.15rem; max-width: 70ch; line-height: 1.6; }
.recipe-notes h2 { font-family: var(--hand); font-weight: 600; font-size: 2.1rem; color: var(--rule-red); margin-bottom: 4px; }
.card-actions { display: flex; gap: 12px; flex-wrap: wrap; padding: 0 clamp(20px, 5vw, 56px) 28px; }
.btn { display: inline-block; font: inherit; font-weight: 700; padding: 10px 18px; border-radius: var(--radius); border: 1.5px solid var(--olive); background: var(--olive); color: #fff; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--olive-dk); color: #fff; }
.btn.ghost { background: transparent; color: var(--olive-dk); }
.btn.ghost:hover { background: var(--olive-lt); color: var(--olive-dk); }
.more { padding-bottom: 56px; }

@media (max-width: 760px) {
  .card-top { grid-template-columns: 1fr; }
  .snapshot { width: 70%; max-width: 260px; margin: 6px auto 0; }
  .card-body { grid-template-columns: 1fr; }
  .ingredients { border-right: 0; border-bottom: 1px solid var(--kraft-2); }
  .facts div { padding-right: 16px; margin-right: 16px; }
}

/* ---------- Pages (tips, canning, family) ---------- */
.page-article { background: var(--card); padding: clamp(24px, 5vw, 56px); margin-bottom: 56px; box-shadow: 0 1px 2px rgba(63,42,29,.15); }
.page-article .content { max-width: 74ch; font-size: 1.15rem; }
.page-article .content > section { margin-bottom: 44px; scroll-margin-top: 20px; }
.page-article h2 { padding-bottom: 8px; border-bottom: 2px solid var(--rule-red); margin-top: 0; }
.oft-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 36px; }
.oft-toc a { background: #f4ead6; border: 1px solid var(--kraft-2); padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--walnut); font-size: 1rem; }
.oft-toc a:hover { border-color: var(--olive); }
.oft-tips { padding-left: 1.2em; }
.oft-tips li { margin-bottom: .6em; padding-left: .2em; }
.oft-tips li::marker { color: var(--olive); }
.oft-check { list-style: none; padding: 0; }
.oft-check li { padding: 10px 0 10px 34px; border-bottom: 1px dotted var(--kraft-2); position: relative; }
.oft-check li::before { content: ""; position: absolute; left: 4px; top: 15px; width: 16px; height: 16px; border: 1.5px solid var(--olive); border-radius: 3px; }
.oft-steps { padding-left: 1.4em; }
.oft-steps li { margin-bottom: .7em; padding-left: .3em; }
.oft-steps li::marker { color: var(--olive-dk); font-weight: 700; font-family: var(--serif); }
.oft-table-wrap, .oft-table { width: 100%; }
.oft-table { border-collapse: collapse; margin: 18px 0 26px; font-size: 1rem; display: block; overflow-x: auto; }
.oft-table caption { text-align: left; font-family: var(--serif); font-weight: 700; color: var(--walnut); font-size: 1.1rem; padding-bottom: 8px; }
.oft-table th, .oft-table td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--kraft-2); vertical-align: top; }
.oft-table th { font-weight: 700; color: var(--olive-dk); white-space: nowrap; }
.oft-subs td:first-child { font-weight: 700; color: var(--walnut); white-space: nowrap; padding-right: 22px; }
.oft-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 36px; }
.oft-callout { background: var(--olive-lt); border-left: 4px solid var(--olive); padding: 14px 18px; font-size: 1.05rem; }
.oft-letter { font-family: var(--serif); font-size: 1.22rem; line-height: 1.65; }
.oft-signature { font-family: var(--hand); font-size: 2rem; color: var(--walnut); margin: .2em 0 0; line-height: 1.1; }
.oft-dateline { color: var(--muted); font-family: var(--sans); font-size: 1rem; }
.oft-generations { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 24px; margin-top: 20px; }
.oft-gen h3 { font-family: var(--sans); font-size: 1rem; color: var(--olive-dk); margin-bottom: 8px; }
.oft-gen ul { list-style: none; padding: 0; margin: 0; }
.oft-gen li { font-family: var(--hand); font-size: 1.55rem; line-height: 1.35; color: var(--walnut); }
.oft-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; align-items: start; margin-top: 24px; }
.oft-gallery figure { margin: 0; background: #fff; padding: 10px 10px 14px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.oft-gallery figure:nth-child(odd) { transform: rotate(-1.2deg); }
.oft-gallery figure:nth-child(even) { transform: rotate(1deg); }
.oft-gallery figcaption { font-family: var(--hand); font-size: 1.4rem; color: var(--walnut); padding-top: 8px; text-align: center; }

/* ---------- Footer ---------- */
.site-footer { background: var(--walnut); color: #d9c7a6; padding: 34px 0; font-size: 1rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: #f3e8d2; }
.site-footer .hand { font-family: var(--hand); font-size: 1.5rem; color: #f3e8d2; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Print: just the card ---------- */
@media print {
  body { background: #fff; font-size: 12pt; }
  .site-header, .site-footer, .crumbs, .card-actions, .more, .hint, .snapshot { display: none !important; }
  .index-card { box-shadow: none; }
  .card-top { background: none; border-bottom: 2px solid #000; padding: 0 0 10px; }
  .card-body { grid-template-columns: 1fr 1.6fr; }
  .card-body > section, .facts { padding-left: 0; padding-right: 16px; }
  .ingredients { background: none; }
  .ingredients input { display: none; }
  .directions li { padding-left: 30px; }
  .directions li::before { width: 22px; height: 22px; font-size: 10pt; }
  a { color: inherit; text-decoration: none; }
}
