/* ==========================================================================
   Lab IV — Base + components
   Imports tokens.css. Plain CSS, no build step required.
   ========================================================================== */

@import url("tokens.css");

/* IBM Plex Sans + IBM Plex Mono (both open source) from Google Fonts.
   IBM Plex Sans is the brand font for everything; the build agent should
   self-host these for production so the static build has no runtime font dep. */
@import url("fonts.css");

/* ---- Reset ------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

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

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

/* ---- Typography -------------------------------------------------------- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  text-wrap: balance;
}

.display {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
}

h1, .h1 { font-size: var(--text-h1); line-height: var(--leading-snug); letter-spacing: var(--tracking-heading); }
h2, .h2 { font-size: var(--text-h2); line-height: var(--leading-snug); letter-spacing: var(--tracking-heading); }
h3, .h3 { font-size: var(--text-h3); line-height: var(--leading-snug); font-weight: var(--weight-semibold); }

.lead {
  font-size: var(--text-lead);
  line-height: 1.5;
  color: var(--color-muted);
}

p { max-width: 60ch; }

.eyebrow {
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-muted);
}

/* The single highlighted word in a headline. */
.accent { color: var(--color-accent); }

.muted { color: var(--color-muted); }

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

.container--narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-pad-y); }
.section--surface { background: var(--color-surface); }
.section--tint { background: var(--color-accent-tint); }

/* Editorial hairline rule between consecutive same-colour sections, so the
   page reads as stacked bands instead of relying on big empty gaps. */
.section + .section:not(.section--surface):not(.section--dark):not(.section--tint) { border-top: var(--border-hairline); }

.section-head { margin-bottom: var(--space-8); }
.section-head .eyebrow { margin-bottom: var(--space-3); }
.section-head h2 { max-width: 18ch; }
.section-head p { margin-top: var(--space-4); max-width: var(--container-narrow); }

/* Split section header: monospace index on the left, heading on the right.
   This editorial / data-sheet rhythm is the main thing that pulls the design
   away from the generic centred-hero template. */
.section-head--split {
  display: grid;
  grid-template-columns: minmax(0, 7rem) 1fr;
  gap: var(--space-6);
  align-items: start;
  padding-top: var(--space-6);
  border-top: 2px solid var(--color-text);
}
.section--dark .section-head--split { border-top-color: #fff; }
@media (max-width: 680px) {
  .section-head--split { grid-template-columns: 1fr; gap: var(--space-3); }
}

/* Monospace index label, e.g. "(02)" */
.index {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  letter-spacing: 0.02em;
  font-feature-settings: "tnum" 1;
}

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-8); }

/* ---- Dark section (reversed palette) ----------------------------------- */
.section--dark {
  background: var(--color-dark-bg);
  color: var(--color-dark-text);
}
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--color-dark-text); }
.section--dark .lead, .section--dark .muted, .section--dark p { color: var(--color-dark-muted); }
.section--dark .eyebrow { color: var(--color-dark-muted); }
.section--dark .accent { color: var(--color-accent-on-dark); }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  line-height: 1;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--duration) var(--ease),
              border-color var(--duration) var(--ease),
              color var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--color-accent); color: #fff; }
.btn--primary:hover { background: var(--color-accent-hover); color: #fff; }

.btn--secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}
.btn--secondary:hover { background: var(--color-text); color: #fff; }

.section--dark .btn--secondary { color: #fff; border-color: rgba(255,255,255,0.5); }
.section--dark .btn--secondary:hover { background: #fff; color: var(--color-text); }

/* ---- Header / Nav ------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: var(--border-hairline);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  height: 5rem;
}
.nav__logo { display: flex; align-items: center; }
.nav__logo img { height: 2.5rem; width: auto; transition: transform var(--duration) var(--ease); }
.nav__logo:hover img { transform: rotate(-8deg); }
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  padding: 0;
}
.nav__links a {
  color: var(--color-muted);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
}
.nav__links a:hover { color: var(--color-text); }
@media (max-width: 760px) {
  .nav__links { display: none; }
}

/* ---- Hero -------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3.5rem, 2rem + 8vw, 7rem);
}
.hero .container { position: relative; z-index: 1; }
.hero .display { margin-bottom: var(--space-6); max-width: 16ch; }
.hero .lead { margin-bottom: var(--space-8); max-width: 44ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); }

/* Oversized logomark bleeding off the right edge — a quiet brand motif that
   makes the hero distinctive without adding colour or noise. */
.hero__mark {
  position: absolute;
  top: 50%;
  right: clamp(-12rem, -8vw, -4rem);
  transform: translateY(-50%);
  width: clamp(20rem, 38vw, 34rem);
  opacity: 0.05;
  z-index: 0;
  pointer-events: none;
}
@media (max-width: 760px) { .hero__mark { opacity: 0.04; right: -8rem; } }

/* ---- Stats row --------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
  padding-block: var(--space-12);
  border-top: var(--border-hairline);
  border-bottom: var(--border-hairline);
}
.stat__num {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem);
  letter-spacing: var(--tracking-display);
  color: var(--color-accent);
  line-height: 1;
}
.stat__label { margin-top: var(--space-2); color: var(--color-muted); font-size: var(--text-small); }
@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr; gap: var(--space-6); text-align: left; }
}

/* ---- Challenge cards (3-up) -------------------------------------------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }

/* 4-item grid: 2×2 on desktop (preferred), 1-up on mobile. Used by Challenges. */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
}
@media (max-width: 640px) { .grid-4 { grid-template-columns: 1fr; } }

.challenge h3 { color: var(--color-accent); margin-bottom: var(--space-3); }
.challenge__q { font-weight: var(--weight-semibold); margin-bottom: var(--space-2); }

/* ---- Service / package card -------------------------------------------- */
.package {
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-8);
  background: var(--color-bg);
  height: 100%;
}
/* Featured = flat with a solid accent top bar (no soft drop shadow). */
.package--featured {
  border-color: var(--color-text);
  border-top: 4px solid var(--color-accent);
}
.package__price {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  font-size: var(--text-h3);
  margin-bottom: var(--space-2);
}
.package ul { list-style: none; padding: 0; margin-top: var(--space-6); }
.package li { padding-left: 1.5rem; position: relative; margin-top: var(--space-3); color: var(--color-muted); }
.package li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55em;
  width: 0.5rem; height: 0.5rem;
  background: var(--color-accent);
  border-radius: 2px;
}

/* ---- Case study cards -------------------------------------------------- */
.case {
  border-top: 2px solid var(--color-text);
  padding-top: var(--space-6);
}
.case__company { font-weight: var(--weight-semibold); }
.case__desc { color: var(--color-muted); margin-top: var(--space-2); }
.case ul { list-style: none; padding: 0; margin-top: var(--space-4); }
.case li { padding-left: 1.5rem; position: relative; margin-top: var(--space-3); }
.case li::before {
  content: "→";
  position: absolute; left: 0;
  color: var(--color-accent);
  font-weight: var(--weight-bold);
}

/* ---- About / portrait -------------------------------------------------- */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 20rem) 1fr;
  gap: var(--space-12);
  align-items: start;
}
@media (max-width: 760px) {
  .about__grid { grid-template-columns: 1fr; gap: var(--space-8); }
}

/* Portrait frame. Drop the real photo in as <img>; the placeholder shows
   until the content agent / Ilya picks the final image. */
.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--color-surface);
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: var(--space-2);
  text-align: center;
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: var(--text-small);
}
.portrait__ph img { width: 3.5rem; height: auto; opacity: 0.18; }

.about__body .lead { margin-bottom: var(--space-6); }
.about__body p + p { margin-top: var(--space-4); }

/* Credibility facts — a compact data list in the editorial style. */
.facts { margin-top: var(--space-8); border-top: 2px solid var(--color-text); }
.facts div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-6);
  padding: var(--space-3) 0;
  border-bottom: var(--border-hairline);
}
.facts dt { font-family: var(--font-mono); font-size: var(--text-small); color: var(--color-muted); }
.facts dd { font-weight: var(--weight-semibold); text-align: right; }

/* ---- Testimonials ------------------------------------------------------ */
.testimonial {
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: var(--space-8);
  background: var(--color-bg);
  height: 100%;
}
.testimonial blockquote { font-size: var(--text-lead); line-height: 1.5; }
.testimonial__person { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-6); }
.testimonial__avatar {
  width: 3rem; height: 3rem; border-radius: var(--radius-pill);
  background: var(--color-accent-tint); flex: none;
}
.testimonial__name { font-weight: var(--weight-semibold); font-size: var(--text-small); }
.testimonial__role { color: var(--color-muted); font-size: var(--text-small); }

/* ---- Process timeline -------------------------------------------------- */
.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-8); }
@media (max-width: 860px) { .timeline { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .timeline { grid-template-columns: 1fr; } }
.step__num {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  color: var(--color-accent-tint);
  font-size: 2.5rem;
  line-height: 1;
}
.section--dark .step__num { color: var(--color-dark-line); }
.step h3 { margin: var(--space-3) 0 var(--space-1); }
.step__when { font-size: var(--text-small); color: var(--color-muted); }
.step ul { list-style: none; padding: 0; margin-top: var(--space-4); }
.step li { font-size: var(--text-small); color: var(--color-muted); margin-top: var(--space-2); }

/* ---- FAQ (native details/summary, no JS) ------------------------------- */
.faq { max-width: var(--container-narrow); }
.faq details { border-bottom: var(--border-hairline); }
.faq summary {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  padding: var(--space-6) 0;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  color: var(--color-accent);
  font-size: 1.5rem;
  line-height: 1;
  transition: transform var(--duration) var(--ease);
}
.faq details[open] summary::after { content: "\2212"; } /* minus */
.faq details > p { padding-bottom: var(--space-6); color: var(--color-muted); }

/* ---- CTA band ---------------------------------------------------------- */
.cta-band { text-align: center; }
.cta-band .container { display: grid; justify-items: center; gap: var(--space-6); }

/* ---- Footer ------------------------------------------------------------ */
.site-footer {
  background: var(--color-dark-bg);
  color: var(--color-dark-muted);
  padding-block: var(--space-16) var(--space-8);
}
.site-footer a { color: var(--color-dark-muted); }
.site-footer a:hover { color: #fff; }
.footer__top {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-8);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--color-dark-line);
}
/* Designer's full lockup (logomark + LAB IV + slogan). Sized by width so the
   built-in "Shaping Your Data Team" slogan stays legible. */
.footer__brand img { width: clamp(13rem, 34vw, 17rem); height: auto; }
.footer__cols { display: flex; gap: var(--space-16); flex-wrap: wrap; }
.footer__col h4 { font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--tracking-label); color: #fff; margin-bottom: var(--space-4); }
.footer__col ul { list-style: none; padding: 0; }
.footer__col li { margin-top: var(--space-3); font-size: var(--text-small); }
.footer__bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4);
  padding-top: var(--space-8);
  font-size: var(--text-small);
}

/* ---- Case-study page specifics ----------------------------------------- */
.cs-hero { padding-block: clamp(3rem, 2rem + 6vw, 6rem) var(--space-12); }
.cs-hero .eyebrow { margin-bottom: var(--space-4); }
.cs-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-8);
  margin-top: var(--space-8); padding-top: var(--space-8);
  border-top: var(--border-hairline);
}
.cs-meta dt { font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--color-muted); }
.cs-meta dd { margin-top: var(--space-1); font-weight: var(--weight-semibold); }
.prose { max-width: var(--container-narrow); }
.prose > * + * { margin-top: var(--space-6); }
.prose h2 { margin-top: var(--space-12); }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-top: var(--space-2); }
.pullquote {
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
}

/* ==========================================================================
   BLOG
   ========================================================================== */

/* ---- Filter bar -------------------------------------------------------- */
.filterbar {
  position: sticky;
  top: 5rem; /* below the 5rem sticky header */
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: var(--border-hairline);
  padding-block: var(--space-4);
}
.filterbar__search {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
}
.blog-search {
  flex: 1;
  max-width: 24rem;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: var(--text-small);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
}
.blog-search:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }

.filter-group { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: baseline; }
.filter-group + .filter-group { margin-top: var(--space-3); }
.filter-group__label {
  flex: none;
  width: 4.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--color-muted);
}
@media (max-width: 600px) { .filter-group__label { width: 100%; } }

.chip {
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: 1;
  padding: 0.45rem 0.8rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}
.chip:hover { border-color: var(--color-text); }
.chip[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: #fff; }

.btn-reset {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--color-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.45rem 0;
}
.btn-reset:hover { color: var(--color-accent-hover); text-decoration: underline; }

/* ---- Feed grid + cards ------------------------------------------------- */
.blog-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: var(--space-8);
  align-items: start;
}
.bcard {
  display: flex;
  flex-direction: column;
  border: var(--border-hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg);
}
.bcard[hidden] { display: none; }

.bcard__media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--color-surface);
  overflow: hidden;
}
.bcard--short .bcard__media { aspect-ratio: 9 / 16; }
/* Placeholder thumb: soft brand tint wash until real media is dropped in. */
.bcard__thumb {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--color-accent-tint), var(--color-surface));
}
.bcard__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bcard__badge {
  position: absolute; top: 0.6rem; left: 0.6rem; z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--color-accent);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
}
.bcard__badge--neutral { background: var(--color-text); }
.bcard__dur {
  position: absolute; bottom: 0.6rem; right: 0.6rem; z-index: 1;
  font-size: 0.75rem;
  color: #fff;
  background: rgba(0,0,0,0.72);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.bcard__play {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
  color: #fff;
}
.bcard__play::before {
  content: "";
  width: 3.25rem; height: 3.25rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 103, 195, 0.9);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='white'%3E%3Cpath d='M5 3.5v13l11-6.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 56% center;
}

.bcard__body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.bcard__series { font-family: var(--font-mono); font-size: var(--text-small); color: var(--color-accent); }
.bcard__title { font-size: 1.0625rem; line-height: 1.25; }
.bcard__title a { color: var(--color-text); }
.bcard__title a:hover { color: var(--color-accent); }
.bcard__excerpt { font-size: var(--text-small); color: var(--color-muted); }
.bcard__tags { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; margin-top: var(--space-1); }
.bcard__tags a {
  font-size: 0.75rem;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  padding: 0.1rem 0.55rem;
}
.bcard__tags a:hover { border-color: var(--color-text); color: var(--color-text); }
.bcard__ext { font-size: var(--text-small); font-weight: var(--weight-semibold); margin-top: var(--space-1); }

.blog-empty { padding: var(--space-16) 0; text-align: center; color: var(--color-muted); }

/* ---- Video post page --------------------------------------------------- */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.video-frame video, .video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-frame .bcard__play { position: static; }

.media-block { margin-top: var(--space-8); }
.media-block h2 { font-size: var(--text-h3); margin-bottom: var(--space-3); }
.audio-player { width: 100%; }

.transcript {
  margin-top: var(--space-12);
  max-width: var(--container-narrow);
}
.transcript h2 { font-size: var(--text-h3); margin-bottom: var(--space-4); }
.transcript p { margin-top: var(--space-4); color: var(--color-text); }
.transcript .ts {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--color-accent);
  margin-right: var(--space-2);
}

.video-meta {
  display: flex; flex-wrap: wrap; gap: var(--space-6);
  margin-top: var(--space-6); padding-top: var(--space-6);
  border-top: var(--border-hairline);
  font-size: var(--text-small);
}
.video-meta dt { font-family: var(--font-mono); color: var(--color-muted); text-transform: uppercase; letter-spacing: var(--tracking-label); font-size: var(--text-label); }
.video-meta dd { margin-top: var(--space-1); font-weight: var(--weight-semibold); }

/* ---- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
