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

/* Buttons and CTAs */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  min-width: 44px;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #c62f4a;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-secondary:hover {
  border-color: var(--state);
  background: var(--state-faint);
}

.cta-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
  align-items: center;
}

/* CTA Section */
.cta-section {
  margin: 3rem 0;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--state-faint);
  border-radius: 8px;
}

.cta-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 400;
  font-family: Georgia, serif;
}

.cta-subtext {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 1rem;
}

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

.footer-tagline {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-style: italic;
}

.footer-brand a {
  color: var(--state);
  font-size: 0.95rem;
}

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

.footer-copy {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 1.5rem 0 0;
}

/* 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;
}

#theme-toggle {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  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); }
}

/* 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;
  }
  
  /* Tablet CTAs */
  .cta-row {
    flex-direction: row;
    gap: 1rem;
  }
  
  .cta-section {
    margin: 3rem 0;
    padding: 2.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;
  }
  
  /* Desktop CTAs */
  .cta-row {
    flex-direction: row;
    gap: 1rem;
    margin-top: 2rem;
  }
  
  .cta-section {
    margin: 4rem 0;
    padding: 3rem;
  }
  
  .cta-section h2 {
    font-size: 2rem;
  }
  
  .cta-subtext {
    font-size: 1.05rem;
  }
}

/* Contact Modal Styles */
.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.contact-modal[hidden] {
  display: none;
}

.contact-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 17, 23, 0.6);
  cursor: pointer;
}

.contact-modal__panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(14, 17, 23, 0.2);
}

.contact-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

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

.contact-modal__close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  text-transform: lowercase;
  min-height: 44px;
  min-width: 44px;
}

.contact-modal__close:hover {
  color: var(--accent);
}

.contact-modal__panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 400;
  font-family: Georgia, serif;
}

.contact-modal__intro {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.contact-field span {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: lowercase;
}

.contact-field input,
.contact-field textarea {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 44px;
}

.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--state);
}

.contact-field input[aria-invalid="true"],
.contact-field textarea[aria-invalid="true"] {
  border-color: var(--accent);
}

.contact-field textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-form-status {
  min-height: 1.5rem;
  font-size: 0.85rem;
  margin: 0;
}

.contact-form-status.success {
  color: var(--safe);
}

.contact-form-status.error {
  color: var(--accent);
}

.contact-form__actions {
  margin-top: 0.5rem;
}

.contact-submit {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
}

.contact-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.contact-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Tablet contact modal */
@media (min-width: 640px) {
  .contact-modal {
    padding: 1.5rem;
  }

  .contact-modal__panel {
    padding: 2rem;
  }

  .contact-modal__panel h2 {
    font-size: 1.75rem;
  }

  .contact-submit {
    width: auto;
    min-width: 200px;
  }

  .contact-form__actions {
    text-align: right;
  }
}

/* Desktop contact modal */
@media (min-width: 920px) {
  .contact-modal__panel {
    padding: 2.5rem;
  }

  .contact-modal__panel h2 {
    font-size: 2rem;
  }
}

/* Services page styles */
.nav-link {
  color: var(--ink);
  font-size: 0.9rem;
  text-transform: lowercase;
}

.nav-link:hover {
  color: var(--state);
}
