/* =============================================================
   KAI HACKS — kaihacks.ai
   Stylesheet
   ============================================================= */

/* ----- Reset & base ----- */

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

/* ----- Custom properties ----- */

:root {
  --bg:     #fafaf8;
  --text:   #1c1c1a;
  --muted:  #7a7a75;
  --border: #ddddd8;

  --font-serif: Georgia, 'Times New Roman', serif;

  --measure: 42rem;  /* max-width for prose columns */
  --wide:    76rem;  /* max-width for wide containers */

  --space-xs: 0.5rem;
  --space-s:  1rem;
  --space-m:  2rem;
  --space-l:  4rem;
  --space-xl: 6rem;
}

/* ----- Base typography ----- */

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

h1, h2, h3 {
  font-weight: normal;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--text);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ----- Skip link (accessibility) ----- */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background-color: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 1rem;
}

/* ----- Focus styles ----- */

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

/* =============================================================
   Site header
   ============================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 3.5rem;
}

.site-logo {
  font-size: 0.75rem;
  font-weight: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
}

/* ----- Nav ----- */

.site-nav {
  display: none;
  position: absolute;
  top: 3.5rem;
  left: 0;
  right: 0;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem;
  flex-direction: column;
  gap: 1.25rem;
}

.site-nav.is-open {
  display: flex;
}

.site-nav a {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

/* ----- Hamburger button ----- */

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2rem;
  height: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 1px;
  background-color: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (min-width: 640px) {
  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    gap: 2.5rem;
    border: none;
    padding: 0;
    background: none;
  }

  .nav-toggle {
    display: none;
  }
}

/* =============================================================
   Layout containers
   ============================================================= */

/* Wide container — pages, card grids */
.page-wrap {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Prose container — text columns */
.prose {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-xl) 1.5rem var(--space-l);
}

.prose + .prose {
  padding-top: 0;
}

/* =============================================================
   Hero photo
   ============================================================= */

.hero {
  margin: 0 0 0;
}

/*
 * The hero__image block reserves space via aspect-ratio.
 * When assets/img/hero.jpg + hero.webp are present, the photo fills it.
 * Until then, the fallback background-color shows as a placeholder.
 * Replace the img src paths and alt text once you have a photo.
 */
.hero__image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--border);
}

.hero__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

@media (min-width: 640px) {
  .hero__image {
    aspect-ratio: 16 / 9;
  }
}

/* =============================================================
   Typography — headings and labels
   ============================================================= */

/* Page headline — the primary statement on a page */
.page-headline {
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.3;
  margin: 0 0 1.5rem;
}

/* Section label — small-caps category header */
.section-label {
  font-size: 0.75rem;
  font-weight: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin: 0 0 1.75rem;
}

/* Lead paragraph — slightly larger opening text */
.lead {
  font-size: 1.1rem;
  line-height: 1.65;
}

/* Text link — inline body link with underline */
.text-link {
  text-decoration: none;
  border-bottom: 1px solid var(--text);
  padding-bottom: 1px;
  transition: opacity 0.15s;
}

.text-link:hover {
  opacity: 0.6;
}

/* Email link */
.email-link {
  display: inline-block;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--text);
  padding-bottom: 1px;
  margin-top: 0.25rem;
  transition: opacity 0.15s;
}

.email-link:hover {
  opacity: 0.6;
}

/* Muted text */
.muted {
  font-size: 0.875rem;
  color: var(--muted);
}

.muted a {
  color: var(--muted);
}

.muted a:hover {
  color: var(--text);
}

/* =============================================================
   World cards
   ============================================================= */

.cards-header {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-xl) 1.5rem var(--space-m);
}

.cards-grid {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.5rem var(--space-xl);
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--border);
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0 3rem;
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.card__context {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
  margin: 0 0 0.4rem;
}

.card__title {
  font-size: 1rem;
  font-weight: normal;
  margin: 0 0 0.75rem;
}

.card__body {
  font-size: 0.9rem;
  color: var(--muted);
  flex: 1;
  margin: 0 0 1.25rem;
}

.card__body p {
  margin: 0;
}

.card__actions {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Card action buttons */
.btn {
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--text);
  padding-bottom: 1px;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.btn:hover {
  opacity: 0.6;
}

.btn--disabled {
  color: var(--border);
  border-color: var(--border);
  cursor: default;
  pointer-events: none;
}

/* =============================================================
   Architecture page
   ============================================================= */

.arch-toc {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem var(--space-l);
}

.arch-toc ol {
  padding-left: 1.25rem;
  margin: 1rem 0 0;
  font-size: 0.9rem;
}

.arch-toc li {
  margin-bottom: 0.3rem;
}

.arch-toc a {
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.arch-toc a:hover {
  border-color: var(--text);
}

/* Architecture sections */
.arch-section {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem var(--space-l);
}

.arch-section h2 {
  font-size: 1.2rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin: 0 0 1.5rem;
}

.arch-section h3 {
  font-size: 0.75rem;
  font-weight: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  margin: 2rem 0 0.75rem;
}

/* Architecture property lists */
.props {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.props li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.props li:last-child {
  border-bottom: none;
}

.mnemonic {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.minimum {
  font-size: 0.875rem;
  color: var(--muted);
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin: 1.5rem 0 0;
}

/* =============================================================
   Site footer
   ============================================================= */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-l) 1.5rem var(--space-xl);
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer__inner {
  max-width: var(--wide);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.site-footer a:hover {
  color: var(--text);
  border-color: var(--text);
}

/* =============================================================
   Utilities
   ============================================================= */

.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;
}
