/*
Theme Name: Daily Espresso
Theme URI: https://dailyespressocoffee.local
Author: Daily Espresso
Description: Clean coffee magazine theme for dailyespresso.coffee.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 8.0
License: GNU General Public License v2 or later
Text Domain: brewed-daily
*/

/* ---------------------------------- Tokens ---------------------------------- */
:root {
  --bg: #FAF8F3;
  --bg-alt: #F3EFE6;
  --surface: #FFFFFF;
  --dark: #1D1D1D;
  --text: #2A2620;
  --muted: #6B6257;
  --primary: #6F4E37;
  --primary-dark: #5A3E2B;
  --accent: #B7864A;
  --secondary: #D8C3A5;
  --border: #E8E1D4;
  --shadow: none;
  --shadow-lg: 0 4px 16px rgba(29, 29, 29, .08);
  --radius: 8px;
  --radius-sm: 6px;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --maxw: 1180px;
}
[data-theme="dark"] {
  --bg: #171512;
  --bg-alt: #1F1C18;
  --surface: #24211C;
  --dark: #FAF8F3;
  --text: #EDE7DC;
  --muted: #A79B8B;
  --primary: #C89A73;
  --primary-dark: #B7864A;
  --accent: #B7864A;
  --secondary: #4A4034;
  --border: #362F27;
  --shadow: none;
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, .4);
}

/* ---------------------------------- Base ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent); }
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--dark);
  line-height: 1.25;
  margin: 0 0 .5em;
  font-weight: 700;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2.8vw, 1.75rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 1.2em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.screen-reader-text {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px; height: 1px; overflow: hidden;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--primary); color: #fff; padding: .7rem 1.2rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; color: #fff; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 640px; margin-bottom: 28px; }
.section-head .kicker { display: none; }
.section-head p { color: var(--muted); }
.section-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; max-width: none; flex-wrap: wrap; }

/* ---------------------------------- Buttons ---------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--primary); color: #fff !important;
  padding: .7rem 1.4rem; border-radius: var(--radius-sm); border: 0;
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn:hover { background: var(--primary-dark); }
[data-theme="dark"] .btn { color: #171512 !important; }
.btn-outline {
  background: transparent; color: var(--primary) !important;
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff !important; }
[data-theme="dark"] .btn-outline { color: var(--primary) !important; }
[data-theme="dark"] .btn-outline:hover { color: #171512 !important; }
.link-more { font-weight: 600; white-space: nowrap; }

/* ---------------------------------- Header ---------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 28px; min-height: 74px; }
.site-brand { display: flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; color: var(--dark); letter-spacing: -.02em; }
.site-brand em { font-style: normal; color: var(--primary); }
.main-nav { margin-left: auto; }
.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.main-nav a {
  display: block; padding: .5rem .8rem; border-radius: 8px;
  color: var(--text); font-weight: 500; font-size: .95rem;
}
.main-nav a:hover, .main-nav .current-menu-item > a { background: var(--bg-alt); color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  display: grid; place-items: center; transition: border-color .2s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--primary); }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
.nav-toggle { display: none; }

.header-search {
  display: none; border-top: 1px solid var(--border); padding: 14px 0; background: var(--bg);
}
.header-search.open { display: block; }
.search-form { display: flex; gap: 10px; max-width: 560px; }
.search-form input[type="search"] {
  flex: 1; padding: .65rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1rem;
}

/* ---------------------------------- Hero ---------------------------------- */
.hero { padding: 56px 0 64px; border-bottom: 1px solid var(--border); }
.hero-inner { max-width: 680px; }
.hero .eyebrow { display: none; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 2.9rem); letter-spacing: -.02em; }
.hero .sub { font-size: 1.1rem; color: var(--muted); max-width: 540px; margin-bottom: 1.6rem; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 36px; margin-top: 2.2rem; flex-wrap: wrap; }
.hero-stats strong { display: block; font-size: 1.35rem; color: var(--dark); }
.hero-stats span { color: var(--muted); font-size: .85rem; }

/* ---------------------------------- Cards & grids ---------------------------------- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s;
  display: flex; flex-direction: column;
}
.card:hover { border-color: var(--primary); }
.card-media { aspect-ratio: 16/9; background: var(--bg-alt); position: relative; display: block; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media .media-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.card-body { padding: 18px; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.card-cat { font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.card-title { font-size: 1.05rem; margin: 0; }
.card-title a { color: var(--dark); }
.card-title a:hover { color: var(--primary); }
.card-excerpt { color: var(--muted); font-size: .93rem; margin: 0; }
.card-meta { margin-top: auto; padding-top: .6rem; color: var(--muted); font-size: .82rem; display: flex; gap: 1rem; }

.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: border-color .2s;
  display: block; height: 100%;
}
.tile:hover { border-color: var(--primary); }
.tile h3 { font-size: 1rem; margin-bottom: .3rem; }
.tile p { color: var(--muted); font-size: .88rem; margin: 0; }

.pill-list { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.pill-list a {
  display: inline-block; background: var(--surface); border: 1px solid var(--border);
  padding: .45rem .9rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 500; color: var(--text);
  transition: border-color .2s;
}
.pill-list a:hover { border-color: var(--primary); color: var(--primary); }

/* Why trust us */
.trust-grid .tile { text-align: left; }

/* ---------------------------------- Newsletter ---------------------------------- */
.newsletter {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(28px, 5vw, 48px); text-align: center;
}
.newsletter h2 { color: var(--dark); }
.newsletter p { color: var(--muted); max-width: 480px; margin: 0 auto 1.4rem; }
.newsletter-form { display: flex; gap: 10px; max-width: 440px; margin: 0 auto; }
.newsletter-form input {
  flex: 1; padding: .7rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 1rem;
}
.newsletter-note { font-size: .8rem; color: var(--muted); margin-top: .9rem; }
.nl-hp { position: absolute !important; left: -9999px !important; }
.newsletter-msg { font-weight: 600; margin: 0 0 .5rem; }
.newsletter-msg--ok { color: #2e7d32; }
.newsletter-msg--err { color: #c62828; }
[data-theme="dark"] .newsletter-msg--ok { color: #81c784; }
[data-theme="dark"] .newsletter-msg--err { color: #e57373; }
.newsletter .newsletter-msg { margin-bottom: 0; }
.newsletter-form-stack input[type="email"] {
  width: 100%; padding: .6rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); margin-bottom: .7rem; font-size: .95rem;
}
.newsletter-form-stack .btn { width: 100%; justify-content: center; }
.newsletter-form--cta { max-width: 440px; margin: 0 auto; }

/* ---------------------------------- FAQ ---------------------------------- */
.faq-list { max-width: 780px; }
.faq-list details {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0; margin-bottom: 12px; overflow: hidden;
}
.faq-list summary {
  cursor: pointer; font-weight: 600; padding: 18px 22px; list-style: none;
  display: flex; justify-content: space-between; align-items: center; color: var(--dark);
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 1.4rem; color: var(--accent); transition: transform .2s; }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list .faq-a { padding: 0 22px 18px; color: var(--muted); }

/* ---------------------------------- Breadcrumbs ---------------------------------- */
.breadcrumbs { font-size: .85rem; color: var(--muted); padding: 18px 0 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "›"; margin-right: .35rem; color: var(--secondary); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--primary); }

/* ---------------------------------- Article / content ---------------------------------- */
.content-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; padding: 40px 0 80px; }
.page-plain .content-layout { grid-template-columns: minmax(0, 760px); justify-content: center; }
.entry-header { margin-bottom: 2rem; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 1.2rem; color: var(--muted); font-size: .88rem; margin-top: 1rem; align-items: center; }
.entry-meta .avatar { width: 34px; height: 34px; border-radius: 50%; }
.entry-thumb { border-radius: var(--radius); overflow: hidden; margin: 1.6rem 0; box-shadow: var(--shadow-lg); }

.entry-content { font-size: 1.05rem; }
.entry-content h2 { margin-top: 2.2em; }
.entry-content h3 { margin-top: 1.8em; }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content blockquote {
  border-left: 4px solid var(--accent); background: var(--bg-alt);
  margin: 1.5em 0; padding: 1em 1.4em; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .95rem; }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: .7em 1em; text-align: left; }
.entry-content th { background: var(--bg-alt); font-weight: 600; }
.entry-content code { background: var(--bg-alt); padding: .15em .45em; border-radius: 6px; font-size: .9em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }

.toc {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 20px 24px; margin: 1.8rem 0;
}
.toc strong { display: block; margin-bottom: .5rem; color: var(--dark); font-family: var(--font-display); }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc a { color: var(--text); }
.toc a:hover { color: var(--primary); }

/* ---------------------------------- Sidebar ---------------------------------- */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
.widget {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.widget h3 { font-size: 1rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border); margin-bottom: .8rem; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.widget li:last-child { border-bottom: 0; }
.widget a { color: var(--text); }
.widget a:hover { color: var(--primary); }
.widget-newsletter p { color: var(--muted); font-size: .9rem; }
.widget-newsletter input {
  width: 100%; padding: .6rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); color: var(--text); margin-bottom: .7rem; font-size: .95rem;
}
.widget-newsletter .btn { width: 100%; justify-content: center; }

/* ---------------------------------- Archive ---------------------------------- */
.archive-header { padding: 56px 0 8px; max-width: 760px; }
.archive-header .term-desc { color: var(--muted); font-size: 1.1rem; }
.subcat-strip { padding: 10px 0 26px; }
.posts-grid { padding: 24px 0 72px; }
.pagination { display: flex; gap: 8px; justify-content: center; padding: 8px 0 64px; flex-wrap: wrap; }
.pagination .page-numbers {
  display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 .8rem;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600;
}
.pagination .page-numbers.current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------------------------- Related / CTA ---------------------------------- */
.related-posts { margin-top: 3.5rem; }
.article-cta {
  margin-top: 3rem; background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; text-align: center;
}

/* ---------------------------------- Footer ---------------------------------- */
.site-footer { background: #1D1D1D; color: #C9C1B4; margin-top: 40px; }
[data-theme="dark"] .site-footer { background: #100E0B; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 48px; padding: 64px 0 40px; }
.site-footer h4 { color: #fff; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .55rem; font-size: .92rem; }
.site-footer a { color: #C9C1B4; }
.site-footer a:hover { color: var(--accent); }
.footer-brand .site-brand { color: #fff; margin-bottom: 1rem; }
.footer-brand p { font-size: .92rem; color: #9C9488; max-width: 300px; }
.footer-social { display: flex; gap: 16px; margin-top: 1.2rem; font-size: .9rem; }
.footer-social a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .1); padding: 22px 0;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: #8B8478;
}
.footer-bottom ul { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------------------------------- Responsive ---------------------------------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .content-layout { grid-template-columns: 1fr; }
  .main-nav a { font-size: .88rem; padding: .45rem .55rem; }
}
@media (max-width: 768px) {
  .nav-toggle { display: grid; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 12px 24px 20px;
    box-shadow: var(--shadow-lg);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a { padding: .8rem .6rem; font-size: 1rem; border-bottom: 1px solid var(--border); border-radius: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .section { padding: 52px 0; }
  .hero { padding: 70px 0 80px; }
  .newsletter-form { flex-direction: column; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
