/*
Theme Name: Batch From Scratch
Theme URI: https://batchfromscratch.me
Author: Matt Batchelor
Description: A photography-led theme for a recipe journal. Replaces Receptar. Classic
  templates rather than a block theme, because the archive of posts is written in the
  classic editor and full-site editing would fight it.
Version: 0.1.0
Requires at least: 6.4
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: batchfromscratch
Tags: blog, food, one-column, custom-menu, featured-images
*/

/* ---------------------------------------------------------------------------
   Tokens
   Warm neutrals so the food photography carries the colour — the images in this
   library are saturated and a coloured chrome competes with them.
   --------------------------------------------------------------------------- */
:root {
  --ink:        #221d18;
  --ink-soft:   #5c534a;
  --ink-faint:  #8b8078;
  --paper:      #fbf9f6;
  --paper-warm: #f3ede5;
  --rule:       #e4dbd0;
  --accent:     #b4491f;
  --accent-dark:#8c3616;

  --measure: 34rem;      /* comfortable reading width */
  --gap:     clamp(1rem, 4vw, 2.5rem);
  --radius:  4px;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #f0eae3;
    --ink-soft:   #bdb3a8;
    --ink-faint:  #8e837a;
    --paper:      #17140f;
    --paper-warm: #221d17;
    --rule:       #362f27;
    --accent:     #e8794c;
    --accent-dark:#f0a183;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-dark); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 .5em;
}

.skip-link {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper);
  padding: .75rem 1.25rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.wrap { width: min(72rem, 100% - var(--gap) * 2); margin-inline: auto; }
.wrap--narrow { width: min(var(--measure) + 8rem, 100% - var(--gap) * 2); }

/* ---------------------------------------------------------------------------
   Masthead
   --------------------------------------------------------------------------- */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(140%) blur(8px);
}
.masthead__inner {
  display: flex; align-items: baseline; gap: 1.5rem;
  padding-block: 1.1rem; flex-wrap: wrap;
}
.masthead__title {
  font-family: var(--font-display);
  font-size: 1.35rem; margin: 0; letter-spacing: -0.02em;
}
.masthead__title a { color: var(--ink); text-decoration: none; }
.masthead__tagline {
  color: var(--ink-faint); font-size: .85rem; margin: 0;
  flex: 1 1 auto;
}

.nav ul { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft); text-decoration: none;
  font-size: .9rem; padding-block: .25rem;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav .current-menu-item > a { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------------------
   Category rail
   --------------------------------------------------------------------------- */
.rail { border-bottom: 1px solid var(--rule); background: var(--paper-warm); }
.rail ul {
  display: flex; gap: .5rem; list-style: none; margin: 0; padding: .6rem 0;
  overflow-x: auto; scrollbar-width: none;
}
.rail ul::-webkit-scrollbar { display: none; }
.rail a {
  white-space: nowrap; font-size: .8rem; letter-spacing: .02em;
  text-decoration: none; color: var(--ink-soft);
  padding: .3rem .7rem; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--paper);
}
.rail a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------------------
   Post grid
   --------------------------------------------------------------------------- */
.grid {
  display: grid; gap: clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  padding-block: clamp(2rem, 5vw, 3.5rem);
  margin: 0; list-style: none;
}

.card { display: flex; flex-direction: column; }
.card__media {
  aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
  background: var(--paper-warm);
}
.card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2,.7,.3,1);
}
.card:hover .card__media img { transform: scale(1.04); }
.card__meta {
  font-size: .72rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint); margin: .9rem 0 .35rem;
}
.card__title { font-size: 1.2rem; margin: 0 0 .4rem; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--accent); }
.card__excerpt { color: var(--ink-soft); font-size: .93rem; margin: 0; }

/* ---------------------------------------------------------------------------
   Single post
   --------------------------------------------------------------------------- */
.hero { margin-block: clamp(1.5rem, 4vw, 3rem) 0; }
.hero img { width: 100%; max-height: 70vh; object-fit: cover; border-radius: var(--radius); }

.entry-header { padding-block: clamp(1.5rem, 4vw, 2.5rem) 1rem; text-align: center; }
.entry-header h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
.entry-meta {
  font-size: .75rem; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-faint);
}
.entry-meta a { color: inherit; }

.entry-content { max-width: var(--measure); margin-inline: auto; }
.entry-content > * { margin-block: 1.3em; }
.entry-content h2 { font-size: 1.6rem; margin-top: 2.2em; }
.entry-content h3 { font-size: 1.25rem; margin-top: 1.8em; }
.entry-content blockquote {
  margin-inline: 0; padding-left: 1.25rem;
  border-left: 3px solid var(--accent); color: var(--ink-soft); font-style: italic;
}
.entry-content ul, .entry-content ol { padding-left: 1.35rem; }
.entry-content li + li { margin-top: .4em; }
.entry-content code {
  background: var(--paper-warm); padding: .1em .35em; border-radius: 3px; font-size: .9em;
}

/* Images inside posts break the measure — the photography is the point. */
.entry-content .wp-caption,
.entry-content figure,
.entry-content .wp-block-image {
  max-width: min(56rem, 92vw);
  margin-inline: calc(50% - min(28rem, 46vw));
}
.entry-content figcaption, .entry-content .wp-caption-text {
  font-size: .8rem; color: var(--ink-faint); text-align: center; margin-top: .6rem;
}
.entry-content .alignleft  { float: left;  margin: .4em 1.5em 1em 0; }
.entry-content .alignright { float: right; margin: .4em 0 1em 1.5em; }
.entry-content .aligncenter { margin-inline: auto; }

.entry-footer {
  max-width: var(--measure); margin: 3rem auto 0;
  padding-top: 1.5rem; border-top: 1px solid var(--rule);
  font-size: .85rem; color: var(--ink-soft);
}
.tag-list a {
  display: inline-block; margin: .2rem .3rem .2rem 0;
  padding: .2rem .6rem; border: 1px solid var(--rule); border-radius: 999px;
  font-size: .78rem; text-decoration: none; color: var(--ink-soft);
}

/* ---------------------------------------------------------------------------
   Pagination, comments, footer
   --------------------------------------------------------------------------- */
.pagination { display: flex; gap: .5rem; justify-content: center; padding-block: 2rem 4rem; flex-wrap: wrap; }
.pagination .page-numbers {
  padding: .5rem .85rem; border: 1px solid var(--rule); border-radius: var(--radius);
  text-decoration: none; color: var(--ink-soft); font-size: .9rem;
}
.pagination .current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.comments { max-width: var(--measure); margin: 3.5rem auto 0; }
.comments ol { list-style: none; padding: 0; }
.comment-body { padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.comment-author img { border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: .5rem; }
.comment-form input[type="text"], .comment-form input[type="email"],
.comment-form input[type="url"], .comment-form textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--rule);
  border-radius: var(--radius); background: var(--paper); color: var(--ink);
  font: inherit; font-size: .95rem;
}
.comment-form .submit, .btn {
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: .65rem 1.4rem; border-radius: var(--radius); font: inherit; font-size: .95rem;
}
.comment-form .submit:hover, .btn:hover { background: var(--accent-dark); }

.site-footer {
  margin-top: clamp(3rem, 8vw, 6rem);
  border-top: 1px solid var(--rule); background: var(--paper-warm);
  padding-block: 2.5rem; color: var(--ink-soft); font-size: .87rem;
}
.site-footer__inner { display: flex; gap: 1.5rem; justify-content: space-between; flex-wrap: wrap; }

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
