/* ===== Jai Lowry — personal site ===== */

:root {
  --bg: #f4f1ea;
  --bg-alt: #ffffff;
  --ink: #14171a;
  --body: #3a3a40;
  --muted: #71717a;
  --accent: #0e7c6b;
  --accent-dark: #0a5c4f;
  --border: #e1dacb;
  --radius: 14px;
  --max: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3, h4 {
  font-family: "Newsreader", Georgia, serif;
  color: var(--ink);
  margin: 0 0 0.4em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a { color: var(--ink); text-decoration: none; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
}

.eyebrow {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
  color: var(--accent-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

section { padding: 96px 0; }
section + section { border-top: 1px solid var(--border); }

/* ---- Nav ---- */
header.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 241, 234, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-inner .brand {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}

.nav-links {
  display: flex;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 0.92rem;
  color: var(--body);
  font-weight: 500;
}

.nav-links a:hover { color: var(--accent-dark); }

.nav-links a.active {
  color: var(--accent-dark);
}

.nav-links a {
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-toggle { display: none; }

/* ---- Hero ---- */
.hero {
  padding-top: 120px;
  padding-bottom: 90px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 760px 480px at 12% -12%, rgba(14, 124, 107, 0.20), transparent 60%),
    radial-gradient(ellipse 620px 520px at 105% 15%, rgba(20, 23, 26, 0.10), transparent 60%);
}

.hero-copy .eyebrow,
.hero-copy h1,
.hero-copy .role-line,
.hero-copy .lede,
.hero-copy .btn-row {
  opacity: 0;
  transform: translateY(18px);
  animation: heroIn 0.7s ease forwards;
}

.hero-copy .eyebrow { animation-delay: 0.05s; }
.hero-copy h1 { animation-delay: 0.15s; }
.hero-copy .role-line { animation-delay: 0.25s; }
.hero-copy .lede { animation-delay: 0.35s; }
.hero-copy .btn-row { animation-delay: 0.45s; }

.hero-photo {
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  animation: heroIn 0.8s ease forwards;
  animation-delay: 0.2s;
}

@keyframes heroIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-inner {
  display: grid;
  grid-template-columns: 0.62fr 1fr;
  gap: 64px;
  align-items: center;
}

.hero h1 {
  font-size: 3.6rem;
  font-style: italic;
  line-height: 1.05;
  margin-bottom: 18px;
  color: var(--ink);
}

.hero .role-line {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 28px;
}

.hero .lede {
  font-size: 1.1rem;
  color: var(--body);
  max-width: 46ch;
  margin-bottom: 34px;
}

.btn-row { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid var(--ink);
  transition: all 0.15s ease;
}

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover {
  background: #0a0c0e;
  box-shadow: 0 10px 26px -8px rgba(14, 124, 107, 0.55);
  transform: translateY(-2px);
}

.btn-outline { background: transparent; color: var(--ink); }
.btn-outline:hover {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 26px -10px rgba(20, 23, 26, 0.5);
  transform: translateY(-2px);
}

.hero-photo-wrap {
  position: relative;
  max-width: 340px;
}

.hero-photo-wrap::before {
  content: "";
  position: absolute;
  top: -18px;
  left: -18px;
  right: 18px;
  bottom: 18px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  z-index: 0;
}

.headshot-frame {
  position: relative;
  z-index: 1;
  aspect-ratio: 1 / 1.15;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(155deg, #eae5d8, #dcd4c0);
  box-shadow: 0 24px 48px -20px rgba(20, 23, 26, 0.35);
  border: 1px solid var(--border);
}

.headshot-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 8%;
  display: block;
}

/* ---- Logo strip ---- */
.logo-strip {
  padding: 44px 0;
  border-top: 1px solid var(--border);
}

.logo-strip-label {
  display: block;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 26px;
}

.logo-strip-viewport {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.logo-strip-row {
  display: flex;
  align-items: center;
  gap: 56px;
  width: max-content;
  animation: marquee 26s linear infinite;
}

.logo-strip-viewport:hover .logo-strip-row {
  animation-play-state: paused;
}

.logo-strip-row img {
  height: 34px;
  width: auto;
  flex-shrink: 0;
  opacity: 0.55;
  filter: grayscale(1);
  transition: opacity 0.25s ease, filter 0.25s ease, transform 0.25s ease;
}

.logo-strip-row img:hover {
  opacity: 1;
  filter: grayscale(0);
  transform: translateY(-2px);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---- Reveal on scroll ---- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

.stats-band .reveal:nth-child(2) { transition-delay: 0.06s; }
.stats-band .reveal:nth-child(3) { transition-delay: 0.12s; }
.stats-band .reveal:nth-child(4) { transition-delay: 0.18s; }
.stats-band .reveal:nth-child(5) { transition-delay: 0.24s; }
.stats-band .reveal:nth-child(6) { transition-delay: 0.30s; }

.ref-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.ref-grid .reveal:nth-child(3) { transition-delay: 0.16s; }

.contact-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.contact-grid .reveal:nth-child(3) { transition-delay: 0.16s; }

/* ---- Stats band (full-bleed, dark) ---- */
.stats-band {
  background: var(--ink);
  padding: 64px 0;
}

.stats-band .wrap {
  display: flex;
  flex-wrap: wrap;
}

.stat-item {
  flex: 1 1 0;
  min-width: 150px;
  padding: 8px 28px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  text-align: center;
}

.stat-item:first-child { border-left: none; }

.stat-item .num {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 2.1rem;
  color: #fff;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.stat-item .label {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.03em;
}

/* ---- About ---- */
.about-grid {
  max-width: 74ch;
}

.about-grid p { font-size: 1.1rem; }

/* ---- Video ---- */
.video-frame {
  position: relative;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 48px -22px rgba(20, 23, 26, 0.3);
  border: 1px solid var(--border);
  aspect-ratio: 16/9;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ---- Story ---- */
.story p { max-width: 68ch; font-size: 1.05rem; }
.story p + p { margin-top: 1.1em; }

/* ---- Experience ---- */
.timeline {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.job {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 30px 28px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.job:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 34px -20px rgba(20, 23, 26, 0.35);
  border-color: var(--accent);
}

.job-index {
  position: absolute;
  top: -6px;
  right: 12px;
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 4.5rem;
  font-weight: 600;
  color: var(--border);
  z-index: 0;
  line-height: 1;
  user-select: none;
}

.job-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.job-logo {
  height: 38px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
  display: block;
}

.job-dates {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.job-body { position: relative; z-index: 1; }

.job-title {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.job ul {
  margin: 0;
  padding-left: 20px;
}

.job li { margin-bottom: 10px; }
.job li:last-child { margin-bottom: 0; }

/* ---- Case Studies ---- */
.case-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.case-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.case-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.35s ease;
}

.case-card.open::before {
  transform: scaleY(1);
}

.case-card.open {
  border-color: var(--accent);
  box-shadow: 0 18px 36px -22px rgba(20, 23, 26, 0.3);
}

.case-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.case-toggle-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.case-logo {
  height: 34px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
}

.case-toggle h3 {
  margin: 0 0 3px;
  font-size: 1.12rem;
}

.case-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.case-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.3s ease, color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.case-card.open .case-chevron {
  transform: rotate(45deg);
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.case-toggle:hover .case-chevron {
  border-color: var(--accent);
}

.case-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.case-body-inner {
  padding: 0 26px 30px;
  border-top: 1px solid var(--border);
}

.case-body-inner p {
  margin: 20px 0 0;
}

.case-body-inner p:first-child { margin-top: 22px; }

.case-chart-wrap {
  margin: 22px 0 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 18px 10px;
}

.case-results {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 22px;
}

.case-result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 170px;
}

.case-result .num {
  display: block;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 700;
  color: var(--ink);
  font-size: 1.3rem;
}

.case-result .label {
  font-size: 0.8rem;
  color: var(--muted);
}

.case-table-wrap {
  margin: 22px 0 0;
  overflow-x: auto;
}

.case-table-hint {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 560px;
}

.case-table th, .case-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.case-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.case-table th:hover { color: var(--accent-dark); }

.case-table th .sort-arrow {
  display: inline-block;
  margin-left: 5px;
  width: 8px;
  opacity: 0.35;
}

.case-table th .sort-arrow::after { content: "↕"; }

.case-table th.is-sorted { color: var(--accent-dark); }
.case-table th.is-sorted .sort-arrow { opacity: 1; }
.case-table th.is-sorted[data-dir="asc"] .sort-arrow::after { content: "↑"; }
.case-table th.is-sorted[data-dir="desc"] .sort-arrow::after { content: "↓"; }

.case-table tbody tr {
  transition: background 0.2s ease;
}

.case-table tbody tr:hover { background: var(--bg); }

.metric-cell { font-weight: 600; color: var(--ink); }
.metric-note { font-weight: 400; color: var(--muted); font-size: 0.82em; }

.bar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.bar-track {
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  min-width: 60px;
}

.bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  font-size: 0.88rem;
}

.delta-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-dark);
  background: rgba(14, 124, 107, 0.15);
  border: 1px solid rgba(14, 124, 107, 0.35);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.evidence-frame {
  margin: 22px 0 0;
  padding: 28px 24px;
  background: linear-gradient(160deg, #14171a, #0a0c0e);
  border-radius: 16px;
  text-align: center;
}

.evidence-label {
  display: inline-block;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(14, 124, 107, 0.15);
  border: 1px solid rgba(14, 124, 107, 0.4);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
  font-weight: 600;
}

.phone-frame {
  max-width: 260px;
  margin: 0 auto;
  border-radius: 26px;
  overflow: hidden;
  border: 6px solid #22262f;
  box-shadow: 0 24px 48px -18px rgba(0, 0, 0, 0.5);
}

.phone-frame img {
  width: 100%;
  display: block;
}

.evidence-caption {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.86rem;
  margin: 20px auto 0;
  max-width: 46ch;
}

/* ---- Education ---- */
.edu-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
}

.edu-logo {
  height: 40px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
}

/* ---- References ---- */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.ref-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.ref-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 34px -20px rgba(20, 23, 26, 0.35);
  border-color: var(--accent);
}

.ref-card blockquote {
  margin: 0 0 18px;
  font-size: 0.98rem;
  color: var(--body);
  font-style: italic;
}

.ref-card .who { font-weight: 700; color: var(--ink); font-size: 0.95rem; }
.ref-card .role { color: var(--muted); font-size: 0.85rem; }

/* ---- CV ---- */
.cv-card {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.cv-card h2, .cv-card p { color: #fff; }
.cv-card p { color: rgba(255,255,255,0.75); margin-bottom: 0; }

.cv-card .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.cv-card .btn-primary:hover { background: #14a88f; }

/* ---- Contact ---- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 36px;
}

.contact-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.contact-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 34px -20px rgba(20, 23, 26, 0.35);
  border-color: var(--accent);
}

.contact-item .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.contact-item a { font-weight: 600; font-size: 1.02rem; }
.contact-item a:hover { color: var(--accent-dark); }

footer {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-photo-wrap { max-width: 260px; margin: 0 auto 12px; }
  .stat-item { flex: 1 1 45%; border-left: none; border-top: 1px solid rgba(255, 255, 255, 0.14); padding: 16px 12px; margin-top: 12px; }
  .stat-item:nth-child(-n+2) { border-top: none; margin-top: 0; }
  .ref-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
  .edu-card { grid-template-columns: 1fr; gap: 14px; }
  .job-index { font-size: 3.2rem; }
  .nav-links { display: none; }
  .hero h1 { font-size: 2.4rem; }
  section { padding: 64px 0; }
  .cv-card { flex-direction: column; align-items: flex-start; }
  .logo-strip-row { gap: 32px; }
  .logo-strip-row img { height: 26px; }
  .case-toggle { padding: 18px; }
  .case-toggle-left { gap: 12px; }
  .case-logo { height: 26px; }
  .case-body-inner { padding: 0 18px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .logo-strip-row { animation: none; }
}
