/* Responsive pass: phone + tablet layout, photo fit, timeline and card polish.
   Loaded last on every page. app.css is long-cached, so fixes live here. */

/* ---------- Bug fixes (all sizes) ---------- */
.cred-tag { color: var(--amber); }                 /* was the same colour as its background */
.projects-header > div { min-width: 0; }

/* ---------- Photos: one consistent frame ---------- */
.photo { max-width: 100%; }
.photo--split { aspect-ratio: 16 / 10; object-position: 50% 30%; }
.photo--side  { object-position: 50% 25%; }
.split > *, .contact-grid > * { min-width: 0; }

/* Contact: photo fills the column's remaining width without stretching the form row */
@media (min-width: 901px) {
  .contact-grid { align-items: start; }
  .photo--side { aspect-ratio: 16 / 11; }
}

/* Mid-size screens: hero photo sits under the buttons, aligned to the text column */
@media (min-width: 901px) and (max-width: 1359px) {
  .hero-photo { max-width: 620px; aspect-ratio: 16 / 9; object-position: 50% 30%; }
}

/* ---------- Timeline (all sizes): dots centred on the line, items as cards ---------- */
.timeline { padding-left: 2rem; margin-top: 2.5rem; max-width: 820px; }
.timeline::before { left: 0; width: 2px; border-radius: 2px; }
.tl-item {
  margin-bottom: 1.25rem;
  padding: 1.1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tl-item:last-child { margin-bottom: 0; }
.tl-item::before {
  left: calc(-2rem - 6px);       /* centre of the 2px line */
  top: 1.35rem;
  width: 14px; height: 14px;
  box-shadow: 0 0 0 4px var(--accent-tint);
}
/* little connector from dot to card */
.tl-item::after {
  content: '';
  position: absolute;
  left: -2rem; top: calc(1.35rem + 6px);
  width: 2rem; height: 1px;
  background: var(--border);
}
.tl-item__year {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
  margin-bottom: 0.6rem;
  border-radius: 999px;
  background: var(--accent-tint);
}
.tl-item__title { line-height: 1.35; }

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .section { padding: 80px 5vw; }
  .services-grid, .projects-grid, .team-grid { gap: 1.25rem; }
  .project-card--featured .project-card__thumb { height: 280px; }
  .post-deploy { padding: 2rem; }
  .post-deploy__items { grid-template-columns: 1fr 1fr; }
  .photo--banner, .photo--split { aspect-ratio: 16 / 9; }
  #hero { min-height: 0; padding-bottom: 64px; }
  .hero-photo { max-width: none; }
}

/* ---------- Phone ---------- */
@media (max-width: 600px) {
  html { -webkit-text-size-adjust: 100%; }

  /* Rhythm: the desktop 100px/140px gaps swallow whole screens on a phone */
  .section { padding: 56px 5vw; }
  .section[style*="padding-top"] { padding-top: 96px !important; }
  .section__title { margin-bottom: 1rem; }
  .section__sub, .hero__sub { font-size: 1rem; line-height: 1.7; }
  .projects-header { margin-bottom: 2rem; gap: 1.5rem; }
  .services-grid { margin-top: 2rem; }
  .divider { margin: 0 5vw; }

  /* Hero */
  #hero { padding: 96px 5vw 48px; }
  .hero__eyebrow { font-size: 0.68rem; letter-spacing: 0.14em; line-height: 1.5; align-items: flex-start; }
  .hero__eyebrow::before { margin-top: 0.55em; flex: none; }
  .hero__headline { font-size: clamp(2.3rem, 11vw, 3rem); margin-bottom: 1.25rem; }
  .hero__sub { margin-bottom: 2rem; }
  .hero__actions { flex-direction: column; gap: 0.75rem; }
  .hero__actions .btn-primary, .hero__actions .btn-ghost { width: 100%; text-align: center; padding: 0.95rem 1.25rem; }
  .hero-photo { margin-top: 2rem; aspect-ratio: 4 / 3; object-position: 50% 28%; }

  /* Stats: tidy 2 x 2 grid instead of four uneven stacked rows */
  .hero__stats {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0; margin-top: 2.5rem; padding-top: 0; border-top: 1px solid var(--border);
  }
  .stat { min-width: 0; margin: 0; padding: 1.5rem 0.5rem 1.5rem 0; border: 0; border-bottom: 1px solid var(--border); }
  .stat:nth-child(odd) { border-right: 1px solid var(--border); }
  .stat:nth-child(even) { padding-left: 1.25rem; }
  .stat:nth-last-child(-n+2) { border-bottom: 0; }
  .stat__num { font-size: 2.4rem; }
  .stat__label { font-size: 0.68rem; letter-spacing: 0.06em; }

  /* Photos */
  .photo { border-radius: 10px; }
  .photo--banner, .photo--split { aspect-ratio: 3 / 2; margin-top: 2rem; }
  .photo--side { aspect-ratio: 4 / 3; object-position: 50% 22%; margin-top: 1.5rem; }
  .split { gap: 2rem; }

  /* Service cards: icon beside the title, copy full width underneath */
  .service-card {
    display: grid; grid-template-columns: 44px 1fr; column-gap: 0.9rem; align-items: center;
    padding: 1.25rem;
  }
  .service-card__icon { width: 44px; height: 44px; margin: 0; }
  .service-card__title { margin: 0; font-size: 1rem; }
  .service-card > :not(.service-card__icon):not(.service-card__title) { grid-column: 1 / -1; }
  .service-card__text { margin-top: 0.9rem; }
  .service-card__tags { margin-top: 1rem; }

  /* Values / institutions */
  .value-card { padding: 1.25rem; }
  .post-deploy { padding: 1.5rem; margin-top: 2.5rem; }
  .post-deploy__items { grid-template-columns: 1fr; }
  .institutions-band { margin-top: 3rem; padding-top: 2.5rem; }
  .inst-grid { gap: 0.75rem; }
  .inst-item { padding: 1.1rem 0.6rem; }

  /* Projects: filters in a neat 2 x 2 grid (the row used to push the page wider than the screen) */
  .filter-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; width: 100%; }
  .filter-tab { padding: 0.7rem 0.5rem; font-size: 0.72rem; text-align: center; }
  .project-card__thumb, .project-card--featured .project-card__thumb { height: 210px; }
  .project-card__body { padding: 1.15rem; }
  .project-card__client { overflow-wrap: anywhere; }

  /* Team */
  .team-intro { margin-bottom: 3rem; }
  .team-card__avatar { height: 84px; }
  .team-card__avatar .initials { font-size: 1.6rem; }
  .team-card__body { padding: 1.15rem; }

  /* Timeline */
  .timeline { padding-left: 1.6rem; margin-top: 2rem; }
  .tl-item { padding: 1rem 1.05rem; margin-bottom: 1rem; }
  .tl-item::before { left: calc(-1.6rem - 6px); top: 1.2rem; }
  .tl-item::after { left: -1.6rem; top: calc(1.2rem + 6px); width: 1.6rem; }

  /* Contact */
  .contact-info__item { margin-bottom: 1.75rem; }
  .contact-form { padding: 1.5rem 1.15rem; }
  .form-input, .form-textarea, .form-select { font-size: 1rem; }   /* stops iOS zooming into fields */

  /* Footer */
  .footer { padding: 2.5rem 5vw; align-items: flex-start; }

  /* AI chat button: compact round icon so it stops covering the copy */
  .tm-ai-fab { width: 52px; padding: 0; justify-content: center; right: 14px; bottom: 14px; }
  .tm-ai-fab span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

@media (max-width: 380px) {
  .hero__headline { font-size: 2.15rem; }
  .stat__num { font-size: 2.1rem; }
}

/* Keep the subject in frame when the photo is cropped */
.photo--split[src*="services-intro"] { object-position: 22% 35%; }
.photo--split[src*="about-team"] { object-position: 50% 60%; }

/* About: pinned timeline intro with a quick-facts strip */
.tl-glance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-top: 2rem; max-width: 520px; }
.tl-glance > div { padding: 0.9rem 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; }
.tl-glance strong { display: block; font-family: var(--font-display); font-size: 1.15rem; color: var(--amber); letter-spacing: -0.02em; }
.tl-glance span { display: block; margin-top: 0.3rem; font-size: 0.72rem; line-height: 1.4; color: var(--steel); }
@media (min-width: 901px) {
  .tl-layout { align-items: start; }
  .tl-intro { position: sticky; top: 100px; }
}
@media (max-width: 600px) {
  .tl-glance { gap: 0.5rem; margin-top: 1.5rem; }
  .tl-glance > div { padding: 0.75rem 0.7rem; }
  .tl-glance strong { font-size: 1rem; }
}
