/*
 * Plain hand-written stylesheet for Ian Gustafson Magic.
 *
 * Organized top-to-bottom the same way the page reads: variables/reset,
 * header/nav, then one block per section, then shared bits (buttons,
 * footer). No build step — edit this file directly and refresh the page.
 */

:root {
  --color-bg: rgb(3 6 32);
  --color-bg-raised: rgb(15 19 46);
  --color-text: rgb(229 236 246);
  --color-text-muted: rgb(229 236 246 / 70%);
  --color-heading: rgb(247 248 248);
  --color-primary: rgb(37 118 245);
  --color-border: rgb(255 255 255 / 12%);

  /* Darker than --color-primary on purpose: white button text needs more
     contrast against a background than blue link text needs against the
     page background, so the button gets its own shade (6.6:1 with white,
     vs. --color-primary's 4.75:1 as text on the dark page background). */
  --color-button-bg: rgb(30 90 180);
  --color-button-bg-hover: rgb(45 110 200);

  --font-sans:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji',
    'Segoe UI Emoji';

  --content-width: 1100px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.5;
}

h1,
h2 {
  color: var(--color-heading);
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
}

p {
  margin: 0 0 1em;
}

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

a {
  color: var(--color-primary);
}

/* One consistent focus ring for every link/button, instead of leaving it to
   each browser's default (which vary). `:focus-visible` (not `:focus`) so
   it only shows for keyboard/switch navigation, not every mouse click. */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Visually hidden but still readable by screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Off-screen until focused (Tab), then jumps into view above everything
   else so keyboard/screen-reader users can bypass the header nav. */
.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 100;
  background: var(--color-button-bg);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0 0 8px 8px;
  transition: top 0.15s ease;
}

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

/* The skip-link target: focus lands here (via tabindex="-1") but doesn't
   need its own visible ring, since the skip link itself just had one. */
main:focus {
  outline: none;
}

.tagline {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-primary);
  margin: 0 0 0.5em;
}

.section {
  padding: 4rem 1.5rem;
}

.section-inner {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* Buttons */

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s ease;
}

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

.btn-primary:hover {
  background: var(--color-button-bg-hover);
}

.btn-secondary {
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-bg-raised);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-heading);
  text-decoration: none;
  margin-right: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  /* Smaller than it looks: each link's own padding (below) adds to this
     visually, so the apparent gap between links ends up close to 1.5rem. */
  gap: 0.5rem;
}

.site-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;
  /* Padding (not just the flex `gap`) so the tappable area meets the
     ~44px touch-target guideline, not just the visible text. */
  padding: 0.75rem 0.5rem;
}

.site-nav a:hover {
  color: var(--color-primary);
}

/* Mobile nav toggle button. Hidden by default: with no JS, `.js` is never
   added to <html> (see script.js), so this stays hidden and .site-nav
   below is always shown instead of a dead, unresponsive button. */

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  background: none;
  border: none;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-text);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

/* Morphs the three bars into an "X" when open — script.js keeps
   aria-expanded in sync, so that's also what drives the icon. */
.nav-toggle[aria-expanded='true'] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded='true'] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded='true'] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 700px) {
  /* The logo, CTA, and toggle now share the row (the nav links are what
     collapse), so they need less breathing room than on a wide screen. */
  .header-inner {
    gap: 0.75rem;
  }

  .js .nav-toggle {
    display: flex;
  }

  .js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    gap: 0.25rem;
  }

  .js .site-nav.open {
    display: flex;
  }
}

/* Hero */

.hero {
  padding: 3rem 1.5rem;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero-photo {
  width: 280px;
  max-width: 100%;
  margin: 1rem auto 2rem;
  border-radius: 12px;
}

.hero .subtitle {
  color: var(--color-text-muted);
  font-size: 1.15rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* About */

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

.about-photo {
  border-radius: 12px;
}

.feature-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.feature-list li {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  position: relative;
}

.feature-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 700;
}

@media (min-width: 800px) {
  .about-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Testimonials */

.testimonials {
  background: var(--color-bg-raised);
}

/* --color-primary is tuned for 4.75:1 against --color-bg (see :root comment),
   but --color-bg-raised is lighter, dropping .tagline's contrast to 4.32:1 —
   below the 4.5:1 AA minimum for its bold 14.4px text. Lighten just here. */
.testimonials .tagline {
  color: rgb(60 130 247);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.testimonial-card {
  /* Caps how wide a single card gets when it's alone in the grid (with 2+
     cards, the columns are already narrower than this, so it's a no-op). */
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
}

.testimonial-card p {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.testimonial-card footer {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* Contact CTA */

.cta {
  text-align: center;
}

.cta p {
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--color-text-muted);
}

.site-footer p {
  margin: 0.5rem 0 0;
}
