/*
Theme Name: Thomas Teofil
Theme URI: https://thomasteofil.com
Author: Thomas Teofil
Description: Calm, readable theme for Thomas Teofil, author of Catholic prayer books. Built on the structure of the Arumi Nomad theme.
Version: 1.0.2
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: thomas-teofil
*/

/* Fonts load from fonts.bunny.net (functions.php): same fonts as Google Fonts, no visitor IP sent to Google. */

:root {
  --bg: #F7F2E8;
  --bg-2: #EDE5D6;
  --bg-white: #FFFDF8;
  --ink: #2A2420;
  --muted: #62584F;
  --blue: #2E4A6B;
  --blue-dark: #1F3550;
  --blue-pale: #E3E9F0;
  --gold: #A8864A;
  --border: #DDD2BF;
  --white: #FFFFFF;
  --font-head: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --radius: 4px;
  --shadow: 0 4px 22px rgba(42,36,32,0.08);
  --measure: 680px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 20px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-dark); }
p { margin-bottom: 1.1em; }
p:last-child { margin-bottom: 0; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 500; color: var(--ink); line-height: 1.2; }
h1 { font-size: 2.6rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.35rem; }
em { font-style: italic; }
h1 em, h2 em { color: var(--blue); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: calc(var(--measure) + 48px); }
.section { padding: 88px 0; }
.section--alt { background: var(--bg-2); }
.section--blue { background: var(--blue-dark); color: #F1EDE4; }
.section--blue h2, .section--blue h3 { color: var(--white); }
.section--blue h2 em { color: #D9C394; }
.text-center { text-align: center; }

.label {
  display: block; font-family: var(--font-body); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px;
}
.section--blue .label { color: #D9C394; }
.divider { width: 48px; height: 1px; background: var(--gold); margin: 22px 0; border: 0; }
.text-center .divider { margin-left: auto; margin-right: auto; }
.cross-mark { display: block; color: var(--gold); font-size: 1.1rem; line-height: 1; margin-bottom: 14px; }

/* Buttons: written as a.btn so theme link colors never win (Arumi gold-on-gold lesson) */
a.btn, button.btn {
  display: inline-block; font-family: var(--font-body); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.06em; text-decoration: none; padding: 15px 28px; min-height: 48px;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; transition: background .2s, color .2s;
}
a.btn--solid, button.btn--solid { background: var(--blue); color: var(--white); border-color: var(--blue); }
a.btn--solid:hover, button.btn--solid:hover { background: var(--blue-dark); color: var(--white); }
a.btn--outline { background: transparent; color: var(--blue); border-color: var(--blue); }
a.btn--outline:hover { background: var(--blue); color: var(--white); }
a.btn--light { background: var(--white); color: var(--blue-dark); }
a.btn--light:hover { background: #F1EDE4; color: var(--blue-dark); }
a.btn--ghost-light { background: transparent; color: var(--white); border-color: rgba(255,255,255,.6); }
a.btn--ghost-light:hover { background: rgba(255,255,255,.1); color: var(--white); }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }
.text-center .btn-row { justify-content: center; }

/* ---------- HEADER (no backdrop-filter: it traps the fixed mobile menu) ---------- */
#site-header { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--border); }
.admin-bar #site-header { top: 32px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 92px; gap: 24px; }
.site-title { font-family: var(--font-head); font-size: 1.45rem; letter-spacing: 0.04em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.site-title:hover { color: var(--blue); }
.brand { display: inline-flex; flex-direction: column; line-height: 1; padding-bottom: 4px; }
.brand-name { font-family: var(--font-head); font-size: 1.45rem; letter-spacing: 0.04em; color: var(--ink); }
.brand-sig { font-family: 'Mrs Saint Delafield', 'Brush Script MT', cursive; font-size: 1.7rem; color: var(--blue); margin-top: 8px; padding-left: 2.3em; transform: rotate(-2deg); transform-origin: left center; white-space: nowrap; }
.brand:hover .brand-name { color: var(--blue); }
#site-footer .brand-name { color: var(--white); }
#site-footer .brand-sig { color: #D9C394; }
.custom-logo { max-height: 56px; width: auto; }
.main-nav ul { list-style: none; display: flex; gap: 28px; }
.main-nav a { font-size: 0.8rem; letter-spacing: 0.04em; color: var(--ink); text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.main-nav a:hover, .main-nav .current-menu-item > a { color: var(--blue); border-bottom-color: var(--gold); }
.menu-toggle { display: none; background: none; border: 0; width: 48px; height: 48px; cursor: pointer; padding: 12px; }
.menu-toggle span { display: block; height: 2px; background: var(--ink); margin: 5px 0; }

@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .main-nav { display: none; position: fixed; top: 92px; left: 0; right: 0; height: calc(100dvh - 92px); overflow-y: auto; background: var(--bg); padding: 24px; }
  .admin-bar .main-nav { top: 138px; }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a { display: block; font-size: 1.05rem; padding: 16px 0; border-bottom: 1px solid var(--border); }
}

/* ---------- HERO ---------- */
.hero { padding: 110px 0 96px; background: var(--bg); }
.hero-inner { max-width: 760px; }
.hero h1 { font-size: 3.1rem; margin-bottom: 26px; }
.hero-sub { font-size: 1.1rem; color: var(--muted); max-width: 620px; }

.facts { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-white); }
.facts-inner { display: grid; grid-template-columns: repeat(3, 1fr); }
.fact { padding: 26px 20px; text-align: center; font-size: 0.85rem; color: var(--muted); }
.fact + .fact { border-left: 1px solid var(--border); }
.fact strong { display: block; font-family: var(--font-head); font-weight: 500; font-size: 1.15rem; color: var(--ink); }

/* ---------- TWO-COLUMN BLOCKS ---------- */
.split { display: grid; grid-template-columns: 1fr 1.2fr; gap: 64px; align-items: center; }
.split--book { grid-template-columns: 0.8fr 1.2fr; }
.book-cover { max-width: 340px; margin: 0 auto; box-shadow: 0 18px 50px rgba(0,0,0,.28); border-radius: 2px; }
.cover-placeholder {
  max-width: 340px; aspect-ratio: 2/3; margin: 0 auto; background: var(--blue); color: #F1EDE4;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  padding: 32px; font-family: var(--font-head); border: 1px solid rgba(255,255,255,.2);
}
.cover-placeholder .cp-title { font-size: 2rem; line-height: 1.1; margin: 18px 0 12px; }
.cover-placeholder .cp-author { font-size: 0.95rem; letter-spacing: .14em; text-transform: uppercase; }
.status-pill { display: inline-block; font-size: 0.7rem; letter-spacing: .12em; text-transform: uppercase; padding: 6px 12px; border: 1px solid currentColor; border-radius: 99px; margin-bottom: 18px; }
.author-photo { margin: 0; }
.author-photo img { width: 100%; aspect-ratio: 3/4; object-fit: cover; object-position: center top; border: 1px solid var(--border); box-shadow: var(--shadow); }
.quiet-portrait { aspect-ratio: 3/4; background: var(--bg-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.quiet-portrait .brand-sig { font-size: 2.6rem; padding-left: 0; margin: 0; }
.split--about { grid-template-columns: 1.3fr 0.7fr; }
.split--about .author-photo { max-width: 400px; justify-self: end; width: 100%; }

/* ---------- SCRIPTURE BAND ---------- */
.scripture { padding: 84px 0; background: var(--bg-2); text-align: center; }
.scripture blockquote { font-family: var(--font-head); font-size: 1.6rem; line-height: 1.45; font-style: italic; max-width: 820px; margin: 0 auto; }
.scripture cite { display: block; margin-top: 18px; font-style: normal; font-size: 0.8rem; letter-spacing: .1em; color: var(--muted); }

/* ---------- POSTS ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 48px; }
.post-card { background: var(--bg-white); border: 1px solid var(--border); display: flex; flex-direction: column; }
.post-card-image img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-card-body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.post-card-meta { font-size: 0.7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.post-card h3 { font-size: 1.3rem; margin-bottom: 12px; }
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h3 a:hover { color: var(--blue); }
.post-card p { font-size: 0.85rem; color: var(--muted); flex: 1; }
.read-more { font-size: 0.8rem; margin-top: 16px; }

/* ---------- PAGE / ARTICLE ---------- */
.page-header { padding: 80px 0 48px; border-bottom: 1px solid var(--border); }
.page-header h1 { max-width: 820px; }
.page-header .lead { font-size: 1.1rem; color: var(--muted); max-width: 680px; margin-top: 18px; }
.page-header--center { text-align: center; }
.page-header--center h1, .page-header--center .lead { margin-left: auto; margin-right: auto; }
.entry { max-width: var(--measure); margin: 0 auto; padding: 56px 0 80px; }
.entry h2 { font-size: 1.7rem; margin: 1.8em 0 .6em; }
.entry h3 { font-size: 1.3rem; margin: 1.5em 0 .5em; }
.entry ul, .entry ol { margin: 0 0 1.1em 1.3em; }
.entry li { margin-bottom: .4em; }
.entry blockquote, .entry .wp-block-quote {
  border-left: 2px solid var(--gold); padding: 6px 0 6px 24px; margin: 1.6em 0;
  font-family: var(--font-head); font-size: 1.2rem; font-style: italic; white-space: pre-line;
}
.entry img, .entry figure { margin: 2em 0; }
.entry figcaption, .wp-element-caption { font-size: 0.75rem; color: var(--muted); margin-top: 8px; text-align: center; }
.entry hr { border: 0; height: 1px; background: var(--border); margin: 2.4em 0; }
.post-hero-image { max-width: 1000px; margin: 0 auto; padding: 0 24px; }
.post-hero-image img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-meta { font-size: 0.75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 18px; }

.author-box, .cta-box {
  max-width: var(--measure); margin: 0 auto 56px; padding: 32px; background: var(--bg-white); border: 1px solid var(--border);
}
.cta-box { background: var(--blue-pale); border-color: #C9D4E0; }
.author-box h3, .cta-box h3 { font-size: 1.35rem; margin-bottom: 10px; }
.author-box p, .cta-box p { font-size: 0.9rem; }

.list-check { list-style: none; margin: 0 0 1.2em; }
.list-check li { padding-left: 28px; position: relative; margin-bottom: .6em; }
.list-check li::before { content: "✝"; position: absolute; left: 0; color: var(--gold); }

.three-parts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 40px; }
.part { background: var(--bg-white); border: 1px solid var(--border); padding: 28px; }
.part h3 { font-size: 1.3rem; margin-bottom: 10px; }
.part p { font-size: 0.85rem; color: var(--muted); }

/* ---------- FORMS ---------- */
.form-card { background: var(--bg-white); border: 1px solid var(--border); padding: 36px; }
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 0.75rem; font-weight: 600; letter-spacing: .06em; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 0.9rem; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); color: var(--ink);
}
.field textarea { min-height: 170px; resize: vertical; }
.field--hp { position: absolute; left: -9999px; }
.form-note { font-size: 0.75rem; color: var(--muted); margin-top: 14px; }
.notice { padding: 16px 20px; margin-bottom: 24px; border-left: 3px solid var(--blue); background: var(--blue-pale); font-size: 0.9rem; }
.notice--error { border-color: #9B2C2C; background: #F6E3E3; }

/* ---------- BLOG LIST / PAGINATION / SEARCH ---------- */
.pagination { margin-top: 48px; text-align: center; }
.pagination .page-numbers { display: inline-block; padding: 8px 14px; margin: 0 2px; border: 1px solid var(--border); text-decoration: none; }
.pagination .current { background: var(--blue); color: var(--white); border-color: var(--blue); }
.search-form { display: flex; gap: 8px; }
.search-form input[type=search] { flex: 1; font: inherit; font-size: .9rem; padding: 10px 12px; border: 1px solid var(--border); }

/* ---------- FOOTER ---------- */
#site-footer { background: var(--ink); color: #CFC6B8; padding: 64px 0 28px; font-size: 0.8rem; }
#site-footer a { color: #EDE5D6; text-decoration: none; }
#site-footer a:hover { color: var(--white); text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 48px; }
.footer-brand .site-title { color: var(--white); font-size: 1.4rem; }
.footer-brand p { margin-top: 14px; max-width: 360px; }
#site-footer h4 { font-family: var(--font-body); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: #D9C394; margin-bottom: 14px; font-weight: 600; }
#site-footer ul { list-style: none; }
#site-footer li { margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 48px; padding-top: 22px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .72rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  html { font-size: 19px; }
  .split, .split--book, .split--about { grid-template-columns: 1fr; gap: 40px; }
  .author-photo { max-width: 420px; }
  .split--about .author-photo { justify-self: start; }
  .post-grid, .three-parts { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding: 64px 0 56px; }
  .hero h1 { font-size: 2.3rem; }
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.6rem; }
  .section { padding: 64px 0; }
  .scripture blockquote { font-size: 1.3rem; }
}
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .facts-inner { grid-template-columns: 1fr; }
  .fact + .fact { border-left: 0; border-top: 1px solid var(--border); }
  .form-card, .author-box, .cta-box { padding: 24px; }
  a.btn { width: 100%; text-align: center; }
}
@media (max-width: 782px) { .admin-bar #site-header { top: 46px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
