/* =============================================================================
   as-responsive.css — tablet + desktop adaptive layer for ActuallySpeak.
   -----------------------------------------------------------------------------
   HARD RULE: every rule in this file lives inside a min-width media query
   (tablet >= 768px, desktop >= 1100px). Nothing here can ever apply below
   768px, so the phone layout is exactly what it was before this file existed.
   Link it LAST in <head> (after every other stylesheet / inline <style>):
       <link rel="stylesheet" href="/as-responsive.css">

   What it does
   - Tablet  (>=768px): the centred phone column widens (~880px), card/zone/
     lesson lists become 2 columns, tile grids get more columns, type and
     spacing grow a little.
   - Desktop (>=1100px): the bottom tab bar (#u26Nav, injected by
     /as-ui26-nav.js) becomes a left sidebar; the content area widens to
     ~1120px; home / hub pages use a 2-column dashboard layout; the General
     app shell (index.html) widens and its flashcard card lays out side by side.
   Touch targets stay >= 44px and env(safe-area-inset-*) padding is kept.
   No image is ever blurred here.
   ============================================================================= */

/* ============================== TABLET >= 768px ============================ */
@media (min-width: 768px) {

  /* ---- shared ui26 content column ---- */
  body.ui26 .u-wrap {
    max-width: 880px;
    padding-left: 28px;
    padding-right: 28px;
  }
  /* sticky chip rows use a negative margin equal to the old 16px gutter */
  body.ui26 .u-seg,
  body.ui26.as-ielts .zseg {
    margin-left: -28px;
    margin-right: -28px;
    padding-left: 28px;
    padding-right: 28px;
  }
  body.ui26 .u-h1 { font-size: 32px; }
  body.ui26 .u-greet .u-h1 { font-size: 30px; }
  body.ui26 .u-sub { font-size: 15.5px; }
  body.ui26 .u-h2 { font-size: 22px; }
  body.ui26 .hm-greet h1 { font-size: 30px; }
  body.ui26 .hm-greet p { font-size: 15px; }
  body.ui26 .u-section { margin-top: 28px; }
  body.ui26 .u-section a { font-size: 14px; }
  body.ui26 .u-row .u-rt { font-size: 16px; }
  body.ui26 .u-row .u-rs { font-size: 13.5px; }
  body.ui26 .u-card { padding: 18px 20px; }

  /* ---- grids: more columns ---- */
  body.ui26 .u-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.ui26 .u-skills { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  body.ui26 .u-pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  body.ui26 .u-pgrid.u-half { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.ui26 .u-more { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 12px; }
  body.ui26 .u-more a { font-size: 12.5px; }
  body.ui26 .u-today { gap: 14px; }
  body.ui26 .u-tiles { gap: 14px; }
  body.ui26 .u-tiles .u-tile { font-size: 13.5px; }
  body.ui26 .hm-cat { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  body.ui26 .hm-cat a { min-height: 132px; padding: 14px 13px; }
  body.ui26 .hm-cat a b { font-size: 14px; }
  body.ui26 .hm-cat a span { font-size: 12px; }

  /* ---- IELTS zone pages (speaking / writing / reading / listening / learn / practice) ---- */
  body.ui26.as-ielts .zrows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.ui26.as-ielts .zcg { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  body.ui26.as-ielts .zhero h1 { font-size: 30px; }
  body.ui26.as-ielts .zhero p { font-size: 15px; max-width: 52ch; }
  body.ui26.as-ielts .zph { min-height: 160px; }
  body.ui26.as-ielts .zph .zph-in { padding: 18px 20px; }
  body.ui26 .sz-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.ui26 .sz-vgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* writing / reading / listening zone pages */
  body.ui26 .wz .rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.ui26 .wz .sec { font-size: 13px; margin-top: 26px; }

  /* ---- bottom tab bar: just a bit wider so it matches the column ---- */
  body #u26Nav .u26-row { max-width: 760px; }
  body #u26Nav a { font-size: 12px; }

  /* ---- General app shell (index.html) ---- */
  body > .app { max-width: 760px; }
  body > .app > header { padding-left: 28px; padding-right: 28px; }
  body > .app > main { padding-left: 28px; padding-right: 28px; padding-bottom: 48px; }
  /* inline max-width:640px wrappers on the home screen would leave a narrow column inside the wider shell */
  body > .app #stateHome > [style*="max-width:640px"] { max-width: none !important; margin-left: 0 !important; margin-right: 0 !important; }
  body > .app #stateHome.active > #homeTraining,
  body > .app #stateHome.active > #homeExtras {
    display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  }
  /* vocabulary flashcards: a larger card, bigger type, wider buttons */
  body > .app #stateFlashcards .srs-card { max-width: 480px; }
  body > .app #stateFlashcards .srs-back-words { font-size: 30px; }
  body > .app #stateFlashcards .srs-back-defline,
  body > .app #stateFlashcards .srs-back-example { font-size: 16px; }
  body > .app #stateFlashcards .srs-nav,
  body > .app #stateFlashcards .srs-rating-actions { max-width: 480px; margin-left: auto; margin-right: auto; }
}

/* ============================== DESKTOP >= 1100px ========================== */
@media (min-width: 1100px) {

  /* ---------- tab bar becomes a left sidebar ---------- */
  body.u26-has-nav { padding-left: 232px; }
  body.u26-has-nav #u26Nav.asn-dock {
    box-sizing: border-box;
    left: 0; right: auto; top: 0; bottom: 0; width: 232px;
    padding: calc(28px + env(safe-area-inset-top, 0px)) 14px calc(20px + env(safe-area-inset-bottom, 0px));
    border-top: 0;
    border-right: 1px solid rgba(140, 150, 255, .18);
    box-shadow: 10px 0 30px rgba(3, 6, 30, .35);
    background: rgba(5, 9, 32, .97);
    overflow-y: auto;
  }
  /* the keyboard-slide-away trick is for phones only */
  body.u26-has-nav #u26Nav.asn-dock.u26-kb { transform: none; opacity: 1; pointer-events: auto; }
  body.u26-has-nav #u26Nav.asn-dock::before {
    content: "ActuallySpeak";
    display: block;
    margin: 0 10px 22px;
    font: 800 20px/1.1 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -.02em;
    background: linear-gradient(90deg, #8b7bff, #d65cff);
    -webkit-background-clip: text; background-clip: text; color: transparent;
  }
  body.u26-has-nav #u26Nav .u26-row {
    flex-direction: column; justify-content: flex-start; align-items: stretch;
    height: auto; max-width: none; margin: 0; padding: 0; gap: 6px;
  }
  body.u26-has-nav #u26Nav a {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; align-items: center;
    gap: 14px; min-height: 48px; padding: 0 16px; font-size: 15px; border-radius: 14px;
  }
  body.u26-has-nav #u26Nav a svg { width: 24px; height: 24px; flex: 0 0 24px; }
  body.u26-has-nav #u26Nav a:hover { background: rgba(255, 255, 255, .06); }
  body.u26-has-nav #u26Nav a[aria-current="page"] { background: rgba(123, 92, 255, .18); }
  body.u26-has-nav #u26Nav a[aria-current="page"]::before {
    top: 50%; left: 0; width: 3px; height: 24px; margin: -12px 0 0 0;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #2f7bff, #7b5cff, #ff4fa0);
  }
  body.u26-has-nav .u26-spacer { display: none; }
  /* bottom-left floating pills no longer need lifting above a bottom bar, but must clear the sidebar */
  body.u26-has-nav #asSigninLaunch { left: 248px !important; bottom: 18px !important; }

  /* ---------- content column ---------- */
  body.ui26 .u-wrap {
    max-width: 1120px;
    padding-left: 40px;
    padding-right: 40px;
    padding-bottom: 56px;
  }
  body.ui26 .u-seg,
  body.ui26.as-ielts .zseg {
    margin-left: -40px; margin-right: -40px; padding-left: 40px; padding-right: 40px;
  }
  body.ui26 .u-top { padding-top: 22px; }
  body.ui26 .hm-greet h1 { font-size: 34px; }
  body.ui26 .u-greet .u-h1 { font-size: 34px; }
  body.ui26 .u-h2 { font-size: 24px; }

  /* wider grids */
  body.ui26 .u-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.ui26 .u-skills { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  body.ui26 .u-more { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  body.ui26 .hm-cat { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  body.ui26.as-ielts .zrows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.ui26 .wz .rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }


  /* ---------- General app shell (index.html) ---------- */
  body > .app { max-width: 1040px; }
  body > .app > header { padding-left: 40px; padding-right: 40px; }
  body > .app > main { padding-left: 40px; padding-right: 40px; }
  /* home: flagship + daily question side by side, training / explore lists in two columns */
  body > .app #stateHome.active {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; align-items: start;
  }
  body > .app #stateHome.active > * { grid-column: 1 / -1; }
  body > .app #stateHome.active > #homeConversation { grid-column: 1; margin-top: 0 !important; }
  body > .app #stateHome.active > #homeDailyQ { grid-column: 2; margin-top: 0 !important; }
  body > .app #stateHome.active > #homeTraining,
  body > .app #stateHome.active > #homeExtras {
    display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
  }
  body > .app #stateHome.active > [style*="letter-spacing:.14em"] { margin-top: 8px !important; margin-bottom: 0 !important; }
  /* flashcard: image on the left, word + meaning on the right */
  body > .app #stateFlashcards .srs-card { max-width: 900px; flex-direction: row; align-items: stretch; }
  body > .app #stateFlashcards .srs-image { flex: 0 0 48%; width: 48%; aspect-ratio: auto; min-height: 340px; }
  body > .app #stateFlashcards .srs-definition { flex: 1 1 auto; justify-content: center; padding: 28px 32px; gap: 14px; }
  body > .app #stateFlashcards .srs-back-words { font-size: 36px; }
  body > .app #stateFlashcards .srs-nav,
  body > .app #stateFlashcards .srs-rating-actions { max-width: 560px; }

  /* ---------- IELTS home (command-center): 2-column dashboard ---------- */
  body.ui26 .u-wrap.cc-home,
  body.ui26.cc-home .u-wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 24px;
    align-items: start;
    grid-template-rows: auto auto auto 1fr;
  }
  body.ui26.cc-home .u-wrap > * { grid-column: 1 / -1; }
  body.ui26.cc-home .u-wrap > .hm-class { grid-column: 1; grid-row: 3; align-self: stretch; margin-top: 12px; }
  body.ui26.cc-home .u-wrap > #bandcard { grid-column: 2; grid-row: 3 / span 2; margin-top: 12px; }
  body.ui26.cc-home .u-wrap > #dreamCard { grid-column: 1; grid-row: 5; margin-top: 14px; }
  body.ui26.cc-home .u-wrap > #dailyQCard { grid-column: 1; grid-row: 4; margin-top: 14px; }
  body.ui26.cc-home .u-wrap > #goalBanner { grid-column: 1 / -1; }

  /* ---------- General home: stat/hero left, lists right ---------- */
  body.ui26 .u-pcard { min-height: 190px; }
}

/* very large desktops */
@media (min-width: 1500px) {
  body.ui26 .u-wrap { max-width: 1240px; }
  body.ui26 .hm-cat { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
