/* =========================================================
   RYAN — PORTFOLIO
   Design thesis: the site's visual language is borrowed
   directly from the PageSpeed/Lighthouse report itself —
   score rings, the red/amber/green semantic scale, and
   monospace data readouts — because that report is the
   actual product being sold. Everything else stays quiet.
   ========================================================= */

/* ---------- Fonts (self-hosted, variable where available) ---------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/inter-var.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("assets/fonts/space-grotesk-var.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("assets/fonts/ibm-plex-mono-600.woff2") format("woff2");
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { margin: 0; padding: 0; list-style: none; }
img, picture, svg { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- Tokens ---------- */
:root {
  --ink: #14171a;
  --ink-raise: #191d21;
  --panel: #1b1f23;
  --panel-2: #23282d;
  --border: rgba(236, 234, 228, 0.09);
  --border-strong: rgba(236, 234, 228, 0.16);
  --paper: #ecece4;
  --muted: #9aa3a8;
  --muted-2: #899196;

  --pass: #33d17a;
  --pass-dim: rgba(51, 209, 122, 0.14);
  --warn: #ffb020;
  --warn-dim: rgba(255, 176, 32, 0.14);
  --fail: #ff6259;
  --fail-dim: rgba(255, 98, 89, 0.14);
  --pending: #5b6469;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --container: 1180px;
  --gutter: 1.25rem;
  --radius: 14px;
  --radius-sm: 8px;

  color-scheme: dark;
}

/* ---------- Base ---------- */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--paper);
}

p { color: var(--muted); max-width: 62ch; }

a { text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--pass);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pass);
  flex: none;
}

.section {
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--border);
}

.section-head {
  max-width: 46rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section-head h2 {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  margin-block: 0.6rem 0.9rem;
}
.section-head p { font-size: 1.05rem; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--pass);
  color: var(--ink);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  z-index: 100;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.85rem 1.3rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--pass);
  color: #06170d;
}
.btn-primary:hover { background: #47dd8b; }
.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--pass); color: var(--pass); }

/* ---------- Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 23, 26, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--paper);
}
.brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
}
.nav-links {
  display: none;
  align-items: center;
  gap: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.nav-links a {
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--paper); }
.nav-cta { display: none; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--paper);
}
.nav-toggle svg { width: 18px; height: 18px; }

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 1rem;
  padding-block: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}
.mobile-menu a { color: var(--muted); }
.mobile-menu.is-open { display: flex; }

@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; }
  .nav-toggle { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  padding-block: clamp(3rem, 9vw, 6rem) clamp(3rem, 7vw, 5rem);
}
.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  margin-block: 0.8rem 1.1rem;
}
.hero h1 em {
  font-style: normal;
  color: var(--pass);
}
.hero-sub {
  font-size: 1.08rem;
  max-width: 42ch;
  margin-bottom: 2rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.hero-proof {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.hero-proof-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 1.1rem;
}
.hero-proof-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.4rem;
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--border-strong);
}
.stat-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4em;
  white-space: nowrap;
}
.stat-chip b { color: var(--paper); font-weight: 600; }
.stat-chip .arrow { color: var(--muted-2); }
.stat-chip .after { color: var(--pass); font-weight: 600; }

@media (min-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 3.5rem;
  }
}

/* ---------- Score ring component ----------
   Semantics match the real PageSpeed legend:
   0–49 fail / 50–89 warn / 90–100 pass.
------------------------------------------------ */
.ring-pair {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.ring {
  position: relative;
  width: 92px;
  height: 92px;
  flex: none;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle {
  fill: none;
  stroke-width: 9;
}
.ring .track { stroke: var(--border-strong); }
.ring .value {
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}
.ring.in-view .value { stroke-dashoffset: var(--dash); }
.ring.pass .value { stroke: var(--pass); }
.ring.warn .value { stroke: var(--warn); }
.ring.fail .value { stroke: var(--fail); }
.ring.pending .value { stroke: var(--pending); stroke-dasharray: 6 8; stroke-dashoffset: 0; }

.ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--paper);
}
.ring.pending .ring-num { color: var(--muted-2); font-size: 1.1rem; }

.ring-caption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
  margin-top: 0.5rem;
}

.ring-arrow {
  color: var(--muted-2);
  font-size: 1.3rem;
  flex: none;
}

/* ---------- Case studies ---------- */
.case-grid {
  display: grid;
  gap: 1.75rem;
}
.case-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.case-media {
  background: linear-gradient(160deg, var(--panel-2), var(--ink-raise));
  padding: 1.5rem 1.5rem 0;
  display: flex;
  justify-content: center;
}
.phone-frame {
  width: 150px;
  border-radius: 18px;
  border: 4px solid #0d0f11;
  background: #0d0f11;
  overflow: hidden;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,0.6);
}
.phone-frame img { width: 100%; height: auto; display: block; }

.case-body {
  padding: 1.6rem 1.6rem 1.9rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  flex: 1;
}
.case-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.case-body h3 {
  font-size: 1.35rem;
}
.case-status {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn);
  border: 1px solid var(--warn-dim);
  background: var(--warn-dim);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.case-status.is-live {
  color: var(--pass);
  border-color: var(--pass-dim);
  background: var(--pass-dim);
}

.case-field { display: flex; flex-direction: column; gap: 0.3rem; }
.case-field-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.case-field p { font-size: 0.94rem; max-width: none; }

.case-proof {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding-block: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.case-proof-primary {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.case-proof-primary .ring { width: 76px; height: 76px; }
.case-proof-primary .ring-num { font-size: 1.25rem; }
.case-proof-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted-2);
  line-height: 1.5;
}
.case-proof-meta b { color: var(--paper); }

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}
.mini-stat {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.mini-stat .dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex: none;
}
.mini-stat .dot.pass { background: var(--pass); }
.mini-stat .dot.warn { background: var(--warn); }
.mini-stat b { color: var(--paper); font-weight: 600; }
.mini-stat .after { color: var(--pass); font-weight: 600; }

.case-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: auto;
}
.case-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 2px;
}
.case-link:hover { color: var(--pass); border-color: var(--pass); }

.note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted-2);
  font-style: normal;
}

@media (min-width: 700px) {
  .case-media { padding: 2rem 2rem 0; }
  .phone-frame { width: 170px; }
}

@media (min-width: 1024px) {
  .case-card { flex-direction: row; }
  .case-media { flex: 0 0 240px; align-items: flex-start; padding: 2.25rem 1.5rem; }
  .case-body { flex: 1; }
}

/* ---------- Personal projects ---------- */
.project-grid {
  display: grid;
  gap: 1.75rem;
}
.project-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.browser-frame {
  background: var(--ink-raise);
  border-bottom: 1px solid var(--border);
}
.browser-chrome {
  display: flex;
  gap: 6px;
  padding: 0.7rem 0.9rem;
}
.browser-chrome span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border-strong);
}
.browser-frame img { width: 100%; height: auto; }

.project-body {
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.project-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.project-body h3 { font-size: 1.3rem; }
.project-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.project-tag.live {
  color: var(--pass);
  background: var(--pass-dim);
  border: 1px solid var(--pass-dim);
}
.project-tag.dev {
  color: var(--warn);
  background: var(--warn-dim);
  border: 1px solid var(--warn-dim);
}
.stack-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.stack-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

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

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: 2.5rem;
}
.about-copy p {
  font-size: 1.02rem;
  max-width: 60ch;
  margin-bottom: 1.1rem;
}
.about-copy p:last-child { margin-bottom: 0; }
.about-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  align-content: start;
}
.fact dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.3rem;
}
.fact dd {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--paper);
}

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

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  gap: 1.5rem;
}
.service-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}
.service-panel h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}
.service-panel.in h3 { color: var(--pass); }
.service-panel.out h3 { color: var(--muted); }
.service-list { display: flex; flex-direction: column; gap: 0.9rem; }
.service-list li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  font-size: 0.96rem;
  color: var(--paper);
}
.service-list li span.mark {
  font-family: var(--font-mono);
  color: var(--pass);
  flex: none;
  margin-top: 0.15em;
}
.service-panel.out .service-list li span.mark { color: var(--muted-2); }
.service-list li p { color: var(--muted); font-size: 0.88rem; margin-top: 0.2rem; }

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

/* ---------- Contact ---------- */
.contact-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.75rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.contact-panel h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.contact-methods {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.contact-method {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  min-width: 0;
}
.contact-method .k {
  color: var(--muted-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  width: 4.5rem;
  flex: none;
}
.contact-method a {
  color: var(--paper);
  border-bottom: 1px solid var(--border-strong);
  overflow-wrap: anywhere;
  min-width: 0;
}
.contact-method a:hover { color: var(--pass); border-color: var(--pass); }

@media (min-width: 700px) {
  .contact-methods { flex-direction: row; gap: 2.5rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
}
.footer-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted-2);
}
@media (min-width: 700px) {
  .footer-row { flex-direction: row; justify-content: space-between; align-items: center; }
}
