/* ==========================================================================
   Bryce Ezrre — The Journal
   Design system mirrors bryceezrre.com (slate / terracotta / sage / cream).
   ========================================================================== */

:root {
  --color-primary: #2F4F4F;
  --color-accent: #D97F5A;
  --color-accent-dark: #c96d48;
  --color-sage: #A5CBB7;
  --color-gold: #D4B04E;
  --color-cream: #F8F4F0;
  --color-text: #333333;
  --color-white: #ffffff;
  --color-muted: rgba(51, 51, 51, 0.72);
  --font-heading: "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --shadow-sm: 0 2px 8px rgba(47, 79, 79, 0.08);
  --shadow-md: 0 8px 24px rgba(47, 79, 79, 0.12);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.3s ease;
  --header-height: 72px;
  --wrap: 1120px;
  --wrap-narrow: 720px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-cream);
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

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

a { color: var(--color-primary); transition: color var(--transition); }
a:hover { color: var(--color-accent); }

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.35rem, 2.5vw, 1.75rem); }

p { margin: 0 0 1rem; }

.wrap {
  width: min(var(--wrap), calc(100% - 2rem));
  margin-inline: auto;
}

.wrap--narrow { width: min(var(--wrap-narrow), calc(100% - 2rem)); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 0.75rem 1rem;
  background: var(--color-primary);
  color: var(--color-white);
}
.skip-link:focus { left: 1rem; top: 1rem; }

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), color var(--transition), border-color var(--transition);
}
.btn--sm { padding: 0.5rem 1.1rem; font-size: 0.9rem; }
.btn--primary { background: var(--color-accent); color: var(--color-white); }
.btn--primary:hover { background: var(--color-accent-dark); color: var(--color-white); transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--ghost:hover { background: var(--color-primary); color: var(--color-white); transform: translateY(-2px); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 244, 240, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(47, 79, 79, 0.08);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  gap: 1rem;
}

.site-brand {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-primary);
}
.site-brand__logo { max-height: 40px; width: auto; align-self: center; }
.site-brand__name { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 600; }
.site-brand__kicker {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__item a { text-decoration: none; font-size: 0.95rem; font-weight: 500; }
.site-nav__item a.is-active { color: var(--color-accent); }
.site-nav__item--cta a { color: var(--color-white); }
.site-nav__item--cta a:hover { color: var(--color-white); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  transition: transform var(--transition), opacity var(--transition);
}

/* ---------- Journal hero (home) ---------- */
.journal-hero {
  position: relative;
  background: linear-gradient(135deg, var(--color-cream) 0%, rgba(165, 203, 183, 0.4) 100%);
  padding: clamp(3.5rem, 8vw, 6rem) 0 clamp(3rem, 6vw, 5rem);
  overflow: hidden;
}
.journal-hero__inner { max-width: 760px; }
.journal-hero__title { margin: 0 0 1rem; }
.journal-hero__lead {
  font-size: 1.15rem;
  max-width: 54ch;
  margin-bottom: 2rem;
  color: var(--color-text);
}
.journal-hero__actions { display: flex; flex-wrap: wrap; gap: 1rem; }

/* ---------- Sections ---------- */
.section { padding: 5rem 0; }
.section--posts { padding-top: 3.5rem; }

.page-head { max-width: 720px; margin-bottom: 2.5rem; }
.page-head__eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}
.page-head__title { margin-bottom: 0.5rem; }
.page-head__sub { font-size: 1.15rem; color: var(--color-muted); margin: 0; }
.page-head--author { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.page-head__avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-sm); }

/* ---------- Card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.75rem;
}

.card {
  background: var(--color-white);
  border-radius: var(--radius);
  border: 1px solid rgba(47, 79, 79, 0.08);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--color-sage); }
.card__link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.card__image { aspect-ratio: 3 / 2; overflow: hidden; background: var(--color-sage); }
.card__image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.card:hover .card__image img { transform: scale(1.04); }
.card__body { padding: 1.5rem 1.5rem 1.75rem; display: flex; flex-direction: column; flex: 1; }
.card__tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.6rem;
}
.card__title { font-size: 1.5rem; margin-bottom: 0.5rem; }
.card__excerpt { color: var(--color-muted); font-size: 0.98rem; margin-bottom: 1rem; }
.card__meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}
.card__dot { opacity: 0.6; }
.card--no-image .card__body { padding-top: 1.75rem; }

/* ---------- Empty states ---------- */
.empty { color: var(--color-muted); }
.posts-empty {
  text-align: center;
  max-width: 560px;
  margin: 2rem auto;
  padding: 3rem 2rem;
  background: var(--color-white);
  border: 1px solid rgba(47, 79, 79, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.posts-empty h3 { margin-bottom: 0.75rem; }
.posts-empty p { color: var(--color-muted); margin-bottom: 1.5rem; }

/* ---------- Post / Page ---------- */
.post { padding: 3.5rem 0 4rem; }
.post__header { text-align: center; max-width: 720px; margin: 0 auto 2rem; }
.post__tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  text-decoration: none;
  margin-bottom: 0.75rem;
}
.post__title { margin-bottom: 0.75rem; }
.post__excerpt { font-size: 1.2rem; color: var(--color-muted); margin-bottom: 1rem; }
.post__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-muted);
}
.post__author { font-weight: 600; color: var(--color-primary); }

.post__feature {
  margin: 0 0 2.5rem;
  width: min(1000px, calc(100% - 2rem));
  margin-inline: auto;
}
.post__feature img { width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.post__feature figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
}

.page__header { text-align: center; margin-bottom: 2rem; }

/* ---------- Reading content ---------- */
.gh-content {
  font-size: 1.15rem;
  line-height: 1.8;
}
.gh-content > * { margin: 0 0 1.5rem; }
.gh-content h2 { font-size: clamp(1.7rem, 3vw, 2.25rem); margin-top: 2.5rem; }
.gh-content h3 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); margin-top: 2rem; }
.gh-content a { color: var(--color-accent); text-underline-offset: 3px; }
.gh-content img,
.gh-content .kg-image { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.gh-content figure { margin: 2rem 0; }
.gh-content figcaption { text-align: center; font-size: 0.85rem; color: var(--color-muted); margin-top: 0.6rem; }
.gh-content blockquote {
  margin: 2rem 0;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-left: 4px solid var(--color-gold);
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-style: italic;
  color: var(--color-primary);
}
.gh-content ul, .gh-content ol { padding-left: 1.4rem; }
.gh-content li { margin-bottom: 0.5rem; }
.gh-content hr { border: none; border-top: 1px solid rgba(47, 79, 79, 0.15); margin: 3rem 0; }

/* Ghost gallery / wide cards */
.kg-width-wide { width: min(1000px, 92vw); margin-inline: auto; }
.kg-width-full { width: 100vw; margin-inline: calc(50% - 50vw); }
.kg-gallery-container { margin: 2rem 0; }

/* ---------- Author bio + post CTA ---------- */
.post__bio {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 3rem 0 0;
  padding: 1.5rem;
  background: var(--color-white);
  border: 1px solid rgba(47, 79, 79, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.post__bio-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.post__bio-name { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600; color: var(--color-primary); margin: 0 0 0.25rem; }
.post__bio-text { margin: 0; font-size: 0.95rem; color: var(--color-muted); }

.post__cta {
  margin-top: 3rem;
  padding: 2.5rem;
  text-align: center;
  background: linear-gradient(135deg, var(--color-cream) 0%, rgba(165, 203, 183, 0.35) 100%);
  border-radius: var(--radius-lg);
}
.post__cta h3 { margin-bottom: 0.5rem; }
.post__cta p { color: var(--color-muted); max-width: 46ch; margin: 0 auto 1.5rem; }

.post__comments { margin-top: 3rem; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 3rem;
  font-weight: 500;
}
.pagination a { text-decoration: none; }
.page-number { color: var(--color-muted); }

/* ---------- Error page ---------- */
.error-page { text-align: center; padding: 6rem 0; }
.error-page__code {
  font-family: var(--font-heading);
  font-size: 5rem;
  font-weight: 700;
  color: var(--color-gold);
  line-height: 1;
  margin: 0 0 0.5rem;
}
.error-page__title { margin-bottom: 0.5rem; }
.error-page__text { color: var(--color-muted); margin-bottom: 2rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary);
  color: rgba(248, 244, 240, 0.85);
  padding: 3rem 0 2.5rem;
  margin-top: 4rem;
}
.site-footer__inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2rem;
  align-items: start;
}
.site-footer__name { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 600; color: var(--color-cream); }
.site-footer__tagline { margin: 0.5rem 0 0; max-width: 40ch; opacity: 0.8; font-size: 0.95rem; }
.site-footer__nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.site-footer__nav a { color: rgba(248, 244, 240, 0.85); text-decoration: none; font-size: 0.95rem; }
.site-footer__nav a:hover { color: var(--color-white); }
.site-footer__meta { grid-column: 1 / -1; border-top: 1px solid rgba(248, 244, 240, 0.15); padding-top: 1.5rem; margin-top: 0.5rem; }
.site-footer__meta p { margin: 0.2rem 0; font-size: 0.85rem; }
.site-footer__note { opacity: 0.7; font-size: 0.8rem !important; }

/* ---------- Animations ---------- */
.animate-in {
  opacity: 0;
  transform: translateY(24px);
  animation: fadeUp 0.8s ease forwards;
  animation-delay: var(--delay, 0s);
}
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-in { opacity: 1; transform: translateY(0); }

@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .site-footer__inner { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-cream);
    box-shadow: var(--shadow-md);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition), opacity var(--transition);
  }
  .site-nav.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .site-nav__list { flex-direction: column; align-items: stretch; gap: 1rem; padding: 1.5rem; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .section { padding: 3.5rem 0; }
  .journal-hero__actions .btn,
  .posts-empty .btn { width: 100%; }
  .journal-hero__actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .animate-in, .reveal { opacity: 1; transform: none; animation: none; transition: none; }
  .card:hover, .btn:hover { transform: none; }
  .card:hover .card__image img { transform: none; }
}
