/*
Theme Name: Life Archive Theme
Theme URI: https://example.com/life-archive-theme
Author: David
Description: A clean full site editing theme designed for the Life Archive plugin.
Requires at least: 6.4
Tested up to: 7.0
Requires PHP: 7.4
Version: 0.2.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: life-archive-theme
Tags: full-site-editing, blog, one-column, custom-colors, custom-logo, editor-style
*/

:root {
  --la-border: #e6e1d8;
  --la-soft: #f7f4ef;
  --la-softer: #fbfaf8;
  --la-ink: #1f2933;
  --la-muted: #5f6b76;
  --la-accent: #5b6f8f;
  --la-accent-dark: #34435e;
}

body {
  background: #ffffff;
}

.wp-site-blocks {
  min-height: 100vh;
}

a {
  text-underline-offset: 0.18em;
}

.la-theme-site-header {
  border-bottom: 1px solid var(--la-border);
}

.la-theme-site-footer {
  border-top: 1px solid var(--la-border);
}

.la-theme-site-header,
.la-theme-site-footer {
  padding-left: 40px;
  padding-right: 40px;
  box-sizing: border-box;
}

@media (max-width: 700px) {
  .la-theme-site-header,
  .la-theme-site-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
}

.la-theme-panel,
.la-theme-card,
.life-archive-entry-card,
.life-archive-context-nav,
.life-archive-index-list,
.life-archive-empty {
  background: var(--la-softer);
  border: 1px solid var(--la-border);
  border-radius: 18px;
}

.la-theme-panel {
  padding: clamp(1.25rem, 2vw, 2rem);
}

.la-theme-card,
.life-archive-entry-card,
.life-archive-context-nav,
.life-archive-empty {
  padding: 1.15rem;
}

.la-theme-hero {
  border-bottom: 1px solid var(--la-border);
}

.la-theme-muted,
.life-archive-entry-meta,
.life-archive-entry-summary,
.life-archive-context-label,
.life-archive-empty {
  color: var(--la-muted);
}

.life-archive-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.life-archive-entry-card h3,
.life-archive-entry-title {
  margin-top: 0;
}

.life-archive-entry-card a,
.life-archive-context-nav a,
.life-archive-index-list a {
  color: var(--la-accent-dark);
}

.life-archive-index-list {
  list-style: none;
  padding: 1rem;
  margin-left: 0;
}

.life-archive-index-list li + li {
  margin-top: 0.35rem;
}

.life-archive-context-nav {
  margin-top: 2rem;
}

.life-archive-context-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}

.la-theme-card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.la-theme-card {
  height: 100%;
}

.la-theme-card p:last-child,
.la-theme-panel p:last-child {
  margin-bottom: 0;
}

.wp-block-button .wp-block-button__link {
  border-radius: 999px;
}

.wp-block-post-content > * + * {
  margin-block-start: 1.1rem;
}

@media (max-width: 760px) {
  .la-theme-site-header .wp-block-navigation {
    font-size: 0.95rem;
  }

  .life-archive-context-links {
    display: block;
  }

  .life-archive-context-links > * + * {
    margin-top: 0.7rem;
  }
}


.la-theme-entry-taxonomies {
  background: var(--la-softer);
  border: 1px solid var(--la-border);
  border-radius: 18px;
}

.la-theme-term-row {
  border-top: 1px solid var(--la-border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.la-theme-term-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.la-theme-term-label {
  margin-bottom: 0.25rem;
  color: var(--la-muted);
  font-size: 0.92rem;
}

.la-theme-header-inner,
.la-theme-footer-inner {
  gap: 1rem;
}


/* Front page archive navigation grid. Explicit rules so saved FSE templates render
   the browse cards as cards on the public site, not as a vertical list. */
.la-theme-card-grid,
.wp-site-blocks .la-theme-card-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  gap: 1.1rem !important;
  width: 100%;
  max-width: 1120px;
}

.la-theme-card-grid > .la-theme-card,
.wp-site-blocks .la-theme-card-grid > .wp-block-group,
.wp-site-blocks .la-theme-card-grid > .la-theme-card {
  background: var(--la-softer) !important;
  border: 1px solid var(--la-border) !important;
  border-radius: 18px !important;
  padding: 1.15rem !important;
  height: auto;
  min-height: 100%;
  box-sizing: border-box;
}

.la-theme-card-grid .life-archive-index-list {
  background: transparent;
  border: 0;
  padding: 0;
  margin-top: 0.75rem;
}

@media (min-width: 900px) {
  .la-theme-card-grid,
  .wp-site-blocks .la-theme-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

/* Friendly taxonomy archive headings. */
.la-theme-taxonomy-intro {
  margin-bottom: 1.75rem;
}

.la-theme-taxonomy-intro h1 {
  margin-bottom: 0.35rem;
}

.la-theme-taxonomy-subtitle {
  color: var(--la-muted);
  font-size: 1.05rem;
  margin-top: 0;
}

/* Single entry archive-link grid. */
.la-theme-entry-term-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 2rem;
}

.la-theme-entry-term-card {
  background: var(--la-softer);
  border: 1px solid var(--la-border);
  border-radius: 18px;
  padding: 1rem;
}

.la-theme-entry-term-card h2 {
  font-size: 1rem;
  margin: 0 0 0.55rem;
}

.la-theme-entry-term-card p {
  margin: 0;
}

.la-theme-entry-term-card a {
  color: var(--la-accent-dark);
}

@media (max-width: 700px) {
  .la-theme-entry-term-grid {
    grid-template-columns: 1fr;
  }
}



/* Fixed home archive card grid: keep Life Stages, Topics and People aligned. */
.la-theme-home-archive-grid,
.wp-site-blocks .la-theme-home-archive-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: stretch !important;
  gap: 1.1rem !important;
  width: 100% !important;
  max-width: 1120px !important;
}

.la-theme-home-archive-grid > .wp-block-group,
.la-theme-home-archive-grid > .la-theme-card,
.wp-site-blocks .la-theme-home-archive-grid > .wp-block-group,
.wp-site-blocks .la-theme-home-archive-grid > .la-theme-card {
  align-self: stretch !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.la-theme-home-archive-grid .la-theme-card,
.wp-site-blocks .la-theme-home-archive-grid .la-theme-card {
  display: flex !important;
  flex-direction: column !important;
}

.la-theme-home-archive-grid .life-archive-index-list,
.wp-site-blocks .la-theme-home-archive-grid .life-archive-index-list {
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 899px) {
  .la-theme-home-archive-grid,
  .wp-site-blocks .la-theme-home-archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .la-theme-home-archive-grid,
  .wp-site-blocks .la-theme-home-archive-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Life Book Builder integration. */
.la-theme-life-book-archive,
.la-theme-life-book-page {
  box-sizing: border-box;
}

.life-book-theme-supported .life-book-archive-header {
  margin-bottom: 2.5rem;
  text-align: center;
}

.life-book-theme-supported .life-book-archive-kicker,
.life-book-theme-supported .life-book-part-label,
.life-book-theme-supported .life-book-entry-date,
.life-book-theme-supported .life-book-page-navigation a span {
  color: var(--la-muted);
}

.life-book-theme-supported .life-book-archive-header h1,
.la-theme-life-book-title {
  margin-bottom: 0.75rem;
}

.life-book-theme-supported .life-book-archive-description {
  max-width: 680px;
  margin-inline: auto;
  color: var(--la-muted);
}

.life-book-theme-supported .life-book-contents {
  display: grid;
  gap: 1.25rem;
  max-width: 980px;
}

.life-book-theme-supported .life-book-contents > .life-book-part {
  margin: 0;
  padding: clamp(1.15rem, 2.5vw, 1.75rem);
  background: var(--la-softer);
  border: 1px solid var(--la-border);
  border-radius: 18px;
}

.life-book-theme-supported .life-book-part h3 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.life-book-theme-supported .life-book-part ol,
.life-book-theme-supported .life-book-part-list ol {
  margin: 0;
  padding-left: 1.35rem;
}

.life-book-theme-supported .life-book-part li + li,
.life-book-theme-supported .life-book-part-list li + li {
  margin-top: 0.55rem;
}

.life-book-theme-supported .life-book-part a,
.life-book-theme-supported .life-book-part-list a {
  color: var(--la-accent-dark);
  text-decoration-thickness: 1px;
}

.life-book-theme-supported .life-book-page-generated {
  max-width: none;
}

.life-book-theme-supported .life-book-page-introduction {
  margin-bottom: 2rem;
  font-size: 1.06rem;
}

.life-book-theme-supported .life-book-prompt {
  margin-block: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--la-border);
}

.life-book-theme-supported .life-book-prompt > h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 2.3vw, 1.65rem);
}

.life-book-theme-supported .life-book-structured-details {
  padding: 1.1rem 1.2rem;
  background: var(--la-soft);
  border: 1px solid var(--la-border);
  border-radius: 14px;
}

.life-book-theme-supported .life-book-structured-details dt {
  color: var(--la-muted);
}

.life-book-theme-supported .life-book-entry {
  margin-block: 1rem;
  padding: 1.15rem 1.2rem;
  background: #ffffff;
  border: 1px solid var(--la-border);
  border-radius: 14px;
}

.life-book-theme-supported .life-book-entry h3 {
  font-size: 1.15rem;
}

.life-book-theme-supported .life-book-entry h3 a {
  color: var(--la-accent-dark);
}

.life-book-theme-supported .life-book-entry-excerpt p:last-child,
.life-book-theme-supported .life-book-entry-content p:last-child {
  margin-bottom: 0;
}

.life-book-theme-supported .life-book-empty-prompt {
  padding: 0.85rem 1rem;
  color: var(--la-muted);
  background: var(--la-softer);
  border: 1px dashed var(--la-border);
  border-radius: 12px;
}

.life-book-theme-supported .life-book-page-navigation {
  border-top-color: var(--la-border);
}

.life-book-theme-supported .life-book-page-navigation a {
  color: var(--la-accent-dark);
}

.life-book-theme-supported .life-book-page-navigation-previous,
.life-book-theme-supported .life-book-page-navigation-next {
  min-width: 0;
}

.life-book-theme-supported .life-book-page-navigation-previous a,
.life-book-theme-supported .life-book-page-navigation-next a,
.life-book-theme-supported .life-book-page-navigation-contents a {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
}

.life-book-theme-supported .life-book-page-navigation a:hover,
.life-book-theme-supported .life-book-page-navigation a:focus-visible {
  background: var(--la-soft);
}

@media (min-width: 760px) {
  .life-book-theme-supported .life-book-contents {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .life-book-theme-supported .life-book-entry,
  .life-book-theme-supported .life-book-structured-details,
  .life-book-theme-supported .life-book-contents > .life-book-part {
    padding: 1rem;
    border-radius: 12px;
  }

  .life-book-theme-supported .life-book-page-navigation {
    gap: 0.5rem;
  }
}

@media print {
  .life-book-page-view .la-theme-site-header,
  .life-book-page-view .la-theme-site-footer,
  .life-book-page-view .life-book-page-navigation,
  .life-book-page-view .life-book-empty-prompt {
    display: none !important;
  }

  .life-book-page-view .la-theme-life-book-page {
    padding: 0 !important;
  }

  .life-book-theme-supported .life-book-entry,
  .life-book-theme-supported .life-book-structured-details,
  .life-book-theme-supported .life-book-prompt {
    background: transparent;
    border-color: #b8b8b8;
    box-shadow: none;
    break-inside: avoid;
  }

  .life-book-theme-supported a {
    color: inherit;
    text-decoration: none;
  }
}
