/*
Theme Name: The Layer and the Foundation
Theme URI: https://layerandfoundation.com
Author: The Layer and the Foundation
Description: Minimal editorial theme for The Layer and the Foundation — biological, social, and systemic evolution, unlayered.
Version: 1.1
Requires at least: 5.8
Requires PHP: 7.4
Text Domain: layer-and-foundation
*/

:root {
  --bedrock: #1F1B17;
  --ink: #2C2620;
  --bone: #EDE6D9;
  --bg: #FBF9F5;
  --surface: #F4EFE6;
  --text-primary: #211D18;
  --text-secondary: #6E6457;
  --text-tertiary: #9A8F7E;
  --border: #E4DCCC;
  --clay: #B5532E;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ── Nav ─────────────────────────────────────────── */
.lf-nav { border-bottom: 1px solid var(--border); }
.lf-nav-inner {
  max-width: 1040px; margin: 0 auto; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.lf-wordmark { font-size: 16px; }
.lf-word-sans { font-weight: 500; }
.lf-word-serif { font-family: 'Lora', serif; font-style: italic; color: var(--text-secondary); }
.lf-menu-list {
  list-style: none; display: flex; gap: 20px; margin: 0; padding: 0;
  font-size: 13px; color: var(--text-secondary); text-transform: lowercase;
}
.lf-menu-list a:hover { color: var(--text-primary); }

.lf-main { max-width: 1040px; margin: 0 auto; padding: 0 24px 48px; }

/* ── Hero ────────────────────────────────────────── */
.lf-hero {
  background: var(--bedrock); border-radius: 16px; padding: 56px 32px;
  text-align: center; margin: 32px 0;
}
.lf-hero-line {
  font-family: 'Lora', serif; font-style: italic; font-size: 26px;
  color: var(--bone); margin: 0 0 12px; line-height: 1.4;
}
.lf-hero-sub { font-size: 14px; color: #C9BFB0; max-width: 460px; margin: 0 auto; line-height: 1.6; }

/* ── Featured card ───────────────────────────────── */
.lf-featured {
  display: flex; flex-wrap: wrap; background: var(--surface);
  border-radius: 16px; overflow: hidden; margin-bottom: 32px;
}
.lf-featured-media {
  flex: 1 1 260px; min-height: 240px;
  background-size: cover; background-position: center;
}
.lf-featured-media img { width: 100%; height: 100%; object-fit: cover; }
.lf-featured-body { flex: 2 1 320px; padding: 32px; }
.lf-featured-title {
  font-size: 22px; font-weight: 500; margin: 14px 0 10px;
  line-height: 1.3; text-transform: lowercase;
}
.lf-featured-title a:hover { text-decoration: underline; }
.lf-featured-excerpt { font-size: 15px; color: var(--text-secondary); line-height: 1.6; margin: 0 0 12px; }

/* ── Category badge / pill ───────────────────────── */
.lf-badge {
  display: inline-block; font-size: 11px; padding: 3px 10px;
  border-radius: 20px; text-transform: lowercase;
  opacity: 0.72;
}

/* ── Card grid ───────────────────────────────────── */
.lf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lf-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; transition: border-color .15s;
}
.lf-card:hover { border-color: var(--text-tertiary); }
.lf-card-accent { height: 4px; }
.lf-card-body { padding: 16px; }
.lf-card-title {
  font-size: 15px; font-weight: 500; margin: 10px 0 8px;
  line-height: 1.4; text-transform: lowercase;
}
.lf-card-title a:hover { text-decoration: underline; }
.lf-card-excerpt {
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lf-meta { font-size: 12px; color: var(--text-tertiary); margin: 0; }

/* ── Single article ──────────────────────────────── */
.lf-article { margin: 40px 0; }
.lf-article-title {
  font-size: 30px; font-weight: 500; margin: 16px 0 10px;
  line-height: 1.3; text-transform: lowercase;
}
/* Solid category color block — always shown, no image needed */
.lf-post-color-block {
  height: 200px; border-radius: 12px;
  margin: 20px 0 32px; display: block;
}
.lf-article-body { font-size: 17px; line-height: 1.85; color: var(--text-primary); }
.lf-article-body a { color: var(--clay); text-decoration: underline; text-underline-offset: 3px; }
.lf-article-body a:hover { opacity: .8; }
.lf-article-body p { margin: 0 0 22px; }
.lf-article-body h2 { font-size: 19px; font-weight: 500; margin: 40px 0 12px; color: var(--text-primary); }
.lf-article-body blockquote {
  font-family: 'Lora', serif; font-style: italic; font-size: 20px;
  border-left: 2px solid var(--clay); margin: 32px 0;
  padding: 4px 0 4px 20px; color: var(--ink);
}
.lf-tags { margin-top: 32px; display: flex; gap: 8px; flex-wrap: wrap; }
.lf-tag {
  font-size: 12px; color: var(--text-secondary); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 6px; text-transform: lowercase;
}
.lf-tag:hover { border-color: var(--text-tertiary); }

/* ── Archive pages ───────────────────────────────── */
.lf-archive-accent { height: 4px; border-radius: 2px; margin-bottom: 20px; }
.lf-archive-head { padding: 0 0 8px; margin-top: 0; }
.lf-archive-title { font-size: 24px; font-weight: 500; margin: 0 0 8px; text-transform: lowercase; }
.lf-archive-desc { color: var(--text-secondary); font-size: 14px; margin: 0 0 20px; }
.lf-empty { color: var(--text-secondary); padding: 40px 0; text-align: center; }

/* ── Pagination ──────────────────────────────────── */
.lf-pagination, .pagination, .nav-links {
  display: flex; justify-content: center; gap: 12px; margin: 40px 0 0; font-size: 13px;
}
.lf-pagination a, .pagination a, .nav-links a { color: var(--text-secondary); }
.lf-pagination a:hover, .pagination a:hover, .nav-links a:hover { color: var(--text-primary); }

/* ── Subscription success page ───────────────────── */
.lf-confirm-headline {
  font-family: 'Lora', serif; font-style: italic;
  font-size: 28px; color: var(--text-primary);
  line-height: 1.4; margin: 0 0 16px;
}
.lf-confirm-sub {
  font-size: 15px; color: var(--text-secondary);
  line-height: 1.7; margin: 0 0 10px;
}
.lf-back-link {
  display: inline-block; font-size: 13px; color: var(--text-primary);
  border: 0.5px solid var(--border); border-radius: 8px;
  padding: 9px 20px; transition: border-color .15s;
}
.lf-back-link:hover { border-color: var(--text-tertiary); }

/* ── Footer ──────────────────────────────────────── */
.lf-footer { border-top: 1px solid var(--border); margin-top: 48px; }
.lf-footer-inner {
  max-width: 1040px; margin: 0 auto; padding: 24px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.lf-footer-text { font-size: 12px; color: var(--text-tertiary); margin: 0; }

/* ── Kit form — fully overridden to match theme ─── */
.lf-kit-wrap { display: flex; align-items: center; }
.lf-kit-wrap .formkit-form,
.lf-kit-wrap .seva-form { all: unset; display: block; }
.lf-kit-wrap [data-style="clean"] { all: unset; display: block; }
.lf-kit-wrap .seva-fields,
.lf-kit-wrap .formkit-fields {
  display: flex !important; flex-wrap: nowrap !important;
  gap: 8px !important; margin: 0 !important; align-items: center;
}
.lf-kit-wrap .formkit-field { flex: 1 !important; margin: 0 !important; min-width: 160px; }
.lf-kit-wrap .formkit-input,
.lf-kit-wrap input[name="email_address"] {
  all: unset !important;
  display: block !important; width: 100% !important;
  border: 1px solid var(--border) !important; border-radius: 8px !important;
  padding: 8px 12px !important; font-size: 13px !important;
  font-family: 'Inter', sans-serif !important; color: var(--text-primary) !important;
  background: #fff !important; box-sizing: border-box !important;
}
.lf-kit-wrap .formkit-input:focus,
.lf-kit-wrap input[name="email_address"]:focus {
  border-color: var(--ink) !important; outline: none !important;
}
.lf-kit-wrap .formkit-submit,
.lf-kit-wrap button[data-element="submit"] {
  all: unset !important;
  display: inline-flex !important; align-items: center !important;
  background: var(--ink) !important; color: #fff !important;
  border-radius: 8px !important; padding: 8px 16px !important;
  font-size: 13px !important; font-family: 'Inter', sans-serif !important;
  cursor: pointer !important; white-space: nowrap !important;
  flex-shrink: 0 !important;
}
.lf-kit-wrap .formkit-submit:hover,
.lf-kit-wrap button[data-element="submit"]:hover { opacity: .88 !important; }
.lf-kit-wrap .formkit-submit > span { padding: 0 !important; }
.lf-kit-wrap .formkit-spinner { display: none !important; }
.lf-kit-wrap .formkit-powered-by-convertkit-container,
.lf-kit-wrap .formkit-powered-by-convertkit { display: none !important; }
.lf-kit-wrap .formkit-alert { display: none !important; }
.lf-kit-wrap .formkit-alert-error:not(:empty) {
  display: block !important; font-size: 12px !important;
  color: #ea4110 !important; margin-top: 6px !important;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 760px) {
  .lf-grid { grid-template-columns: 1fr 1fr; }
  .lf-featured { flex-direction: column; }
  .lf-featured-media { min-height: 180px; }
  .lf-kit-wrap .formkit-fields { flex-wrap: wrap !important; }
}
@media (max-width: 480px) {
  .lf-grid { grid-template-columns: 1fr; }
  .lf-menu-list { gap: 12px; font-size: 12px; }
}

/* ── Sticky footer ───────────────────────────────── */
.lf-main { flex: 1; }

/* ── Subscription success — vertically centered ──── */
.lf-success-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  min-height: 60vh;
}
.lf-success-inner {
  max-width: 520px;
  width: 100%;
  text-align: center;
}

/* ── Hamburger menu ──────────────────────────────── */
.lf-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.lf-hamburger span {
  display: block;
  height: 1.5px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease, width .2s ease;
  transform-origin: center;
}
.lf-hamburger span:nth-child(1) { width: 22px; }
.lf-hamburger span:nth-child(2) { width: 16px; }
.lf-hamburger span:nth-child(3) { width: 22px; }
.lf-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg); width: 22px;
}
.lf-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0; transform: scaleX(0);
}
.lf-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg); width: 22px;
}

/* ── Mobile footer improvement ───────────────────── */
@media (max-width: 640px) {
  .lf-hamburger { display: flex; }
  .lf-menu {
    display: none;
    width: 100%;
    order: 3;
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
  }
  .lf-menu.is-open { display: block; }
  .lf-menu-list {
    flex-direction: column;
    gap: 14px;
    font-size: 14px;
  }

  .lf-footer { margin-top: 32px; }
  .lf-footer-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 20px 24px;
  }
  .lf-footer-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }
  .lf-kit-wrap { width: 100%; }
  .lf-kit-wrap .seva-fields,
  .lf-kit-wrap .formkit-fields {
    flex-direction: row !important;
    gap: 8px !important;
  }
  .lf-kit-wrap .formkit-field { flex: 1 !important; }
  .lf-kit-wrap .formkit-submit,
  .lf-kit-wrap button[data-element="submit"] { flex-shrink: 0 !important; }
}
