/* knh-layout.css — Knowharbor Layout Primitives */

/* Body */
body {
  font-family: var(--knh-font-body);
  font-size: var(--knh-body);
  line-height: var(--knh-lh);
  background: var(--knh-bg-white);
  color: var(--knh-fg-on-light-primary);
}

/* Dark page theme */
body.knh-page--dark-top {
  background: var(--knh-bg-dark);
}

/* Container */
.knh-container {
  width: 100%;
  max-width: var(--knh-container-max);
  margin: 0 auto;
  padding: 0 var(--knh-gutter);
}

/* Section wrapper */
.knh-section {
  padding: var(--knh-section-py) 0;
}

/* Section background contexts */
.knh-section--dark      { background: var(--knh-bg-dark); }
.knh-section--dark-alt  { background: var(--knh-bg-dark-alt); }
.knh-section--light     { background: var(--knh-bg-light); }
.knh-section--light-alt { background: var(--knh-bg-light); }
.knh-section--white     { background: var(--knh-bg-white); }
.knh-section--tint      { background: var(--knh-bg-tint); }

/* Grid utilities */
.knh-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.knh-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.knh-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.knh-grid-split { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }

@media (max-width: 768px) {
  .knh-grid-2, .knh-grid-3, .knh-grid-4, .knh-grid-split { grid-template-columns: 1fr; }
}

/* Flex utilities */
.knh-flex { display: flex; }
.knh-flex-center { display: flex; align-items: center; justify-content: center; }
.knh-flex-between { display: flex; align-items: center; justify-content: space-between; }

/* Text alignment */
.knh-text-center { text-align: center; }
.knh-text-left   { text-align: left; }

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Section header */
.knh-section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 3rem;
}

/* Eyebrow label */
.knh-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* Light section eyebrow */
.knh-section--light .knh-eyebrow,
.knh-section--light-alt .knh-eyebrow,
.knh-section--white .knh-eyebrow,
.knh-section--tint .knh-eyebrow {
  color: var(--knh-accent-aa-on-light);
}

/* Dark section eyebrow */
.knh-section--dark .knh-eyebrow,
.knh-section--dark-alt .knh-eyebrow {
  color: var(--knh-accent-aa-on-dark);
}

/* Headings — light contexts */
.knh-section--light h2,
.knh-section--light-alt h2,
.knh-section--white h2,
.knh-section--tint h2 {
  color: var(--knh-fg-on-light-primary);
}

.knh-section--light h3,
.knh-section--light-alt h3,
.knh-section--white h3,
.knh-section--tint h3 {
  color: var(--knh-fg-on-light-primary);
}

.knh-section--light p,
.knh-section--light-alt p,
.knh-section--white p,
.knh-section--tint p {
  color: var(--knh-fg-on-light-secondary);
}

/* Headings — dark contexts */
.knh-section--dark h1,
.knh-section--dark h2,
.knh-section--dark h3,
.knh-section--dark-alt h1,
.knh-section--dark-alt h2,
.knh-section--dark-alt h3 {
  color: var(--knh-fg-on-dark-primary);
}

.knh-section--dark p,
.knh-section--dark-alt p {
  color: var(--knh-fg-on-dark-secondary);
}

/* Fade-in animation */
.knh-fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.knh-fade-in.visible {
  opacity: 1;
  transform: none;
}

/* Failsafe: reveal after 1.2s if JS doesn't fire */
@keyframes knh-reveal {
  to { opacity: 1; transform: none; }
}

.knh-fade-in {
  animation: knh-reveal 0.5s ease 1.2s forwards;
}
