/* Purpose: Custom stylesheet for the Law and Gospel primer study page. Reason: Supports that page's distinct lesson layout, visual theme, and interactive study presentation apart from the shared site styles. */
/* Coffee-inspired Color Palette */
:root {
    --latte-light: #f5ebe0;
    --latte-medium: #e3d5ca;
    --coffee-accent: #d5bdaf;
    --text-dark: #4a3f35;
    --morph-opacity: 1; /* Controlled by JS */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--latte-light);
    color: var(--text-dark);
}

/* --- HEADER CONTAINER --- */
#main-header {
    position: fixed;
    top: 0;
    width: 100%;
    height: 180px; 
    display: flex;
    align-items: center;
    transition: all 0.4s ease;
    z-index: 1000;
    /* Important: must be visible so the dropdown menu isn't cut off */
    overflow: visible; 
}

/* Shrink class applied via JS */ #main-header.shrunk { height: 80px; background-color: rgba(227, 213, 202, 0.95); box-shadow: 0 2px 10px rgba(0,0,0,0.1); }

 
.header-bg {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: 27% 73%;
    z-index: 1;
    pointer-events: none; /* Clicks pass through to buttons */
}

.narrow-bg {
    background-image: linear-gradient(rgba(245,235,224,0.4), rgba(245,235,224,0.4)),
        url('../assets/images/site/church-header-narrow.png');
    background-position: 27% 36%;
    opacity: var(--morph-opacity);
}

.wide-bg {
    background-image: linear-gradient(rgba(245,235,224,0.4), rgba(245,235,224,0.4)),
        url('../assets/images/site/church-header-wide.png');
    opacity: calc(1 - var(--morph-opacity));
}

/* --- HEADER CONTENT LAYOUT --- */
.header-content {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between; /* Title Left, Nav Right */
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

#header-title {
    margin: 0;
    font-size: 2rem;
    transition: font-size 0.4s;
}

#main-header.shrunk #header-title {
    font-size: 1.4rem;
}

/* --- NAVIGATION BUTTONS --- */
.header-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.nav-btn {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: bold;
    padding: 8px 12px;
    border: 1px solid var(--text-dark);
    border-radius: 4px;
    transition: 0.3s;
    background: rgba(255,255,255,0.1);
}

.nav-btn:hover {
    background: var(--text-dark);
    color: #fff;
}

/* --- HAMBURGER MENU ICON --- */
.menu-toggle {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    z-index: 1002;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-dark);
    border-radius: 2px;
}

/* --- RESPONSIVE / MOBILE STYLES --- */
@media (max-width: 850px) {
    .menu-toggle { display: flex; } /* Show hamburger on the right */

    .header-nav {
        display: none; /* JS toggles this */
        flex-direction: column;
        position: absolute;
        top: 100%; /* Drops down from bottom of header */
        right: -5%; /* Align to edge */
        background-color: var(--latte-medium);
        width: 220px;
        padding: 20px;
        box-shadow: -5px 5px 15px rgba(0,0,0,0.2);
        z-index: 9999;
    }

    .header-nav.active {
        display: flex !important; /* Visible when hamburger clicked */
    }

    .nav-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
}

/* --- BODY CONTENT --- */
.content-container {
    padding: 220px 20px 80px;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.toc-container {
  max-width: 900px;
  margin: auto;
  padding: 260px 20px 80px; /* extra space for tracker */
}

.toc-section {
  margin-bottom: 30px;
}

h1, h2 {
  color: #4b2e2e; /* dark coffee */
}

.page-actions {
  margin: 18px 0 28px;
}

.back-study-btn {
  display: inline-block;
  text-decoration: none;
  color: white;
  background: #6f4e37;
  border: 1px solid #6f4e37;
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 600;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.back-study-btn:hover,
.back-study-btn:focus-visible {
  background: #4b2e2e;
  border-color: #4b2e2e;
  color: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background-color: #6f4e37; /* coffee brown */
  color: white;
  padding: 10px;
}

td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  cursor: pointer;
}

/* Hover */
tr:hover {
  background-color: #f5eee6;
}

/* CURRENT STUDY LOCATION */
.current {
  background-color: #c8a27a !important;
  color: #fff;
  font-weight: bold;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: white;
  border-radius: 6px;
  overflow: hidden;
}

#study-tracker {
  position: fixed;
  top: 180px; /* sits just below full header */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 900px;

  background: #6f4e37;
  color: white;
  padding: 12px 16px;

  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);

  font-weight: bold;
  text-align: center;

  z-index: 999;
  transition: top 0.4s ease;
}

/* When header shrinks */
#main-header.shrunk + #study-tracker {
  top: 80px;
}

/* Highlight the dynamic part */
#study-text {
  color: #ffd9a0;
}

/* --- FOOTER --- */
.site-footer {
    margin-top: 2rem;
    background:
        linear-gradient(180deg, rgba(47, 31, 24, 0.96), rgba(29, 18, 14, 1)),
        linear-gradient(120deg, rgba(118, 81, 58, 0.22), transparent);
    color: #f4eadf;
}

.footer-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.25rem 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 2rem;
}

.footer-kicker {
    margin: 0 0 0.65rem;
    color: rgba(244, 234, 223, 0.68);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.footer-about h2 {
    color: #f4eadf;
    margin: 0 0 1rem;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 600;
    line-height: 1;
    max-width: 12ch;
}

.footer-about p,
.footer-column a,
.footer-bottom p {
    font-weight: 400;
    line-height: 1.7;
}

.footer-link-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.footer-column {
    display: grid;
    align-content: start;
    gap: 0.55rem;
}

.footer-column a {
    text-decoration: none;
    color: rgba(244, 234, 223, 0.88);
    transition: color 180ms ease;
}

.footer-column a:hover,
.footer-column a:focus-visible {
    color: white;
    outline: none;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(244, 234, 223, 0.14);
}

.footer-bottom p {
    margin: 0;
    padding: 1rem 0 2rem;
    color: rgba(244, 234, 223, 0.72);
    font-size: 0.92rem;
}

.footer-socials {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-bottom: 2rem;
}

.footer-socials a {
    padding: 0.55rem 0.9rem;
    border: 1px solid rgba(244, 234, 223, 0.16);
    border-radius: 999px;
    color: rgba(244, 234, 223, 0.88);
    font-size: 0.92rem;
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        color 180ms ease;
}

.footer-socials a:hover,
.footer-socials a:focus-visible {
    background: rgba(244, 234, 223, 0.12);
    border-color: rgba(244, 234, 223, 0.34);
    color: white;
    outline: none;
}

.back-to-top-button {
    position: fixed;
    right: 1.2rem;
    bottom: 1.2rem;
    z-index: 30;
    display: grid;
    place-items: center;
    width: 74px;
    height: 86px;
    border: 0;
    background: transparent;
    color: #3b2117;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}

.back-to-top-button.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top-button img {
    width: 58px;
    height: auto;
    filter: drop-shadow(0 10px 18px rgba(48, 29, 20, 0.28));
}

.back-to-top-steam {
    position: absolute;
    top: -7px;
    left: 50%;
    width: 42px;
    height: 34px;
    transform: translateX(-50%);
    pointer-events: none;
}

.back-to-top-steam span {
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 22px;
    border-left: 2px solid rgba(78, 45, 31, 0.6);
    border-radius: 50%;
    opacity: 0;
    animation: coffeeSteamRise 2.4s ease-in-out infinite;
}

.back-to-top-steam span:nth-child(1) {
    left: 6px;
    animation-delay: 0s;
}

.back-to-top-steam span:nth-child(2) {
    left: 18px;
    animation-delay: 0.45s;
}

.back-to-top-steam span:nth-child(3) {
    left: 30px;
    animation-delay: 0.9s;
}

@keyframes coffeeSteamRise {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.82);
    }

    30% {
        opacity: 0.78;
    }

    100% {
        opacity: 0;
        transform: translateY(-14px) scale(1.22);
    }
}

@media (max-width: 700px) {
    .footer-grid,
    .footer-link-groups {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-socials {
        justify-content: flex-start;
    }

    .back-to-top-button {
        right: 0.75rem;
        bottom: 0.75rem;
    }
}
