/* ============================================================
   thatcsharp.dev, Philip Pierce
   1. Design tokens  2. Reset  3. Typography  4. Layout
   5. Components  6. Sections  7. View toggle  8. Responsive
   ============================================================ */

/* 1. DESIGN TOKENS */
:root {
  color-scheme: dark;
  --primary:        #512BD4;
  --on-primary:     #FFFFFF;
  --primary-active: #6A4BE0;
  --primary-pale:   #2A2060;
  --ink:            #F2F0FA;
  --ink-deep:       #D2C8FF;
  --body:           #C8C3DC;
  --mute:           #A09BBA;
  --canvas:         #12101E;
  --canvas-soft:    #1B1830;
  --positive:       #4EC9B0;

  /* additions */
  --accent:         #B9A6FF;
  --code-bg:        #0B0A14;
  --line:           #3E3868;

  --radius-xl:  24px;
  --radius-pill: 9999px;

  --maxw: 1200px;
  --font:         'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

/* Sticky header height, measured in a browser: 79px above 720px, 120px at 720px and below.
   Section anchors use it so a linked section starts just below the header. */
:root { --header-h: 79px; }

/* 2. RESET */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--canvas-soft);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "calt";
}
img { max-width: 100%; }
::selection { background: var(--primary); color: var(--on-primary); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.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;
}

/* 3. TYPOGRAPHY */
h1, h2, h3 { font-family: var(--font-display); }
.display-xl { font-weight: 700; font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.04; letter-spacing: -1.5px; margin: 0 0 20px; }
.display-md { font-weight: 700; font-size: clamp(1.75rem, 3.5vw, 2.5rem); line-height: 1.1; letter-spacing: -0.8px; margin: 0 0 8px; }
.display-sm { font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.25rem); letter-spacing: -0.6px; margin: 0 0 14px; color: var(--ink); }
.lead { font-size: 1.25rem; line-height: 1.5; color: var(--body); margin: 0 0 28px; max-width: 40ch; }
.eyebrow { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 1.5px; font-size: 0.8rem; font-weight: 500; color: var(--mute); margin-bottom: 20px; }

/* 4. LAYOUT */
.container { max-width: var(--maxw); margin: 0 auto; }
.container.center { text-align: center; }
.band { padding: 56px 24px; }
.band-sage  { background: var(--canvas-soft); }
.band-white { background: var(--canvas); }
.band-dark  { background: var(--code-bg); padding: 72px 24px; }
section[id] { scroll-margin-top: var(--header-h); }

/* 5. COMPONENTS */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 1rem; line-height: 1;
  padding: 14px 26px; min-height: 48px; border-radius: var(--radius-xl);
  text-decoration: none; cursor: pointer; border: none; font-family: inherit;
  transition: background-color 160ms ease-out;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-active); }
.btn-outline { background: var(--canvas); color: var(--ink); border: 1px solid var(--ink); }
.btn-outline:hover { background: var(--canvas-soft); }
.btn-outline-light { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.btn-outline-light:hover { background: var(--canvas-soft); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }

picture { display: block; }
.infograph { width: 100%; height: auto; display: block; border-radius: var(--radius-xl); box-shadow: 0 0 0 1px var(--line); }

.tag {
  background: var(--canvas); color: var(--body); font-family: var(--font-mono); font-weight: 500;
  padding: 9px 16px; border-radius: var(--radius-pill); font-size: 0.8125rem;
}
.tags { display: flex; flex-wrap: wrap; gap: 10px; }

.text-link {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--accent); text-underline-offset: 3px; transition: color 160ms ease-out;
}
.text-link:hover { color: var(--ink); }

/* 6. SECTIONS */
/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--canvas); border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 18px;
}
.toggle {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--canvas); flex-shrink: 0;
}
.toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-size: 0.875rem; font-weight: 600;
  padding: 0 18px; min-height: 44px; border-radius: var(--radius-pill);
  font-family: inherit; white-space: nowrap; background: transparent; color: var(--body);
  transition: background-color 200ms ease-out, color 200ms ease-out;
}
.toggle-btn.active { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 0 0 2px var(--accent); }

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 1; min-width: 0; }
.brand-name { font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem; line-height: 1.3; color: var(--ink); min-width: 0; }
.header-spacer { flex: 1 1 auto; }
.header-cta { min-height: 48px; padding: 12px 22px; border-radius: var(--radius-pill); white-space: nowrap; flex-shrink: 0; font-size: 0.95rem; }

/* Hero */
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 40px; align-items: center; }
.stat-card { background: var(--canvas); border-radius: var(--radius-xl); padding: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 28px 24px; }
.stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
.stat-num { font-family: var(--font-mono); font-weight: 700; font-size: 2.75rem; line-height: 1; color: var(--accent); }
.stat-label { font-size: 0.95rem; color: var(--body); margin-top: 6px; }

/* Clients */
.client-list { font-size: clamp(1.25rem, 2.6vw, 1.9rem); line-height: 1.5; font-weight: 500; color: var(--body); margin: 0; max-width: 60ch; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 40px; margin-top: 36px; }
.skills-grid > :nth-child(3) { grid-column: 1 / -1; }
.skills-head { font-weight: 700; font-size: 1.35rem; letter-spacing: -0.4px; margin: 0 0 18px; color: var(--ink-deep); }

/* Work */
.work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px; align-items: stretch; margin-top: 32px; }
.work-stack { display: grid; gap: 20px; margin-top: 32px; }
.work-link { margin: 6px 0 0; font-size: 0.98rem; }
.card { border-radius: var(--radius-xl); padding: 28px; }
.card-sage { background: var(--canvas-soft); }
.card-outline { background: var(--canvas); border: 1px solid var(--line); }
.card-title { font-weight: 700; font-size: 1.2rem; margin: 0 0 12px; letter-spacing: -0.3px; }
.card-body { font-size: 0.98rem; line-height: 1.55; color: var(--body); margin: 0; }
.card-body.big { font-size: 1.15rem; margin: 0 0 24px; max-width: 60ch; }

/* Code Ninja */
.ninja-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 20px; }
.ninja-card { background: var(--primary-pale); border-radius: var(--radius-xl); padding: 40px; }
.ninja-card-books .card-body.big { margin-bottom: 0; }
.ninja-kicker { font-family: var(--font-mono); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 500; color: var(--ink-deep); margin-bottom: 16px; }

/* Testimonials */
.quote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 32px; }
.quote { background: var(--canvas); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-xl); padding: 28px; margin: 0; }
.quote blockquote { font-style: italic; font-size: 1.05rem; line-height: 1.55; color: var(--body); margin: 0 0 18px; }
.q-name { display: block; font-weight: 700; color: var(--ink); }
.q-org { display: block; font-family: var(--font-mono); font-size: 0.9rem; color: var(--mute); }

/* Also (smaller type than the case studies) */
.also-head { font-weight: 700; font-size: clamp(1.25rem, 2.4vw, 1.5rem); letter-spacing: -0.3px; margin: 0 0 14px; color: var(--ink); }
.also-line { font-size: 1rem; line-height: 1.55; color: var(--body); margin: 0 0 8px; max-width: 60ch; }

/* CTA */
.cta-head { font-weight: 700; font-size: clamp(2rem, 4.5vw, 3.25rem); letter-spacing: -1px; margin: 0 0 18px; color: var(--accent); }
.cta-sub { font-size: 1.2rem; line-height: 1.55; color: var(--body); margin: 0 auto 32px; max-width: 52ch; }

/* Footer */
.site-footer { background: var(--code-bg); border-top: 1px solid var(--line); padding: 40px 24px; }
.footer-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-brand { opacity: 0.9; }
.footer-name { font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.footer-nav { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--body); text-decoration: none; font-size: 0.95rem; }
.footer-nav a:hover { color: var(--accent); }
.footer-copy { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--mute); }

/* 7. VIEW TOGGLE: show/hide by data-view */
[data-view="infograph"] .text-view { display: none; }
[data-view="text"] .infograph-view { display: none; }

/* 8. RESPONSIVE */
/* Header: two rows on narrow screens, brand + CTA on row 1, full-width toggle on row 2 */
@media (max-width: 720px) {
  :root { --header-h: 120px; }
  .header-inner { flex-wrap: wrap; column-gap: 10px; row-gap: 8px; padding: 8px 16px; }
  .header-spacer { display: none; }
  .header-inner .brand { order: 1; flex: 1 1 0; justify-content: flex-start; min-width: 0; }
  .header-cta { order: 2; margin-left: auto; flex-shrink: 0; min-height: 44px; padding: 10px 18px; font-size: 0.9rem; }
  .toggle { order: 3; flex-basis: 100%; width: 100%; display: flex; padding: 2px; }
  .toggle-btn { flex: 1; padding: 0; }
}
@media (max-width: 767px) {
  .band, .band-dark { padding: 40px 20px; }
  .brand-name { font-size: 0.75rem; line-height: 1.25; }
}

/* 9. MOTION */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
