/* ---------------------------------------------------------------------------
   milesbernhard.com — site styles
   --------------------------------------------------------------------------- */

:root {
  --bg: #0a0c12;
  --bg-soft: #0e1118;
  --surface: #12161f;
  --surface-2: #171c27;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8ecf4;
  --muted: #9aa4b5;
  --faint: #6b7484;
  --accent-1: #a3e635;
  --accent-2: #34d399;
  --accent-3: #2dd4a8;
  --gradient: linear-gradient(120deg, var(--accent-1), var(--accent-2) 55%, var(--accent-3));
  --radius: 16px;
  --header-h: 68px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(163, 230, 53, 0.4); }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.wrap {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

/* ------------------------------------------------------------------ backdrop */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(163, 230, 53, 0.13), transparent 70%),
    var(--bg);
}

.backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  will-change: transform;
}

.blob-1 {
  width: 480px; height: 480px;
  top: -160px; left: -80px;
  background: radial-gradient(circle, rgba(163, 230, 53, 0.55), transparent 65%);
  animation: drift-1 26s ease-in-out infinite alternate;
}

.blob-2 {
  width: 420px; height: 420px;
  top: 10%; right: -120px;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.4), transparent 65%);
  animation: drift-2 32s ease-in-out infinite alternate;
}

.blob-3 {
  width: 380px; height: 380px;
  top: 55%; left: 30%;
  background: radial-gradient(circle, rgba(45, 212, 168, 0.28), transparent 65%);
  animation: drift-3 38s ease-in-out infinite alternate;
}

@keyframes drift-1 { to { transform: translate(90px, 70px) scale(1.15); } }
@keyframes drift-2 { to { transform: translate(-80px, 110px) scale(0.9); } }
@keyframes drift-3 { to { transform: translate(60px, -90px) scale(1.1); } }

/* -------------------------------------------------------------------- header */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background 0.35s, border-color 0.35s, backdrop-filter 0.35s;
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: rgba(10, 12, 18, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.logo-mark {
  width: 33px;
  height: 33px;
  flex: none;
  display: block;
  transition: transform 0.35s var(--ease-out);
}

.logo:hover .logo-mark { transform: translateY(-2px) rotate(-3deg); }

.logo em {
  font-style: normal;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  position: relative;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 999px;
  transition: color 0.25s, background 0.25s;
}

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

.site-nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.header-cta { flex-shrink: 0; }

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 10px;
  z-index: 110;
}

.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  margin: 5px 0;
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s;
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  /* Needs .site-header to outrank `.btn { display: inline-flex }`, which is
     declared later in this file at equal specificity. */
  .site-header .header-cta { display: none; }

  .site-nav {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    background: rgba(10, 12, 18, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .site-nav a { font-size: 22px; padding: 12px 24px; }

  body.nav-open .site-nav { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ------------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s, background 0.25s, border-color 0.25s;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--gradient);
  color: #0a0c12;
  box-shadow: 0 4px 24px rgba(163, 230, 53, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(163, 230, 53, 0.5);
}

.btn-ghost {
  border-color: var(--border-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.07);
}

.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ---------------------------------------------------------------------- hero */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 40px) 0 60px;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  align-items: center;
  gap: 56px;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--accent-2);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(44px, 7vw, 76px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

/* Name stacks one word per line */
.hero h1 span { display: block; }

.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-roles {
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 500;
  color: var(--muted);
  min-height: 1.6em;
  margin-bottom: 22px;
}

.hero-roles .rotator {
  color: var(--text);
  border-right: 2px solid var(--accent-2);
  padding-right: 3px;
  white-space: nowrap;
}

.hero-blurb {
  max-width: 52ch;
  color: var(--muted);
  margin-bottom: 34px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.social-row { display: flex; gap: 10px; }

.social-row a {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  transition: transform 0.25s var(--ease-out), color 0.25s, border-color 0.25s, background 0.25s;
}

.social-row a:hover {
  transform: translateY(-3px);
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.social-row svg { width: 18px; height: 18px; }

/* Portrait */
.hero-portrait { position: relative; justify-self: center; }

.portrait-frame {
  position: relative;
  width: min(320px, 70vw);
  aspect-ratio: 4 / 5;
  border-radius: 28px;
  overflow: hidden;
  animation: float 7s ease-in-out infinite;
}

.portrait-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.hero-portrait::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 31px;
  background: var(--gradient);
  filter: blur(22px);
  opacity: 0.4;
  z-index: -1;
  animation: float 7s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: bob 2.2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.7; }
  50% { transform: translate(-50%, 8px); opacity: 1; }
}

@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 40px; }
  .hero-portrait { grid-row: 1; }
  .portrait-frame { width: min(240px, 60vw); }
}

/* ------------------------------------------------------------------ sections */

section.block { padding: 110px 0; }

.section-head { margin-bottom: 48px; }

.section-head .eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 10px;
}

.section-head h2 {
  font-size: clamp(30px, 4.5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-head p.lede {
  margin-top: 14px;
  max-width: 60ch;
  color: var(--muted);
}

/* ------------------------------------------------------------------- reveals */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
  transition-delay: var(--d, 0s);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------------------ projects */

.pin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 820px) {
  .pin-grid, .project-grid { grid-template-columns: 1fr; }
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.35s, box-shadow 0.35s;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

/* pointer-tracking glow */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(163, 230, 53, 0.12), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  z-index: 1;
}

.card:hover::before { opacity: 1; }

.card > * { position: relative; z-index: 2; }

/* Pinned cards */
.card.pinned { border-color: rgba(163, 230, 53, 0.28); }

.card.pinned:hover {
  border-color: rgba(163, 230, 53, 0.55);
  box-shadow: 0 20px 60px rgba(163, 230, 53, 0.18);
}

.pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.pin-badge svg { width: 12px; height: 12px; }

.terminal-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.terminal-top .dot {
  width: 11px; height: 11px;
  border-radius: 50%;
}

.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.terminal-top .repo {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
}

.card-body { padding: 24px; }

.card-body .card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.card-body h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-body p {
  color: var(--muted);
  font-size: 14.5px;
  margin-bottom: 18px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tags span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
}

.card-links {
  display: flex;
  gap: 10px;
}

.card-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-2);
  transition: color 0.25s;
}

.card-links a:hover { color: var(--text); }
.card-links svg { width: 15px; height: 15px; }

/* image cards */
.card .shot {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.card .shot img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.card:hover .shot img { transform: scale(1.05); }

/* --------------------------------------------------------------------- about */

.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

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

.about-text p { color: var(--muted); margin-bottom: 16px; }
.about-text p strong { color: var(--text); font-weight: 600; }

.fact-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 24px;
}

.fact-list li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  font-size: 14.5px;
  border-bottom: 1px solid var(--border);
}

.fact-list li:last-child { border-bottom: 0; }
.fact-list .k { color: var(--faint); }
.fact-list .v { color: var(--text); font-weight: 500; text-align: right; }
.fact-list a.v:hover { color: var(--accent-2); }

/* -------------------------------------------------------------------- resume */

.resume-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 56px;
}

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

.resume-col h3 {
  font-size: 15px;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 26px;
}

.resume-col + .resume-col h3 { margin-top: 0; }

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-1), var(--accent-2), transparent);
  opacity: 0.5;
}

.t-item {
  position: relative;
  padding-bottom: 34px;
}

.t-item:last-child { padding-bottom: 0; }

.t-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent-2);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.5);
}

.t-item .t-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.t-item .t-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-3);
}

.t-item .t-org {
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.t-item h4 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.t-item p {
  font-size: 14px;
  color: var(--muted);
}

.skills-block { margin-bottom: 40px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chips span {
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  transition: border-color 0.25s, color 0.25s, transform 0.25s var(--ease-out);
}

.chips span:hover {
  border-color: var(--accent-1);
  color: var(--text);
  transform: translateY(-2px);
}

/* -------------------------------------------------------------- testimonials */

.testimonial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 820px) {
  .testimonial-grid { grid-template-columns: 1fr; }
}

.quote-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: transform 0.35s var(--ease-out), border-color 0.35s;
}

.quote-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
}

.quote-card .quote-mark {
  font-size: 40px;
  line-height: 1;
  font-family: Georgia, serif;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.quote-card blockquote {
  font-size: 14px;
  color: var(--muted);
  flex: 1;
}

.quote-card blockquote.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quote-more {
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
  cursor: pointer;
}

.quote-more:hover { color: var(--text); }

.quote-author {
  display: flex;
  align-items: center;
  gap: 14px;
}

.quote-author img {
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-strong);
}

.quote-author .who h4 { font-size: 15px; font-weight: 700; }
.quote-author .who span { font-size: 13px; color: var(--faint); }

/* -------------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 70px 0 40px;
  text-align: center;
}

.site-footer h2 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.site-footer .footer-lede {
  color: var(--muted);
  max-width: 46ch;
  margin: 0 auto 28px;
}

.site-footer .email-link {
  font-family: var(--font-mono);
  font-size: clamp(16px, 2.5vw, 20px);
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}

.site-footer .email-link:hover { filter: brightness(1.25); }

.footer-social {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 32px 0 40px;
}

.footer-bottom {
  font-size: 13px;
  color: var(--faint);
}

/* ------------------------------------------------------------ reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal { opacity: 1; transform: none; }
}
