/* ===================================================================
   Consulting The Machine — Legal Pages
   Shared stylesheet
   =================================================================== */

/* --- Custom Properties --- */
:root {
  --color-navy: #0A1628;
  --color-deep-blue: #1E3A5F;
  --color-accent: #2563EB;
  --color-accent-hover: #1D4ED8;
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-text: #1E293B;
  --color-text-secondary: #64748B;
  --color-border: #E2E8F0;

  --max-width: 800px;
  --radius: 12px;
  --header-height: 64px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

/* --- Skip Link (a11y) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* --- Site Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
  background: var(--color-navy);
}

.site-header__brand {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-header__brand:hover {
  color: rgba(255, 255, 255, 0.85);
}

.site-header__nav {
  display: flex;
  gap: 24px;
}

.site-header__nav a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
  white-space: nowrap;
}

.site-header__nav a:hover {
  color: #fff;
}

.site-header__nav a[aria-current="page"] {
  color: #fff;
}

/* --- Content Card --- */
.content-card {
  max-width: var(--max-width);
  margin: 48px auto;
  padding: 48px 40px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.03);
}

/* --- Typography --- */
h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-deep-blue);
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.page-meta {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-deep-blue);
  margin: 40px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  letter-spacing: -0.01em;
}

h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-deep-blue);
  margin: 24px 0 12px;
}

p {
  margin: 0 0 16px;
}

ul, ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 8px;
}

strong {
  font-weight: 600;
}

/* --- Links --- */
a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration-color: var(--color-accent-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Table of Contents --- */
.toc {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 24px 28px;
  margin: 0 0 32px;
}

.toc__title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin: 0 0 12px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc li {
  margin-bottom: 6px;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.toc a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
}

.toc a:hover {
  color: var(--color-accent);
}

/* --- Landing Page --- */
.landing-card {
  text-align: center;
}

.landing-card p {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0 auto 32px;
}

.landing-links {
  list-style: none;
  padding: 0;
  margin: 0 0 40px;
}

.landing-links li {
  margin: 0;
}

.landing-links a {
  display: block;
  padding: 16px 20px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border);
  transition: color 0.15s, background 0.15s, padding-left 0.2s;
}

.landing-links li:first-child a {
  border-top: 1px solid var(--color-border);
}

.landing-links a::after {
  content: ' \2192';
  color: transparent;
  transition: color 0.15s;
}

.landing-links a:hover {
  color: var(--color-accent);
  background: var(--color-bg);
  padding-left: 28px;
}

.landing-links a:hover::after {
  color: var(--color-accent);
}

.landing-contact {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

/* --- Footer --- */
.site-footer {
  background: var(--color-navy);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8125rem;
  padding: 24px;
  text-align: center;
  line-height: 1.6;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
  text-decoration-color: transparent;
}

.site-footer a:hover {
  color: #fff;
  text-decoration-color: rgba(255, 255, 255, 0.5);
}

.site-footer a:focus-visible {
  outline-color: rgba(255, 255, 255, 0.8);
}

/* --- Responsive: Tablet (768px) --- */
@media (max-width: 768px) {
  .site-header {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 8px;
  }

  .site-header__nav {
    gap: 16px;
  }

  .content-card {
    margin: 24px 16px;
    padding: 32px 24px;
  }

  h1 {
    font-size: 1.625rem;
  }

  h2 {
    font-size: 1.125rem;
  }
}

/* --- Responsive: Mobile (480px) --- */
@media (max-width: 480px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
  }

  .site-header__nav {
    width: 100%;
    gap: 12px;
    flex-wrap: wrap;
  }

  .site-header__nav a {
    font-size: 0.8125rem;
  }

  .content-card {
    margin: 16px 8px;
    padding: 24px 16px;
  }

  h1 {
    font-size: 1.375rem;
  }

  .toc {
    padding: 16px 20px;
  }

  .landing-links a {
    font-size: 1rem;
    padding: 14px 16px;
  }
}

/* --- Print Styles --- */
@media print {
  .skip-link,
  .site-header,
  .site-footer,
  .toc {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .content-card {
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    max-width: 100%;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }

  a[href^="#"]::after,
  a[href^="mailto:"]::after {
    content: "";
  }

  h2, h3 {
    page-break-after: avoid;
  }

  p, li {
    orphans: 3;
    widows: 3;
  }
}
