/* christopherstaats.com — hand-written, no frameworks, no build step.
   Order: tokens → reset/base → utilities → header → hero → projects/preview
   cards/badges/tags → skills → about → contact/form → footer → reveal
   animation → media query → reduced-motion block. */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light dark;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #ffffff;
  --surface: #f5f6f8;
  --border: #e3e5ea;
  --text: #181a1f;
  --muted: #52565e;                 /* 7:1 on white */
  --accent: #0b5ed7;                /* 5.8:1 on white */
  --accent-contrast: #ffffff;       /* text on filled accent elements */
  --header-bg: rgba(255, 255, 255, 0.88);

  --badge-live-bg: #e7f6ec;  --badge-live-text: #116329;   /* Live on App Store */
  --badge-ship-bg: #e8f0fe;  --badge-ship-text: #0b5ed7;   /* Shipped */
  --badge-dev-bg:  #fdf3d7;  --badge-dev-text:  #8a6100;   /* In Development */

  --success-text: #116329;
  --error-text: #b42318;
  --radius-card: 0.75rem;
  --radius-control: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --border: #2b2f38;
    --text: #e9ebee;
    --muted: #9ba1ab;               /* ~7:1 on #0f1115 */
    --accent: #79b8ff;              /* ~9:1 on #0f1115 */
    --accent-contrast: #0d1b2a;
    --header-bg: rgba(15, 17, 21, 0.88);

    --badge-live-bg: #12261a; --badge-live-text: #57ab5a;
    --badge-ship-bg: #16283f; --badge-ship-text: #79b8ff;
    --badge-dev-bg:  #2d2413; --badge-dev-text:  #d29922;

    --success-text: #57ab5a;
    --error-text: #ff7b72;
  }
}

/* ---------- Reset/base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.75rem; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

html { scroll-padding-top: 6.5rem; }

/* ---------- Utilities ---------- */
.container { width: min(100% - 2.5rem, 68rem); margin-inline: auto; }
section { padding-block: clamp(3.5rem, 8vw, 6rem); scroll-margin-top: 6.5rem; }
.section-lede { color: var(--muted); max-width: 42rem; }
.eyebrow { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 0.75rem; left: 0.75rem; z-index: 100;
  background: var(--bg); color: var(--accent); padding: 0.5rem 1rem;
  border: 2px solid var(--accent); border-radius: var(--radius-control);
}
.hidden-field { position: absolute !important; left: -9999px !important; } /* honeypot */

/* ---------- Header/nav (always visible, wraps — no toggle) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .site-header {
    background: var(--header-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
}
.site-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; padding-block: 0.9rem; }
.site-nav__name { font-weight: 700; color: var(--text); text-decoration: none; }
.site-nav__name:hover { text-decoration: none; color: var(--accent); }
.site-nav__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
/* inline-block + vertical padding = ~45px tall tap targets (Apple HIG 44px minimum) */
.site-nav__links a { display: inline-block; padding: 0.65rem 0.25rem; text-decoration: none; color: var(--muted); }
.site-nav__links a:hover, .site-nav__links a[aria-current="true"] { color: var(--accent); text-decoration: underline; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(4rem, 12vw, 8rem); }
.hero h1 { font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.4rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; max-width: 24ch; }
.hero__lede { color: var(--muted); font-size: 1.125rem; max-width: 38rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: 0.6rem 1.1rem; border-radius: var(--radius-control); border: 1px solid var(--border); color: var(--text); background: transparent; text-decoration: none; font: inherit; font-weight: 600; }
.btn:hover:not(:disabled) { background: var(--surface); }              /* real tint, both themes */
.btn:active:not(:disabled) { transform: translateY(1px); }             /* pressed state */
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover:not(:disabled) { background: var(--accent); filter: brightness(0.92); }

/* ---------- Projects grid + cards ---------- */
.projects-grid { display: grid; gap: 1.5rem; margin-top: 2rem; }
.project { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.5rem; }
.project__eyebrow { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); margin: 0 0 0.5rem; }
.project__heading { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.project__heading h3 { margin: 0; }               /* 1.2rem from the base h3 rule */
.project__heading a { color: inherit; text-decoration: none; }
.project__heading a:hover { color: var(--accent); text-decoration: underline; }
.project__hook { font-weight: 600; margin-bottom: 0.5rem; }
.project__body > p:last-of-type { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 1rem 0 0; padding: 0; }
.tags li { font-family: var(--font-mono); font-size: 0.75rem; padding: 0.2rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }

/* ---------- Project preview cards (URL/link-preview style) ---------- */
/* Whole card is one link to the live product page. Artwork is self-hosted in
   assets/previews/ — the CSP (img-src 'self') forbids hotlinking. */
.preview-card {
  display: flex; flex-direction: column; margin-bottom: 1.25rem;
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--bg); overflow: hidden;
  color: inherit; text-decoration: none;
}
.preview-card:hover { border-color: var(--accent); }
/* Shot area stays white in BOTH themes on purpose: the artwork comes from
   light-provenance sources (App Store icons; the FileComb logo has black
   lettering) and would vanish on a dark surface. */
.preview-card__shot {
  display: grid; place-items: center;
  aspect-ratio: 16 / 10; padding: 1.25rem;
  background: #ffffff;
}
.preview-card__shot img { max-width: 100%; max-height: 100%; width: auto; height: auto; }
/* App icons get the ~22% corner radius Apple applies on-device. */
.preview-card--icon .preview-card__shot img { width: clamp(88px, 45%, 150px); border-radius: 22.5%; }
.preview-card__meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.25rem 0.75rem; flex-wrap: wrap;
  padding: 0.65rem 0.9rem; border-top: 1px solid var(--border);
}
.preview-card__domain { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.preview-card__cta { font-size: 0.8125rem; font-weight: 600; color: var(--accent); }
.preview-card:hover .preview-card__cta { text-decoration: underline; }

/* ---------- Case-study pages (/projects/<slug>/) ---------- */
.case { padding-block: clamp(3rem, 7vw, 5rem); }
.case__container { width: min(100% - 2.5rem, 46rem); margin-inline: auto; }
.case h1 { font-size: clamp(2rem, 1.4rem + 2.8vw, 3rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; margin-bottom: 1rem; }
.case__lede { color: var(--muted); font-size: 1.125rem; }
.case__media { margin: 2rem 0 0; }
.case__media .preview-card { margin-bottom: 0; max-width: 26rem; margin-inline: auto; }
.case h2 { margin-top: 2.5rem; }
.case__tags { margin: 1.5rem 0 0; }
.case__cta { margin-top: 3rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.5rem; }
.case__cta h2 { margin-top: 0; font-size: 1.2rem; }
.case__cta p { color: var(--muted); margin-bottom: 1.25rem; }
.case__next { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.badge--live { background: var(--badge-live-bg); color: var(--badge-live-text); }
.badge--ship { background: var(--badge-ship-bg); color: var(--badge-ship-text); }
.badge--dev  { background: var(--badge-dev-bg);  color: var(--badge-dev-text); }

/* ---------- Skills ---------- */
.skills-grid { display: grid; gap: 1.5rem; margin-top: 2rem; }
.skill-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.5rem; }
.skill-card h3 { margin-bottom: 0.5rem; }
.skill-card p { color: var(--muted); margin: 0; }

/* ---------- About ---------- */
.about__text p { max-width: 46rem; font-size: 1.0625rem; }

/* ---------- Contact/form ---------- */
.contact-grid { display: grid; gap: 2.5rem; margin-top: 2rem; }
.profiles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.form-row { margin-bottom: 1.1rem; }
.form-row label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; }
.form-row input, .form-row textarea {
  width: 100%; padding: 0.65rem 0.75rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-control);
}
.form-row textarea { resize: vertical; min-height: 8rem; }
/* Invalid styling only AFTER the user has interacted (:user-invalid), never while
   typing a fresh field. Older browsers without :user-invalid simply keep native
   required/type=email bubbles — that plus the status region is the honest minimum. */
.form-row input:user-invalid, .form-row textarea:user-invalid { border-color: var(--error-text); }
.form-status { margin: 1rem 0 0; font-weight: 600; }
.form-status:empty { margin: 0; }   /* NEVER display:none — a live region removed from the
                                        accessibility tree can miss announcements; keep it in
                                        the tree from load, just neutralize spacing when empty */
.form-status.is-success { color: var(--success-text); }
.form-status.is-error { color: var(--error-text); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; }
.site-footer p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- Reveal animation — two-stage gate (no-JS and broken-JS safe) ---------- */
/* Content is hidden ONLY when <html> has BOTH .js (inline head script ran)
   AND .reveal-ready (main.js armed the IntersectionObserver).
   If main.js never loads or throws, the class pair never completes
   (or is removed by the catch), so nothing is ever stuck invisible. */
.js.reveal-ready [data-reveal] { opacity: 0; transform: translateY(0.6rem); }
.js.reveal-ready [data-reveal].is-revealed { opacity: 1; transform: none; }

/* ---------- Single breakpoint: 48em ---------- */
@media (min-width: 48em) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .project--featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.15fr 1fr; gap: 2rem; align-items: center; padding: 2rem; }
  .project--featured .preview-card { margin-bottom: 0; }
  .project--featured .project__heading h3 { font-size: 1.6rem; }   /* intentional featured override */
  .project--featured .project__hook { font-size: 1.15rem; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr 1.4fr; }
}

/* ---------- Reveal transition (motion allowed only) ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .js.reveal-ready [data-reveal] { transition: opacity 0.5s ease, transform 0.5s ease; }
}

/* ---------- Global reduced-motion kill-switch ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
