/* ===== CSS Variables ===== */
:root {
  /* Layout */
  --header-h: 72px;
  --maxw: 1500px;
  --radius: 16px;
  
  /* Light mode colors */
  --pine: #3E5F44;   
  --fern: #5E936C;   
  --mint: #93DA97;   
  --cream: #E8FFD7;  
  --ink: #1d2a1d;   
  --sky: #0b1020;   
  --white: #ffffff;
  
  /* Semantic color mapping */
  --color-bg-primary: #E8FFD7;
  --color-bg-secondary: #ffffff;
  --color-bg-tertiary: rgba(255,255,255,0.95);
  
  --color-text-primary: #1d2a1d;
  --color-text-secondary: #3E5F44;
  --color-text-muted: rgba(62, 95, 68, 0.85);
  --color-text-inverse: #ffffff;
  
  --color-accent-primary: #5E936C;
  --color-accent-secondary: #6f9e70;
  --color-accent-hover: #4a7558;
  
  --color-border: rgba(62, 95, 68, 0.12);
  --color-border-strong: rgba(62, 95, 68, 0.25);
  
  --color-hero-bg: radial-gradient(1200px 600px at 70% -10%, #223 0%, #101522 35%, #0b1020 85%);
  --color-hero-text: #ffffff;
  --color-hero-overlay: rgba(10, 42, 42, 0.85);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.25);

  /* Font sizes (mobile-first) */
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.5rem;

  /* Spacing (mobile-first) */
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  
  /* Social icons sizing */
  --social-svg-md: 1.5rem;
  --social-svg-lg: 2.5rem;
  
  /* Hero specific */
  --hero-gap: 1.3rem;
  --trees-h: clamp(160px, 34%, 360px);
  --shore-h: clamp(100px, 22%, 260px);
}

/* Dark mode */
[data-theme="dark"] {
  --pine: #1d4154;
  --fern: #6BCAC0;
  --mint: #75bbb4;
  --cream: #0C1420;
  --ink: #EAF4FF;
  --sky: #0A1220;
  --white: #0D1726;

  --color-bg-primary: #07131D;
  --color-bg-secondary: #0C1A28;
  --color-bg-tertiary: #122234;

  --color-text-primary: #E8F2FF;
  --color-text-secondary: #B5CCE0;
  --color-text-muted: rgba(181, 204, 224, 0.68);
  --color-text-inverse: #0A1220;

  --color-accent-primary: #6BCAC0;
  --color-accent-secondary: #2b9b8f;
  --color-accent-hover: #5AB4AB;

  --color-border: rgba(173, 206, 255, 0.12);
  --color-border-strong: rgba(173, 206, 255, 0.22);

  --color-hero-bg: radial-gradient(1200px 600px at 72% -12%, #253B56 0%, #14253A 32%, #0B1626 70%, #08121F 100%);
  --color-hero-text: #EAF6FF;
  --color-hero-overlay: rgba(5, 18, 35, 0.78);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.50);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.65);
}

/* Responsive breakpoints */
@media (min-width: 768px) {
  :root {
    --fs-sm: 1.5rem;
    --fs-md: 1.7rem;
    --fs-lg: 1.9rem;
    --fs-xl: 2.25rem;
    --fs-2xl: 2.75rem;
    --fs-3xl: 3.25rem;

    --space-1: 0.75rem;
    --space-2: 2rem;
    --space-3: 1.5rem;
    --space-4: 2.25rem;
    --space-5: 4rem;
    --space-6: 4rem;

    --social-svg-md: 3.2rem;
    --social-svg-lg: 4.5rem;
    --hero-gap: 4rem;
  }
}

@media (min-width: 1024px) and (min-height: 845px) {
  :root {
    --fs-sm: 1.5rem;
    --fs-md: 1.6rem;
    --fs-lg: 1.75rem;
    --fs-xl: 2.5rem;
    --fs-2xl: 3rem;
    --fs-3xl: 3.5rem;

    --space-1: 0.875rem;
    --space-2: 3rem;
    --space-3: 1.75rem;
    --space-4: 4rem;
    --space-5: 3.5rem;
    --space-6: 4.5rem;

    --social-svg-md: 3rem;
    --social-svg-lg: 5rem;
    --hero-gap: 4rem;
  }
}

@media (min-width: 1440px) {
  :root {
    --fs-sm: 1.125rem;
    --fs-md: 1.375rem;
    --fs-lg: 1.75rem;
    --fs-xl: 2.5rem;
    --fs-2xl: 3.7rem;
    --fs-3xl: 4rem;

    --space-1: 1rem;
    --space-2: 1rem;
    --space-3: 2rem;
    --space-4: 3rem;
    --space-5: 4rem;
    --space-6: 5rem;

    --social-svg-md: 2.25rem;
    --social-svg-lg: 3.25rem;
    --hero-gap: 1.3rem;
  }
}

/* Landscape mobile/tablet exception */
@media (max-width: 786px) and (max-height: 600px) {
  :root {
    --fs-sm: 1.2rem;
    --fs-md: 1rem;
    --fs-lg: 1.3rem;
    --fs-xl: 1.4rem;
    --fs-2xl: 2.2rem;
    --fs-3xl: 2.8rem;

    --space-2: 0rem;
    --space-4: 0rem;
    
    --social-svg-md: 1.3rem;
    --social-svg-lg: 2.2rem;
    --hero-gap: 1rem;
  }

  .tag { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1024px) and (max-height: 768px) {
  :root {
    --fs-sm: 1.2rem;
    --fs-md: 1rem;
    --fs-lg: 1.3rem;
    --fs-xl: 1.8rem;
    --fs-2xl: 2.2rem;
    --fs-3xl: 2.8rem;

    --space-1: 0.5rem;
    --space-2: 0.7rem;
    --space-3: 1.25rem;
    --space-4: 1.75rem;
    --space-5: 2.5rem;
    --space-6: 3rem;

    --social-svg-md: 2rem;
    --social-svg-lg: 3rem;
  }
}

/* ===== Base Styles ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: normal !important;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  font-size: var(--fs-md);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  line-height: 1.6;
  padding-top: 0 !important;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img, svg, canvas {
  max-width: 100%;
  height: auto;
}

/* ===== Layout Components ===== */
.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 0 var(--space-5);
}

@media (max-width: 860px) {
  .site-header .container {
    padding: 0 var(--space-3);
  }
}

/* ===== Header & Navigation ===== */
.site-header {
  position: static !important;
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3); /* Added horizontal padding */
  max-width: var(--maxw);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--color-text-secondary);
  font-weight: 900;
  letter-spacing: .3px;
}

.brand-logo {
  width: clamp(50px, 8vw, 70px); /* Responsive sizing */
  height: clamp(50px, 8vw, 70px); /* Responsive sizing */
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0; /* Prevent logo from shrinking */
}

/* Override the global img rule for brand logo */
.brand-logo img {
  width: 100%;
  height: 100%;
  max-width: none; /* Override global max-width */
  object-fit: cover; /* Ensure image fills the container */
}

.brand-name {
  font-size: var(--fs-lg);
}

.site-nav {
  position: relative;
}

.menu-btn {
  display: none;
  background: var(--color-accent-secondary);
  color: var(--color-text-inverse);
  border: 1px solid var(--color-border-strong);
  border-radius: 10px;
  padding: .6rem .9rem;
  font-weight: 800;
  cursor: pointer;
}

.menu {
  display: flex;
  gap: clamp(.6rem, 2vw, 1.2rem);
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 2000;
}

.menu a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--fs-lg);
  padding: .4rem .2rem;
}

.menu a:hover,
.menu a:focus {
  text-decoration: underline;
}

/* Mobile navigation */
@media (max-width: 1046px) {
  .site-nav { z-index: 1100; }

  .menu-btn { display: inline-block; }

  .menu {
    position: absolute;
    top: calc(100% + .6rem);
    right: 0;
    flex-direction: column;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: var(--space-2);
    min-width: 240px;
    display: none;
  }

  .site-nav.open .menu { display: flex; }
  body.nav-locked { overflow: hidden; }
}

/* ===== Hero Section ===== */
.hero {
  position: relative;
  color: var(--color-hero-text);
  isolation: isolate;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-inner {
  display: grid;
  align-content: center;
  justify-items: center;
  row-gap: var(--space-2);
  padding-bottom: max(1rem, calc(var(--trees-h) * 0.35));
  padding-top: var(--space-5);
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -3;
  background: var(--color-hero-bg);
}

.trees {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: var(--trees-h);
  z-index: -2;
  pointer-events: none;
}

.trees svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.shore {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: var(--shore-h);
  z-index: -1;
  background: linear-gradient(180deg, rgba(10,42,42,0), rgba(10,42,42,.55) 40%, var(--color-hero-overlay));
  filter: blur(.2px);
}

.hero h1 {
  font-size: var(--fs-lg);
  line-height: 1.1;
  margin: 0 0 .6rem;
  font-weight: 900;
  color: var(--color-hero-text);
}

.hero p {
  text-align: center;
  justify-content: center;
  max-width: 68ch;
  opacity: .95;
  font-size: var(--fs-md);
  color: var(--color-hero-text);
}

.hero-heading {
  font-size: var(--fs-xl);
  line-height: 1.1;
  margin: 0 0 .6rem;
  font-weight: 900;
  color: var(--color-hero-text);
  text-align: left;
}

#quote,
.hero-quote {
  position: absolute;
  inset: 0;
  text-align: center;
  transition: opacity 500ms ease;
  will-change: opacity;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.quote-viewport {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quote-viewport::after {
  content: "The road to heaven often feels like hell — and the road to hell often feels like heaven.";
  display: block;
  visibility: hidden;
  white-space: normal;
}

.tag {
  display: inline-block;
  background: var(--mint);
  color: var(--pine);
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: var(--fs-md);
  font-weight: 800;
  margin-top: 3rem;
}

.cta {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .9rem;
}

.hero-icons {
  display: flex;
  justify-content: center;
  gap: var(--hero-gap);
  margin-top: 1.2rem;
}

.hero-icons a {
  display: inline-grid;
  place-items: center;
  width: var(--social-svg-lg);
  height: var(--social-svg-lg);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.3s ease, transform 0.2s ease;
}

.hero-icons svg {
  width: var(--social-svg-md);
  height: var(--social-svg-md);
  fill: var(--color-hero-text);
  transition: fill 0.3s ease;
}

.hero-icons a:hover {
  background: var(--color-accent-secondary);
  transform: translateY(-2px);
}

.hero-icons a:hover svg {
  fill: var(--color-text-inverse);
}

/* Hero mobile adjustments */
@media (max-width: 768px) {
  .hero .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    text-align: center;
  }

  .hero .tag {
    display: inline-block;
    margin: 0 auto 1rem;
  }

  .hero h1,
  .hero p,
  .hero-heading {
    text-align: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
  }

  .hero .cta {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
  }

  .quote-viewport {
    width: 100%;
    min-height: 3.2rem;
    padding: 0 1rem;
  }

  #quote,
  .hero-quote {
    text-align: center !important;
  }
}

/* ===== Buttons ===== */
.btn {
  padding: .85rem 1.15rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  display: inline-block;
  border: 2px solid transparent;
  line-height: 1;
}

.btn.primary {
  background: var(--color-accent-primary);
  color: white;
}

.btn.primary:hover,
.btn.primary:focus {
  background: var(--color-accent-hover);
}

.btn.secondary {
  background: transparent;
  color: var(--color-accent-secondary);
  border-color: var(--color-accent-secondary);
}

.btn.secondary:hover,
.btn.secondary:focus {
  background: var(--color-accent-secondary);
  color: var(--color-text-inverse);
}

.btn.amazon {
  background: #ff9900;
  color: #111;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  padding: .6rem .9rem;
  font-weight: 900;
  text-decoration: none;
  display: inline-block;
}

.btn.amazon:hover,
.btn.amazon:focus {
  filter: brightness(0.96);
  text-decoration: none;
}

/* ===== Content Sections ===== */
section {
  padding: 0;
  scroll-margin-top: calc(var(--header-h) + 12px);
}

.section-title {
  font-size: var(--fs-xl);
  margin: 0 0 .5rem;
  color: var(--color-text-secondary);
}

.muted {
  color: var(--color-text-muted);
}

/* ===== About Section ===== */
.about {
  background: var(--color-bg-primary);
  padding: 2rem 1rem;
}

.about-content {
  max-width: 1400px;
  margin: 0 auto;
}

.about-image {
  float: left;
  margin: 0 2rem 1rem 0;
}

.about-image img {
  width: 280px;
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.about-text p {
  margin-bottom: 1rem;
  color: var(--color-text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.7;
}

.bio-full { display: block; }
.bio-short { display: none; }

@media (max-width: 768px) {
  .about-image {
    float: none;
    margin: 0 0 1.5rem 0;
    text-align: center;
  }

  .about-image img {
    width: 60%;
    max-width: 180px;
    margin: 0 auto;
    display: block;
  }
  
  .bio-full { display: none; }
  .bio-short { display: block; }
}

/* ===== Cards ===== */
.card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--space-3);
}

.icon-title {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.icon-title svg {
  width: 28px;
  height: 28px;
}

/* ===== Books Section ===== */
.book {
  display: grid;
  gap: var(--space-3);
  align-items: center;
  grid-template-columns: auto 1fr;
}

@media (max-width: 760px) {
  .book {
    grid-template-columns: 1fr;
  }
}

.cover {
  width: clamp(180px, 22vw, 210px);
  height: clamp(260px, 30vw, 300px);
  border-radius: 10px;
  background: linear-gradient(160deg, var(--color-text-secondary), var(--color-accent-primary));
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(200px 200px at 40% 20%, rgba(255,255,255,.25), transparent 50%),
    radial-gradient(230px 180px at 70% 60%, rgba(255,255,255,.15), transparent 60%);
}

.spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 26px;
  background: linear-gradient(90deg, rgba(255,255,255,.25), rgba(0,0,0,.05));
  box-shadow: inset -6px 0 10px rgba(0,0,0,.08);
}

.books-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .books-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}

@media (min-width: 1024px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .books-grid > .book-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 720px;
    width: 100%;
  }
}

.book-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.book-cover {
  position: relative;
  margin: 0 auto;
  aspect-ratio: 3/4;
  overflow: hidden;
  border-radius: calc(var(--radius) * 0.8);
  background: linear-gradient(180deg, rgba(62,95,68,.06), rgba(147,218,151,.08));
  display: grid;
  place-items: center;
  width: min(240px, 100%);
  max-height: 320px;
}

.book-cover img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.book-cover .book-spine {
  position: absolute;
  left: 0;
  top: 0;
  width: 6%;
  height: 100%;
  background: rgba(0,0,0,.06);
  box-shadow: inset -6px 0 10px rgba(0,0,0,.08);
}

.book-title {
  margin: 0 0 .25rem 0;
  font-size: var(--fs-lg);
}

.book-text .muted {
  margin: 0 0 var(--space-2);
  opacity: .85;
  font-size: var(--fs-sm);
}

/* ===== Posts Grid ===== */
.posts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 960px) {
  .posts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .posts {
    grid-template-columns: 1fr;
  }
}

/* ===== Contact Form ===== */
#contact {
  margin-top: var(--space-6);
}

.form-grid {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  margin-top: .4rem;
}

.field > span {
  font-size: var(--fs-md);
  color: var(--color-text-muted);
}

input,
textarea {
  width: 100%;
  padding: .2rem .4rem;
  border-radius: 12px;
  border: 1.5px solid var(--color-border-strong);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font: inherit;
}

input::placeholder,
textarea::placeholder {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  opacity: 0.7;
}

input:focus,
textarea:focus {
  outline: 3px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 4rem;
  flex-wrap: wrap;
  margin-top: var(--space-1);
}


#form-notice {
  font-size: 1.1rem;  /* or whatever size you prefer */
  font-weight: 500;   /* optional: make it slightly bolder */
  color: #10b981;     /* optional: green color for success */
}

/* Or if you want it to match your button size */
.notice {
  font-size: 1rem;
  line-height: 1.5;
  display: inline-block;
  margin-left: 1rem;
  color: var(--color-text-muted);
}

/* ===== Footer ===== */
.site-footer {
  padding: var(--space-2) 0;
  color: var(--color-text-muted);
  background: var(--color-bg-primary);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}

.footer-socials {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: var(--space-3);
  margin-bottom: var(--space-6);
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  text-decoration: none;
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: color 0.2s ease;
}

.footer-link svg {
  width: 1.5em;
  height: 1.5em;
  fill: currentColor;
}

.footer-link:hover,
.footer-link:focus {
  color: var(--color-accent-primary);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-accent-primary);
  border: 2px solid var(--color-border-strong);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  z-index: 1000;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.theme-toggle svg {
  width: 24px;
  height: 24px;
  fill: var(--color-bg-primary);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* ===== Performance & Animations ===== */
.lazy-section {
  content-visibility: auto;
  contain-intrinsic-size: 800px 600px;
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .6s ease, transform .6s ease;
}

.reveal.show {
  opacity: 1;
  transform: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
  body,
  .theme-toggle,
  .reveal {
    transition: none;
  }
}