/* --- Base reset & tokens --- */
:root {
  --bg: #F5F2EC;
  --bg-alt: #EAE6DC;
  --bg-dark: #1C1917;
  --fg: #1C1917;
  --fg-muted: #78716C;
  --fg-on-dark: #F5F2EC;
  --accent: #B5531C;
  --accent-light: #D4713A;
  --border: #D6D0C6;
  --border-dark: #2E2A26;
  --admin-color: #2D5A41;
  --cms-color: #3A4E7A;
  --portal-color: #6B4E8A;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* --- Site header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 242, 236, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.03em;
}
.site-nav {
  display: flex;
  gap: 2rem;
}
.site-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--fg); }

/* --- Shared section styles --- */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--fg);
  margin-bottom: 3.5rem;
}

/* --- Hero --- */
.hero {
  padding: 5rem 2rem 4rem;
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}
.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.hero-headline {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  color: var(--fg);
}
.hero-headline em {
  font-style: italic;
  color: var(--accent);
}
.hero-sub {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: 42ch;
}

/* Stack diagram */
.hero-visual { display: flex; align-items: center; justify-content: center; }
.stack-diagram {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.stack-layer {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  position: relative;
  overflow: hidden;
}
.stack-layer::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}
.layer-admin::before { background: var(--admin-color); }
.layer-cms::before { background: var(--cms-color); }
.layer-portal::before { background: var(--portal-color); }
.stack-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
}
.stack-sub {
  font-size: 0.75rem;
  color: var(--fg-muted);
}
.stack-unify {
  margin-top: 0.25rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  background: var(--fg);
  text-align: center;
}
.stack-unify span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bg);
  letter-spacing: 0.04em;
}

/* --- Modules --- */
.modules {
  padding: 5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.modules-inner { max-width: 1100px; margin: 0 auto; }
.modules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.module-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  position: relative;
}
.module-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.module-admin .module-icon { background: #E8F0EA; color: var(--admin-color); }
.module-cms .module-icon { background: #E8ECF5; color: var(--cms-color); }
.module-portal .module-icon { background: #EEEAF5; color: var(--portal-color); }
.module-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.1875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.375rem;
}
.module-audience {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}
.module-desc {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--fg-muted);
  margin-bottom: 1.25rem;
}
.module-tags {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.module-tags li {
  font-size: 0.8125rem;
  color: var(--fg);
  padding-left: 1rem;
  position: relative;
}
.module-tags li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* --- Operations --- */
.operations { padding: 5rem 2rem; border-bottom: 1px solid var(--border); }
.operations-inner { max-width: 1100px; margin: 0 auto; }
.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
}
.op-item {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}
.op-item:nth-child(odd) { padding-right: 3rem; border-right: 1px solid var(--border); }
.op-item:nth-child(even) { padding-left: 3rem; }
.op-item:nth-last-child(-n+2) { border-bottom: none; }
.op-marker {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.op-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.375rem;
}
.op-desc { font-size: 0.875rem; line-height: 1.65; color: var(--fg-muted); }

/* --- Principles --- */
.principles {
  padding: 5rem 2rem;
  background: var(--fg);
  color: var(--fg-on-dark);
  border-bottom: 1px solid var(--border-dark);
}
.principles-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 5rem;
  align-items: start;
}
.principles-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  color: var(--fg-on-dark);
  margin-bottom: 1rem;
}
.principles-body {
  font-size: 1rem;
  line-height: 1.7;
  color: #A9A095;
  max-width: 40ch;
}
.principles-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.principle-item {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-dark);
}
.principle-item:first-child { border-top: 1px solid var(--border-dark); }
.principle-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(245,242,236,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #C4BFB5;
}
.principle-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg-on-dark);
  margin-bottom: 0.25rem;
}
.principle-desc { font-size: 0.8125rem; line-height: 1.6; color: #A9A095; }

/* --- Closing --- */
.closing { padding: 6rem 2rem; background: var(--bg); }
.closing-inner { max-width: 1100px; margin: 0 auto; }
.closing-statement { max-width: 640px; }
.closing-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.25rem;
}
.closing-headline {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 1.5rem;
}
.closing-body {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--fg-muted);
  max-width: 52ch;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  background: var(--bg-alt);
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-brand {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg);
}
.footer-tagline { font-size: 0.8125rem; color: var(--fg-muted); }

/* --- Auth nav elements --- */
.nav-user-email {
  font-size: 0.8rem;
  color: var(--fg-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-logout-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8125rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--fg-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.nav-logout-btn:hover { border-color: var(--fg-muted); color: var(--fg); }
.nav-signin-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent) !important;
  text-decoration: none;
}
.nav-signin-link:hover { text-decoration: underline; }
.nav-subscribe-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-subscribe-link:hover { color: var(--accent); }

/* --- Responsive --- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 3rem; }
  .hero-visual { order: -1; }
  .modules-grid { grid-template-columns: 1fr; }
  .ops-grid { grid-template-columns: 1fr; }
  .op-item:nth-child(odd) { border-right: none; padding-right: 0; }
  .op-item:nth-child(even) { padding-left: 0; }
  .op-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
  .op-item:last-child { border-bottom: none; }
  .principles-inner { grid-template-columns: 1fr; gap: 3rem; }
}

@media (max-width: 600px) {
  .hero { padding: 3rem 1.25rem 2.5rem; }
  .modules, .operations, .principles, .closing { padding: 3.5rem 1.25rem; }
  .site-nav { display: none; }
}