:root {
  --paper: #f3f6fc;
  --ink: #0e1117;
  --muted: #4a5568;
  --line: rgba(14,17,23,0.16);
  --accent: #e03b5a;
  --state: #1a3a6e;
  --state-faint: rgba(26,58,110,0.05);
  --safe: #1a8a4a;
}

:root[data-theme="dark"] {
  --paper: #07090f;
  --ink: #e4ecff;
  --muted: #7b93b8;
  --line: rgba(228,236,255,0.12);
  --accent: #ff6d87;
  --state: #4d7cc7;
  --state-faint: rgba(77,124,199,0.08);
  --safe: #34d977;
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

html, body { 
  margin: 0; 
  min-height: 100%; 
}

body {
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--paper);
  transition: background 0.3s, color 0.3s;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* Mobile-first: single column, minimal margins */
.page-shell {
  width: calc(100% - 1.5rem);
  margin: 1rem auto 2rem;
  max-width: 1240px;
}

/* Header: stacked on mobile */
.site-header {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.75rem;
  align-items: start;
}

.brand-rail { padding-top: 0.1rem; }

.brand-logo { 
  width: 48px; 
  height: 48px; 
  display: block; 
  border-radius: 8px; 
}

.site-body { min-width: 0; }

.header-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wordmark-group { display: grid; gap: 0.2rem; }

.brand {
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  font-size: 0.9rem;
}

#status-indicator {
  color: var(--safe);
  font-size: 0.75rem;
  transition: opacity 1s ease;
}

.nav-links button {
  background: transparent;
  color: var(--ink);
  padding: 0.5rem 0;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-transform: lowercase;
  min-height: 44px;
  min-width: 44px;
}

.header-rule { 
  border-top: 1px solid var(--state); 
  margin: 0.75rem 0 0; 
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--state);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 500;
}

/* Thesis panel: mobile optimized */
.thesis-panel {
  margin: 2.5rem 0 2rem;
  text-align: left;
  background-image: radial-gradient(circle, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  padding: 1.5rem;
  border-radius: 2px;
}

.thesis-panel h1 {
  margin: 0.75rem 0 1rem;
  font-size: clamp(1.75rem, 8vw, 4rem);
  line-height: 1.05;
  font-weight: 400;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
}

.summary, .positioning {
  color: var(--muted);
  max-width: 100%;
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
}

.positioning {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

/* Statement: full width on mobile */
.statement-row {
  margin: 1.5rem 0 2.5rem;
  text-align: center;
}

.statement-copy { 
  font-size: 1.05rem; 
  line-height: 1.7; 
  max-width: 55ch;
  margin: 0 auto;
}

.statement-copy p { 
  margin: 0; 
  color: var(--muted); 
}

/* Capability section */
.capability-section { 
  margin-top: 1.5rem; 
}

.section-rule { 
  border-top: 1px solid var(--state); 
}

.section-heading-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
  text-align: center;
  align-items: center;
}

.section-note { 
  margin: 0; 
  color: var(--muted); 
  font-size: 0.9rem; 
  font-style: italic; 
}

/* List grid: single column on mobile with touch-friendly cards */
.list-grid { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 1rem; 
  padding: 0.5rem;
  margin: 0 -0.5rem;
}

.list-item { 
  min-width: 0;
  background: var(--state-faint);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.list-item:active {
  transform: scale(0.98);
  background: var(--line);
}

@media (hover: hover) {
  .list-item:hover {
    border-color: var(--state);
    box-shadow: 0 2px 8px rgba(14,17,23,0.08);
  }
}

.list-item h3 { 
  margin: 0 0 0.5rem; 
  font-size: 1.15rem; 
  font-weight: 500; 
  line-height: 1.3;
}

.list-item p { 
  line-height: 1.6; 
  font-size: 0.95rem; 
  color: var(--muted); 
  margin: 0; 
}

/* Click hint for mobile */
.click-hint {
  text-align: center;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.click-hint::before {
  content: "↻";
  font-size: 1rem;
  animation: rotate 2s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Footer */
.footer { 
  margin-top: 3rem; 
  padding-top: 1.5rem; 
  border-top: 1px solid var(--line); 
  color: var(--muted); 
  text-align: left; 
}

.footer p { 
  margin: 0; 
  font-size: 0.9rem; 
}

/* Focus states for accessibility */
button:focus, a:focus { 
  outline: 2px solid var(--accent); 
  outline-offset: 2px; 
}

/* Tablet: 640px and up */
@media (min-width: 640px) {
  html { font-size: 17px; }
  
  .page-shell {
    width: calc(100% - 2rem);
    margin: 1.25rem auto 2.5rem;
  }
  
  .site-header {
    grid-template-columns: 56px 1fr;
    gap: 1rem;
  }
  
  .brand-logo { 
    width: 56px; 
    height: 56px; 
  }
  
  .header-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
  }
  
  .nav-links {
    justify-content: flex-end;
    gap: 0.8rem 1.2rem;
  }
  
  .thesis-panel {
    margin: 3rem 0 2.5rem;
    padding: 2rem;
    text-align: center;
  }
  
  .thesis-panel h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
  }
  
  .summary {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .positioning {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .list-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    padding: 0;
    margin: 0;
  }
  
  .list-item {
    padding: 1.5rem;
  }
  
  .footer {
    text-align: center;
  }
  
  .click-hint {
    font-size: 0.9rem;
    margin-top: 1.5rem;
  }
}

/* Desktop: 920px and up */
@media (min-width: 920px) {
  html { font-size: 18px; }
  
  body {
    font-family: "Avenir Next", "Helvetica Neue", -apple-system, sans-serif;
  }
  
  .page-shell {
    margin: 1.5rem auto 2.5rem;
  }
  
  .site-header {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 1.35rem;
  }
  
  .brand-logo { 
    width: 74px; 
    height: 74px; 
    border-radius: 10px; 
  }
  
  .brand {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
  }
  
  .nav-links {
    font-size: 0.98rem;
  }
  
  .header-rule {
    margin-top: 0.9rem;
  }
  
  .eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
  }
  
  .thesis-panel {
    max-width: 920px;
    margin: 4rem auto 3rem;
    padding: 4rem 2rem;
    background-size: 28px 28px;
  }
  
  .thesis-panel h1 {
    margin: 1rem auto 1.4rem;
    max-width: 16ch;
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    line-height: 0.95;
  }
  
  .summary, .positioning {
    font-size: 1.02rem;
    line-height: 1.75;
  }
  
  .summary {
    max-width: 720px;
  }
  
  .positioning {
    max-width: 760px;
    margin-top: 2rem;
    padding-top: 1.15rem;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
  }
  
  .statement-row {
    margin: 2rem auto 4rem;
    text-align: center;
    max-width: 720px;
  }
  
  .statement-copy { 
    font-size: 1.15rem; 
    line-height: 1.7; 
    margin: 0 auto;
  }
  
  .statement-copy p {
    max-width: 45ch;
    margin: 0 auto;
  }
  
  .section-heading-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 1rem;
    align-items: baseline;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .section-note {
    font-size: 0.94rem;
  }
  
  .list-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }
  
  .list-item {
    padding: 1.75rem;
  }
  
  .list-item h3 {
    font-size: 1.25rem;
    font-weight: 400;
  }
  
  .list-item p {
    font-size: 0.98rem;
  }
  
  .footer {
    margin-top: 5rem;
    padding-top: 2rem;
  }
  
  .footer p {
    font-size: 0.94rem;
  }
  
  .click-hint {
    margin-top: 2rem;
  }
}
