/* Sitka Theme — Software Development Publication
   Design: Purple editorial (#7C3AED) + refined slate neutrals
   Typography: Inter (loaded via HTML)
   Mobile-first, WCAG AAA, dark mode, no JS */

/* ========= TOKENS ========= */
:root {
  /* Palette — light */
  --bg: #FAFBFD;
  --bg-alt: #F3F4F8;
  --surface: #FFFFFF;
  --surface-alt: #F0F1F6;
  --surface-hover: #F7F7FB;
  --text: #111827;
  --text-2: #374151;
  --text-muted: #6B7280;
  --border: #E2E5EC;
  --border-light: #ECEEF3;
  --accent: #7C3AED;
  --accent-hover: #6D28D9;
  --accent-subtle: #EDE9FE;
  --accent-text: #FFFFFF;
  --code-bg: #F5F3FF;
  --code-border: #DDD6FE;
  --code-text: #5B21B6;
  --link: #7C3AED;
  --link-hover: #5B21B6;
  --danger: #DC2626;
  --success: #059669;
  --info: #2563EB;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.07);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.08);

  /* Layout */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 200ms ease;
  --max-width: 1120px;
  --content-width: 720px;
  --gutter: 1.25rem;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;
  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.875rem;    /* 14 */
  --fs-base: 1rem;      /* 16 */
  --fs-md: 1.125rem;    /* 18 */
  --fs-lg: 1.25rem;     /* 20 */
  --fs-xl: 1.5rem;      /* 24 */
  --fs-2xl: 2rem;       /* 32 */
  --fs-3xl: 2.5rem;     /* 40 */
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-normal: 1.6;
  --lh-relaxed: 1.75;
}

/* Dark mode — system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0E14;
    --bg-alt: #12141C;
    --surface: #181B25;
    --surface-alt: #1F2330;
    --surface-hover: #242838;
    --text: #E8EAF0;
    --text-2: #B4B9C8;
    --text-muted: #6E7489;
    --border: #282C3A;
    --border-light: #222638;
    --accent: #A78BFA;
    --accent-hover: #8B5CF6;
    --accent-subtle: #1E1535;
    --accent-text: #0C0E14;
    --code-bg: #1A1530;
    --code-border: #2D2450;
    --code-text: #C4B5FD;
    --link: #A78BFA;
    --link-hover: #C4B5FD;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.15);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.2), 0 1px 2px rgba(0,0,0,.15);
    --shadow-md: 0 4px 12px rgba(0,0,0,.25);
    --shadow-lg: 0 10px 24px rgba(0,0,0,.3);
  }
}

/* Dark mode — explicit toggle */
:root[data-theme="dark"] {
  --bg: #0C0E14;
  --bg-alt: #12141C;
  --surface: #181B25;
  --surface-alt: #1F2330;
  --surface-hover: #242838;
  --text: #E8EAF0;
  --text-2: #B4B9C8;
  --text-muted: #6E7489;
  --border: #282C3A;
  --border-light: #222638;
  --accent: #A78BFA;
  --accent-hover: #8B5CF6;
  --accent-subtle: #1E1535;
  --accent-text: #0C0E14;
  --code-bg: #1A1530;
  --code-border: #2D2450;
  --code-text: #C4B5FD;
  --link: #A78BFA;
  --link-hover: #C4B5FD;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.2), 0 1px 2px rgba(0,0,0,.15);
  --shadow-md: 0 4px 12px rgba(0,0,0,.25);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.3);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  background: var(--bg);
  color: var(--text);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition);
  cursor: pointer;
}
a:hover { color: var(--link-hover); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

/* ========= HEADER ========= */
.site-header {
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-logo {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}
.site-logo:hover { color: var(--text); }

.logo-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 3px;
  flex-shrink: 0;
}

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.site-nav a {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: color var(--transition);
  cursor: pointer;
  position: relative;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.active {
  color: var(--accent);
  font-weight: 600;
}

@media (max-width: 600px) {
  .site-nav ul { gap: 1rem; }
  .site-nav a { font-size: var(--fs-xs); }
  .header-inner { height: 52px; }
}

/* ========= HERO ========= */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem var(--gutter) 3rem;
}

.hero-tagline {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(var(--fs-2xl), 4.5vw, var(--fs-3xl));
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.035em;
  color: var(--text);
  max-width: 720px;
  margin-bottom: 1rem;
  text-wrap: balance;
}

.hero-desc {
  font-size: var(--fs-md);
  color: var(--text-2);
  max-width: 600px;
  line-height: var(--lh-normal);
}

@media (max-width: 600px) {
  .hero { padding: 2.5rem var(--gutter) 2rem; }
}

/* ========= SECTION TITLE ========= */
.section-title {
  font-size: var(--fs-xs);
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ========= ARTICLE CARDS ========= */
.articles-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
.article-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 0.875rem;
  width: fit-content;
}

.card-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  line-height: var(--lh-snug);
  color: var(--text);
  margin-bottom: 0.5rem;
}
.card-title a {
  color: inherit;
  cursor: pointer;
}
.card-title a:hover { color: var(--accent); }

.card-excerpt {
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: var(--lh-normal);
  flex: 1;
  margin-bottom: 1.25rem;
}

.card-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.card-meta .dot { opacity: 0.35; }

@media (max-width: 600px) {
  .articles-grid { grid-template-columns: 1fr; gap: 1rem; }
  .article-card { padding: 1.25rem; }
}

/* ========= ARTICLE DETAIL ========= */
.article-detail {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3rem var(--gutter) 5rem;
}

.article-detail .breadcrumbs {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumbs a {
  color: var(--text-muted);
  cursor: pointer;
}
.breadcrumbs a:hover { color: var(--accent); }
.bc-sep { margin: 0 0.35rem; opacity: 0.35; }

.article-detail h1 {
  font-size: clamp(1.75rem, 4vw, var(--fs-2xl));
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  text-wrap: balance;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.article-meta .divider { opacity: 0.25; }

/* ========= ARTICLE CONTENT ========= */
.article-content {
  line-height: var(--lh-relaxed);
}

.article-content h2 {
  font-size: var(--fs-xl);
  font-family: var(--font-display);
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.article-content h3 {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.article-content h4 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.article-content p {
  margin-bottom: 1.25rem;
  color: var(--text-2);
  font-size: var(--fs-base);
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-2);
}
.article-content li {
  margin-bottom: 0.5rem;
  line-height: var(--lh-normal);
}

.article-content strong { color: var(--text); font-weight: 600; }

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
}
.article-content a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.75rem 0;
  background: var(--accent-subtle);
  color: var(--text-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
}

.article-content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--text);
  tab-size: 2;
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--code-text);
}
.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.article-content th {
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.75rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.article-content td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
  vertical-align: top;
}
.article-content tr:last-child td { border-bottom: none; }

/* ========= FAQ ========= */
.faq {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}

.faq h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  transition: border-color var(--transition);
}
.faq-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

.faq-item h3 {
  font-size: var(--fs-base);
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  line-height: var(--lh-snug);
}

.faq-item p {
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: var(--lh-normal);
}

/* ========= PAGE CONTENT (About, Editorial, Privacy, Contact) ========= */
.page-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3rem var(--gutter) 5rem;
}

.page-content h1 {
  font-size: clamp(1.75rem, 4vw, var(--fs-2xl));
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  text-wrap: balance;
}

.page-content .lead {
  font-size: var(--fs-md);
  color: var(--text-2);
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  line-height: var(--lh-normal);
}

.page-content h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.875rem;
  letter-spacing: -0.02em;
}

.page-content h3 {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.page-content p {
  color: var(--text-2);
  margin-bottom: 1rem;
  line-height: var(--lh-normal);
}

.page-content ul, .page-content ol {
  color: var(--text-2);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}
.page-content li {
  margin-bottom: 0.4rem;
  line-height: var(--lh-normal);
}
.page-content strong { color: var(--text); font-weight: 600; }

/* ========= TEAM ========= */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}

.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.team-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--shadow-sm);
}

.team-card .name {
  font-weight: 700;
  font-size: var(--fs-base);
  margin-bottom: 0.2rem;
  color: var(--text);
}
.team-card .role {
  font-size: var(--fs-xs);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.625rem;
}
.team-card p {
  font-size: var(--fs-sm);
  margin-bottom: 0;
  line-height: var(--lh-normal);
}

/* ========= POLICY BOX ========= */
.policy-box {
  background: var(--accent-subtle);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 1.125rem 1.375rem;
  margin: 1.25rem 0;
}
.policy-box strong { color: var(--accent); }

/* ========= BUTTON ========= */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  min-height: 44px;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========= FOOTER ========= */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }

.footer-brand {
  font-weight: 700;
  font-size: var(--fs-base);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.footer-copy {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

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

/* ========= PRINT ========= */
@media print {
  .site-header, .site-footer, .site-nav { display: none; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .article-detail, .page-content { max-width: 100%; padding: 0; }
  a { color: #000; text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
