/* Responsive layer for the Alchemist Media Labs site.
 *
 * The pages are exported from Claude Design with every style inline, so this
 * file can only win with `!important`. Where a rule targets a specific block it
 * keys off the exact inline `style` string ([style*="..."]) — if a page is
 * re-synced from the design and those strings change, re-check this file.
 *
 * Breakpoints
 *   ≤ 900px  tablet: narrower gutters, two-column heroes/sections stack
 *   ≤ 760px  hamburger navigation, three-column card grids stack
 *   ≤ 640px  phone: 20px gutters, tighter type and spacing, list rows re-flow
 */

html { -webkit-text-size-adjust: 100%; }
a, button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* ---- Mobile nav toggle (hidden on desktop) ---------------------------- */

.nav-toggle {
  display: none;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #E8E8F0;
  cursor: pointer;
}
.nav-toggle:focus-visible { outline: 2px solid #FF3F97; outline-offset: 2px; }
.nav-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .25s ease, opacity .2s ease;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---- ≤ 900px: tablet -------------------------------------------------- */

@media (max-width: 900px) {
  header > div, section, footer {
    padding-left: 28px !important;
    padding-right: 28px !important;
  }
  .arrow-btn { left: 28px !important; }

  /* Heroes: headline above the intro paragraph instead of side by side */
  [style*="grid-template-columns:1.2fr 1fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 28px !important;
    align-items: start !important;
  }
  section:first-of-type:not(#top) { padding-top: 96px !important; }

  /* Two-column sections stack */
  [style*="grid-template-columns:minmax(0,1.05fr) minmax(0,1fr)"],       /* home: everscreen */
  [style*="grid-template-columns:260px minmax(0,1fr)"],                   /* home: latest press */
  [style*="grid-template-columns:minmax(0,1.6fr) minmax(280px,1fr)"],     /* media: list + press kit */
  [style*="grid-template-columns:minmax(0,1.4fr) minmax(220px,0.6fr)"],   /* company: contact card */
  [style*="grid-template-columns:minmax(0,1fr) minmax(0,1.15fr)"],        /* imprint */
  [style*="grid-template-columns:320px 1fr"] {                            /* platform: who we build for */
    grid-template-columns: minmax(0, 1fr) !important;
  }
  [style*="grid-template-columns:minmax(0,1.05fr) minmax(0,1fr)"] { gap: 44px !important; }
  [style*="grid-template-columns:260px minmax(0,1fr)"] { gap: 32px !important; }
  [style*="grid-template-columns:minmax(0,1.4fr) minmax(220px,0.6fr)"] { gap: 36px !important; }
  [style*="grid-template-columns:320px 1fr"] { gap: 14px !important; }

  [style*="padding:88px 56px"] { padding: 64px 36px !important; }
}

/* ---- ≤ 760px: hamburger nav, card grids stack ------------------------- */

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }

  header nav {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 6px 28px 22px;
    background: rgba(14, 14, 21, 0.97);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 28px 48px -20px rgba(0, 0, 0, 0.65);
  }
  header.nav-open nav { display: flex !important; }
  header nav a {
    font-size: 17px !important;
    padding: 15px 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }
  header nav a:first-child { border-top: 0; }
  header nav a.chip-link {
    margin-top: 14px;
    padding: 13px 18px !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    font-size: 15px !important;
    text-align: center;
  }

  [style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  [style*="grid-template-columns:repeat(3,1fr)"][style*="gap:28px"] { gap: 20px !important; }
  [style*="grid-template-columns:repeat(3,1fr)"][style*="gap:24px"] { gap: 16px !important; }
}

/* ---- ≤ 640px: phone --------------------------------------------------- */

@media (max-width: 640px) {
  header > div, section, footer {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  header nav { padding-left: 20px; padding-right: 20px; }
  .arrow-btn { left: 20px !important; bottom: 24px !important; }

  /* Vertical rhythm */
  section:not(:first-of-type) { margin-top: 72px !important; }
  section:first-of-type:not(#top) { padding-top: 64px !important; }
  footer { margin-top: 72px !important; }
  #everscreen { margin-top: 0 !important; padding-top: 48px !important; }
  [style*="padding-top:56px"] { padding-top: 40px !important; }
  [style*="padding-top:52px"] { padding-top: 40px !important; }

  /* Type scale */
  #top { min-height: calc(100vh - 68px) !important; min-height: calc(100svh - 68px) !important; }
  #top h1 { font-size: clamp(38px, 12vw, 48px) !important; margin-bottom: 40px !important; }
  h1 { font-size: clamp(34px, 10vw, 42px) !important; }
  h2[style*="clamp(40px,4.6vw,68px)"] { font-size: clamp(30px, 9vw, 40px) !important; }
  h2[style*="clamp(30px,3.6vw,54px)"] { font-size: clamp(26px, 8vw, 32px) !important; }
  [style*="font-size:26px"] { font-size: 22px !important; }

  /* Remaining two-column grids stack */
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Cards */
  [style*="padding:88px 56px"] { padding: 48px 24px !important; }
  [style*="padding:36px 34px 34px"] { padding: 28px 22px 26px !important; }
  [style*="padding:38px 32px 42px"] { padding: 28px 22px 30px !important; }
  [style*="padding:30px 28px"] { padding: 24px 20px !important; }
  [style*="padding:32px 30px"] { padding: 24px 20px !important; }
  [style*="padding:24px 26px 0"] { padding: 16px 16px 0 !important; }
  [style*="padding:24px 26px 0"] > div:first-child > div:first-child > span { display: none; }

  /* Press rows: date + outlet on one line, title below, arrow at right */
  a.row-link[style*="84px 130px"] {
    grid-template-columns: auto minmax(0, 1fr) 20px !important;
    gap: 6px 14px !important;
    align-items: start !important;
    padding: 18px 0 !important;
  }
  a.row-link[style*="84px 130px"] > div:nth-child(3) { grid-column: 1 / 3; font-size: 16px !important; }
  a.row-link[style*="84px 130px"] > div:nth-child(4) { grid-column: 3; grid-row: 1 / 3; }

  /* Job rows: title block on top, team · location · apply underneath */
  div[style*="minmax(0,1.7fr) 1fr 1fr 110px"] { grid-template-columns: minmax(0, 1fr) !important; }
  div[style*="minmax(0,1.7fr) 1fr 1fr 110px"] > div:nth-child(n+2) { display: none; }
  a.row-link[style*="minmax(0,1.7fr) 1fr 1fr 110px"] {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 12px 14px !important;
    align-items: baseline !important;
    padding: 22px 0 !important;
  }
  a.row-link[style*="minmax(0,1.7fr) 1fr 1fr 110px"] > div:first-child { grid-column: 1 / -1; }
  a.row-link[style*="minmax(0,1.7fr) 1fr 1fr 110px"] > div:nth-child(2),
  a.row-link[style*="minmax(0,1.7fr) 1fr 1fr 110px"] > div:nth-child(3) { font-size: 13px !important; }
  a.row-link[style*="minmax(0,1.7fr) 1fr 1fr 110px"] [style*="font-size:20px"] { font-size: 18px !important; }

  /* Footer: brand on top, link columns side by side */
  footer [style*="grid-template-columns:2fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 36px 24px !important;
  }
  footer [style*="grid-template-columns:2fr 1fr 1fr"] > div:first-child { grid-column: 1 / -1; }
  footer [style*="height:60px"] { height: 48px !important; }
}
