/* ============================================================
   SOI 2026 — Responsive hardening (mobile / tablet)
   Loaded AFTER styles.css. The Figma source had NO mobile frames,
   so this layer fixes the fixed-px components that overflow small
   screens (nav, hero, pills). Desktop (>768px) is left untouched.
   Uses design tokens only — no new colors, no magic numbers.
   ============================================================ */

/* ---------- Global box-sizing reset (applies at ALL widths) ----------
   The design assumes border-box (c-cta-pill / c-tag-pill / c-stat-tile set it
   explicitly) but the bundle has no global reset, so full-bleed elements with
   width:100% + horizontal padding (.c-hero, .c-site-footer, .c-site-header)
   rendered ~96px wider than the viewport → horizontal scroll. Border-box fixes
   it everywhere, desktop included. */
*,
*::before,
*::after { box-sizing: border-box; }

/* ---------- Header: desktop keeps the nav pushed to the right ---------- */
.c-site-header__nav { margin-inline-start: auto; }

/* ---------- Header hamburger toggle (revealed on mobile when JS is present) ---------- */
.c-site-header__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--color-text-dark-navy);
	cursor: pointer;
}
.c-site-header__toggle-box {
	position: relative;
	display: block;
	width: 26px;
	height: 18px;
}
.c-site-header__toggle-bar {
	position: absolute;
	left: 0;
	width: 100%;
	height: 3px;
	background: currentColor;
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}
.c-site-header__toggle-bar:nth-child(1) { top: 0; }
.c-site-header__toggle-bar:nth-child(2) { top: 50%; transform: translateY(-50%); }
.c-site-header__toggle-bar:nth-child(3) { top: auto; bottom: 0; }
/* Morph to an X when open */
.c-site-header__toggle[aria-expanded="true"] .c-site-header__toggle-bar:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
.c-site-header__toggle[aria-expanded="true"] .c-site-header__toggle-bar:nth-child(2) { opacity: 0; }
.c-site-header__toggle[aria-expanded="true"] .c-site-header__toggle-bar:nth-child(3) { top: 50%; bottom: auto; transform: translateY(-50%) rotate(-45deg); }

/* ---------- Tablet & mobile (≤768px) ---------- */
@media (max-width: 768px) {

  /* --- Header: logo + hamburger on one row, nav as a drop-down panel --- */
  .c-site-header {
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding-block: var(--space-sm);
  }
  .c-site-header__nav {
    width: 100%;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .c-site-header__link {
    width: 100%;
    text-align: center;
    padding-block: var(--space-sm);
    border-top: 1px solid color-mix(in srgb, var(--color-text-dark-navy) 12%, transparent);
  }
  /* With JS available, collapse the nav behind the hamburger */
  .js .c-site-header__toggle { display: inline-flex; }
  .js .c-site-header__nav { display: none; }
  .js .c-site-header__nav.is-open { display: flex; }

  /* --- Pills: never exceed the viewport; let long labels wrap --- */
  .c-cta-pill,
  .c-tag-pill {
    max-width: 100%;
    width: auto;
    white-space: normal;
    height: auto;
    min-height: var(--pill-height-secondary);
    padding-block: var(--space-sm);
    text-align: center;
  }

  /* --- Hero: tame fixed heights + giant titles, stack the CTAs --- */
  .c-hero {
    min-height: 0;
    padding: var(--space-2xl) var(--space-sm);
    gap: var(--space-sm);
  }
  .c-hero__title {
    font-size: clamp(2.25rem, 11vw, var(--font-size-hero));
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .c-hero__subtitle { font-size: var(--font-size-body-sm); }
  .c-hero__link {
    white-space: normal;
    max-width: 100%;
    text-align: center;
  }
  .c-hero__actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .c-hero__actions .c-cta-pill { width: 100%; }

  /* HOMA giant "SOI" display lockup + 853px meta rule */
  .section-homa-hero .c-hero__title {
    font-size: clamp(3.5rem, 22vw, var(--font-size-display-128));
  }
  .section-homa-hero__meta { width: 100%; }

  /* --- Tag-pill rows (submission templates, publication pills): stack --- */
  .section-submission-templates__pills,
  .section-publication-pills__list {
    flex-direction: column;
    align-items: center;
  }
  .section-submission-templates__pills .c-tag-pill,
  .section-publication-pills__list .c-tag-pill {
    width: 100%;
    max-width: 480px;
  }

  /* --- Topics cards: desktop padding (48/64) + OL indent (64) leave too little
     text width on mobile, and long tokens ("Interdisciplinary/multidimensional")
     don't wrap → overflow. Tighten padding and allow word breaking. --- */
  .section-about-mine-topics__card { padding: var(--space-lg) var(--space-sm); }
  .section-about-mine-topics__list { padding-inline-start: var(--space-md); }
  .section-about-mine-topics__list li { overflow-wrap: anywhere; }

  /* --- About-SOI: the grid (portrait + content with grid-column:2) sizes its
     tracks to --portrait-w (476px) / the 543px body and overflows phones.
     Stack as a simple flex column on mobile so children shrink to the viewport. --- */
  .section-homa-about__inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
  }
  .section-homa-about__inner > * { min-width: 0; max-width: 100%; }
  .section-homa-about__portrait { max-width: 100%; }

  /* --- Big uppercase titles: long single words ("INNOVATION", "Committees",
     "KEYDATES") at 50–70px overflow narrow phones since words can't wrap.
     Scale them fluidly; keep a last-resort break for tiny (≤320px) screens. --- */
  .section-about-mine-committees__title,
  .section-homa-about__title {
    font-size: clamp(1.75rem, 8vw, var(--font-size-h1));
  }
  .section-key-dates__title {
    font-size: clamp(2.25rem, 12vw, var(--font-size-hero));
  }
  h1, h2, h3 { overflow-wrap: break-word; }

  /* --- Key-dates timeline: the 1fr content track can't shrink below its
     longest word (grid min-width:auto) → overflows ~320px. Let it shrink. --- */
  .section-key-dates__event { column-gap: var(--space-sm); }
  .section-key-dates__content { min-width: 0; }

  /* --- Stats strip: keep the 3 tiles stacked up to tablet portrait
     (the 3-across row + xl gap overflows around 768px) --- */
  .section-homa-stats__list { flex-direction: column; }

  /* --- Safety: media stays inside the viewport --- */
  img,
  .section-homa-news__thumb,
  .section-homa-partners__logo { max-width: 100%; }
}

/* ---------- Desktop layout fix: home stats strip ----------
   The 3 stat items have unequal widths ("+150 SPEAKER" ≈137px vs ≈360px for the
   others), so the design's flex `justify-content:center` row leaves the circles
   unevenly spaced and the cluster sitting left of centre. Switch to 3 equal
   columns inside a centred container so the circles are evenly distributed. */
@media (min-width: 769px) {
  .section-homa-stats__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    max-width: 1080px;
    margin-inline: auto;
  }
  .section-homa-stats__item { width: 100%; }
}

/* ============================================================
   Client mobile fixes (review round)
   ============================================================ */
@media (max-width: 768px) {
  /* Home hero: centre MESSINA + the date (were left-aligned when stacked) */
  .section-homa-hero__meta {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-2xs);
    border-bottom: none;
  }

  /* Fees table: fit on screen instead of a clipped horizontal scroll.
     Drop the 640px min-width and tighten cell padding/type. */
  .section-registration-fees-table__table { min-width: 0; }
  .section-registration-fees-table__table thead th,
  .section-registration-fees-table__table tbody td,
  .section-registration-fees-table__table tbody th {
    padding: var(--space-sm) var(--space-2xs);
    font-size: var(--font-size-body-sm);
  }
}

@media (max-width: 640px) {
  /* About venue: stop the giant decorative "SOI" from overlapping the stacked
     countdown tiles — stack SOI above the tiles (mirrors the hotel venue). */
  .section-about-mine-venue__lockup {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
  }
  .section-about-mine-venue__soi,
  .section-about-mine-venue__overlay { grid-area: auto; }

  /* Move the address up — right under "SOI", over the light part of the photo —
     so it's readable instead of sitting over the (busy) audience photo below.
     Applies to both venue sections (same shared photo). */
  .section-about-mine-venue__address { order: -1; }
  .section-hotel-venue__tiles { order: 1; }
}
