/*
Theme Name: Thriving with a Thorn
Description: A calm, readable theme for a support group for people who support a loved one with mental illness. Based on 2 Corinthians 12:7-9. Colors come from flowering cacti: sage and cactus green with raspberry, orange and yellow blooms.
Version: 1.3.1
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: thriving-with-a-thorn
*/

:root {
  --bg: #f2f6f1;
  --surface: #ffffff;
  --fg: #1c2a23;
  --muted: #4f6158;
  --line: #d3dfd6;
  --bloom: #b81c58;       /* raspberry flower: links, buttons, current page */
  --bloom-ink: #ffffff;
  --leaf: #2d6a4d;        /* cactus green: eyebrows, rules */
  --ember: #d9650f;       /* orange flower */
  --sun: #f2c22e;         /* yellow flower */
  --tint: #e2eee6;
  --sun-wash: rgba(242, 194, 46, 0.5);
  --font-display: "Gloock", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a14;
    --surface: #172420;
    --fg: #e8f1eb;
    --muted: #a2b6aa;
    --line: #2a3f34;
    --bloom: #ff7fb3;
    --bloom-ink: #3a0720;
    --leaf: #82c7a2;
    --ember: #ff9a4d;
    --sun: #f7d046;
    --tint: #1c2e25;
    --sun-wash: rgba(247, 208, 70, 0.32);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a14;
  --surface: #172420;
  --fg: #e8f1eb;
  --muted: #a2b6aa;
  --line: #2a3f34;
  --bloom: #ff7fb3;
  --bloom-ink: #3a0720;
  --leaf: #82c7a2;
  --ember: #ff9a4d;
  --sun: #f7d046;
  --tint: #1c2e25;
  --sun-wash: rgba(247, 208, 70, 0.32);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--bloom); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--bloom); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1060px; margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--bloom); color: var(--bloom-ink); padding: 8px 14px; border-radius: 6px; z-index: 20; }
.skip:focus { left: 8px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
}
.admin-bar .topbar { top: 32px; }
@media (max-width: 782px) { .admin-bar .topbar { top: 46px; } }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-family: var(--font-display); font-size: 1.35rem; }
.brand svg { width: 36px; height: 36px; flex: none; }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
nav a {
  display: block; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 0.98rem;
  padding: 8px 12px; border-radius: 6px; border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--fg); background: var(--tint); }
nav .current-menu-item > a,
nav .current_page_item > a,
nav .current_page_parent > a,
nav .current-menu-ancestor > a,
nav a[aria-current="page"] { color: var(--bloom); border-bottom-color: var(--bloom); border-radius: 6px 6px 0 0; }

/* Submenus (Appearance > Menus: drag an item slightly right under another) */
nav .menu li { position: relative; display: flex; flex-wrap: wrap; align-items: center; }
.submenu-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 32px; margin-left: -6px; padding: 0;
  background: none; border: 0; border-radius: 6px; color: var(--muted); cursor: pointer;
}
.submenu-toggle:hover { color: var(--fg); background: var(--tint); }
.submenu-toggle:focus-visible { outline: 3px solid var(--bloom); outline-offset: 1px; }
.submenu-toggle svg { width: 12px; height: 12px; transition: transform .15s; }
.menu-item-has-children.is-open > .submenu-toggle svg { transform: rotate(180deg); }
nav .sub-menu {
  display: none; flex-direction: column; gap: 2px; flex-basis: 100%;
  position: absolute; top: 100%; left: 0; z-index: 10; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}
nav .sub-menu .sub-menu { top: -7px; left: 100%; }
nav .sub-menu li { width: 100%; flex-wrap: nowrap; }
nav .sub-menu li > a { flex: 1; border-bottom-width: 0; border-radius: 6px; }
nav .sub-menu .current-menu-item > a,
nav .sub-menu .current_page_item > a,
nav .sub-menu a[aria-current="page"] { border-radius: 6px; background: var(--tint); }
nav .menu-item-has-children.is-open > .sub-menu { display: flex; }
@media (min-width: 821px) {
  nav .menu-item-has-children:hover > .sub-menu { display: flex; }
}
@media (max-width: 820px) {
  nav .menu { align-items: flex-start; }
  nav .menu > .menu-item-has-children.is-open { flex-basis: 100%; }
  nav .sub-menu {
    position: static; box-shadow: none; background: none; border: 0;
    border-left: 2px solid var(--line); border-radius: 0; margin: 2px 0 6px 12px; padding: 0 0 0 6px; min-width: 0;
  }
  nav .sub-menu .sub-menu { margin-left: 8px; }
}

main { padding-block: 40px 56px; }

/* Home: hero with the flowering-cactus photo fading in from the right */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 8px; align-items: center; padding-block: 8px 16px; }
.eyebrow { font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--leaf); margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.2rem); }
.hero h1 em {
  font-style: normal; color: var(--bloom); position: relative; white-space: nowrap;
  box-shadow: inset 0 -0.16em 0 var(--sun-wash);
}
.hero h1 em svg { position: absolute; right: -0.55em; top: -0.18em; width: 0.62em; height: 0.62em; }
.lead { font-size: 1.22rem; color: var(--muted); max-width: 34em; margin-top: 22px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 700; font-size: 1rem;
  padding: 12px 22px; border-radius: 8px; border: 2px solid var(--bloom);
}
.btn.primary { background: var(--bloom); color: var(--bloom-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { color: var(--bloom); background: transparent; }
.btn.ghost:hover { background: var(--tint); }

.hero-photo { margin: 0; }
.hero-photo img {
  display: block; width: 100%; aspect-ratio: 1150 / 660; object-fit: cover; border-radius: 18px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24%);
  mask-image: linear-gradient(to right, transparent 0, #000 24%);
}

/* Scripture band */
.scripture { margin-top: 48px; display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.scripture figure { margin: 0; min-height: 100%; }
.scripture figure img { display: block; width: 100%; height: 100%; object-fit: cover; }
.scripture .words { padding: 36px 36px 32px; display: flex; flex-direction: column; justify-content: center; }
.scripture .ref { font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 700; color: var(--bloom); }
.scripture blockquote { margin: 14px 0 0; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.3; }
.scripture .ver { margin-top: 16px; font-size: 0.95rem; color: var(--muted); }

.band { margin-top: 56px; }
.band > h2 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); margin-bottom: 22px; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.trio div { border-top: 4px solid var(--leaf); padding-top: 14px; }
.trio div:nth-child(2) { border-top-color: var(--bloom); }
.trio div:nth-child(3) { border-top-color: var(--ember); }
.trio h3 { font-size: 1.3rem; margin-bottom: 8px; }
.trio p { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px;
}
.card:hover { border-color: var(--bloom); }
.card { overflow: hidden; }
.card .card-img { display: block; width: calc(100% + 44px); max-width: none; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin: -22px -22px 6px; }
.postlist .card .card-img { width: calc(100% + 52px); margin: -24px -26px 6px; }
.post-feature { margin: 0 0 32px; max-width: 46rem; }
.post-feature figcaption { margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.post-feature img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; }
.card h3 { font-size: 1.3rem; }
.card p { color: var(--muted); font-size: 1rem; }
.card .meta { margin-top: auto; font-size: 0.88rem; font-weight: 600; color: var(--bloom); }

.help { margin-top: 56px; background: var(--tint); border-left: 6px solid var(--sun); border-radius: 14px; padding: 26px 28px; display: grid; gap: 8px; }
.help h2 { font-size: 1.5rem; }
.help p { color: var(--muted); max-width: 46em; }
.help ul { margin: 6px 0 0; padding-left: 1.2em; }
.help li { margin-block: 4px; }
.help strong { color: var(--fg); }

/* Reading pages */
.page-head { max-width: 46rem; margin-bottom: 32px; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.3rem); }
.page-head .lead { margin-top: 16px; }
.prose, .entry-content { max-width: 40rem; }
.prose h2, .entry-content h2 { font-size: 1.7rem; margin: 40px 0 12px; }
.prose h3, .entry-content h3 { font-size: 1.25rem; margin: 28px 0 8px; }
.prose p, .entry-content p { margin-top: 14px; }
.prose ul, .entry-content ul, .entry-content ol { padding-left: 1.2em; margin: 14px 0 0; }
.prose li, .entry-content li { margin-block: 6px; }
.entry-content li::marker { color: var(--leaf); }
.entry-content > :first-child { margin-top: 0; }
.entry-content .lead { font-size: 1.22rem; color: var(--muted); margin-top: 0; max-width: none; }
.entry-content blockquote, .entry-content .pull {
  margin: 28px 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--ember);
  font-family: var(--font-display); font-size: 1.35rem; line-height: 1.4;
}
.entry-content blockquote p { margin-top: 0; }
.entry-content .note { margin-top: 36px; padding: 16px 18px; background: var(--tint); border-left: 4px solid var(--sun); border-radius: 10px; font-size: 1rem; color: var(--muted); }

.postlist { display: grid; gap: 18px; max-width: 46rem; }
.postlist .card { padding: 24px 26px; }
.back { display: inline-block; margin-bottom: 24px; font-weight: 600; }
.postmeta { color: var(--muted); font-size: 0.95rem; margin-top: 10px; }
.pagination { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.pagination .current { background: var(--bloom); color: var(--bloom-ink); border-color: var(--bloom); }

footer.site-footer { border-top: 4px solid var(--leaf); padding-block: 28px 40px; color: var(--muted); font-size: 0.95rem; }
footer.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
footer.site-footer nav a { padding: 4px 8px; font-size: 0.95rem; }

@media (max-width: 820px) {
  body { font-size: 17px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .hero-photo img { -webkit-mask-image: none; mask-image: none; }
  .scripture { grid-template-columns: minmax(0, 1fr); }
  .scripture figure img { aspect-ratio: 783 / 420; height: auto; }
  .scripture .words { padding: 26px 22px; }
  .scripture blockquote { font-size: 1.45rem; }
  .trio, .cards { grid-template-columns: minmax(0, 1fr); }
  main { padding-block: 28px 40px; }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .btn, nav a { transition: border-color .15s, background-color .15s, filter .15s; }
}
