/* ============================================================================
   ipad.css — PURPOSE-BUILT TABLET LAYOUT (Apple 4.2 + premium bar)
   ----------------------------------------------------------------------------
   EVERY rule is scoped under html.bs-tablet, which is set ONLY on tablets
   (native shell injects it via Platform.isPad / Android >=600dp; a small web
   detector adds it for real iPad Safari). On phone and desktop NONE of this
   applies — zero risk to existing users.

   The move: the horizontal top-nav becomes a PERSISTENT LEFT RAIL and the
   content sits beside it as a working pane — a master-detail feel that uses
   the iPad's width, instead of one phone/desktop layout stretched to fit.
   !important is used deliberately to win over the width-based media queries
   that also fire in the iPad range (768–1024px).
   ============================================================================ */

html.bs-tablet, html.bs-tablet body { background: #0b0d10; }

/* ---- 1. Header becomes a fixed vertical NAV RAIL ---- */
html.bs-tablet #app-header:not(.hidden) {
  position: fixed !important;
  top: 0; left: 0; bottom: 0;
  width: 248px; height: 100vh;
  border-right: 1px solid rgba(232,228,220,.08) !important;
  border-bottom: none !important;
  background: #0b0d10 !important;
  padding: 0 !important;
  z-index: 40;
  overflow: visible;
}
html.bs-tablet #app-header .header-content {
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  height: 100%;
  gap: 0 !important;
  padding: 24px 16px !important;
  max-width: none !important;
}
/* Brand mark at the top of the rail */
html.bs-tablet #app-header .logo {
  padding: 4px 8px 20px !important;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(232,228,220,.08);
  font-size: 20px !important;
}
/* Show the primary nav as a vertical stack; hide the mobile hamburger path */
html.bs-tablet .desktop-nav {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 4px !important;
  margin: 18px 0 0 !important;
  flex: 1;
}
html.bs-tablet .desktop-nav .nav-link,
html.bs-tablet .desktop-nav .dropdown-trigger {
  display: flex !important;
  align-items: center;
  width: 100%;
  padding: 12px 12px !important;
  border-radius: 10px;
  font-size: 15px !important;
  color: var(--color-text-secondary, #9a978f) !important;
  text-align: left;
  transition: background .15s, color .15s;
}
html.bs-tablet .desktop-nav .nav-link:hover,
html.bs-tablet .desktop-nav .nav-link.active {
  background: var(--color-bg-tertiary, #171a1f) !important;
  color: var(--color-text-primary, #e8e4dc) !important;
  box-shadow: inset 2px 0 0 var(--color-accent, #c6cbd2);
}
/* Tools dropdown reads as an inline group in the rail (no floating menu) */
html.bs-tablet .desktop-nav .nav-dropdown { width: 100%; }
html.bs-tablet .desktop-nav .nav-dropdown .dropdown-menu {
  position: static !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border: none !important;
  padding: 2px 0 6px 14px !important;
  margin: 0 !important;
}
html.bs-tablet .desktop-nav .dropdown-menu .dropdown-item {
  padding: 8px 12px !important;
  font-size: 13.5px !important;
  color: var(--color-text-tertiary, #8a8780) !important;
  border-radius: 8px;
}
html.bs-tablet .desktop-nav .dropdown-arrow { margin-left: auto; }

/* User menu drops to the bottom of the rail */
html.bs-tablet .desktop-user-menu {
  display: block !important;
  margin-top: auto !important;
  padding-top: 12px;
  border-top: 1px solid rgba(232,228,220,.08);
}
html.bs-tablet .desktop-user-menu .user-trigger {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 12px !important;
  gap: 8px;
}
html.bs-tablet .desktop-user-menu .dropdown-menu {
  position: static !important; display: none;
  background: transparent !important; border: none !important; box-shadow: none !important;
  padding: 2px 0 0 8px !important;
}
html.bs-tablet .desktop-user-menu.open .dropdown-menu,
html.bs-tablet .desktop-user-menu:focus-within .dropdown-menu { display: block !important; }
html.bs-tablet .desktop-lang-toggle { align-self: flex-start; margin: 10px 4px 0 !important; }

/* Kill the phone chrome inside the rail */
html.bs-tablet .hamburger-btn,
html.bs-tablet #mobile-nav,
html.bs-tablet #bottom-nav,
html.bs-tablet #counsel-radial { display: none !important; }

/* ---- 2. Content sits beside the rail as a working pane ---- */
html.bs-tablet #app-main {
  margin-left: 248px !important;
  min-height: 100vh;
  padding: 0 !important;
}
html.bs-tablet #app-view {
  max-width: 940px;
  margin: 0 auto;
  padding: 40px 44px 64px !important;
  font-size: 16px;
}

/* ---- 3. Case list + card grids use the width (2-up), not one column ---- */
html.bs-tablet .silos-list {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 16px !important;
  align-items: start;
}
/* Common card/tile containers → comfortable multi-column tablet grids */
html.bs-tablet .tools-grid,
html.bs-tablet .card-grid,
html.bs-tablet .tool-cards,
html.bs-tablet [class*="-grid"] {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
  gap: 16px !important;
}

/* Matter cards carry multiple archive/reopen/delete controls. On portrait
   tablets a second column makes their usable content area narrower than the
   controls; keep one briefing-width column and allow every action to wrap. */
html.bs-tablet body.site-basicbench .silo-card,
html.bs-tablet body.site-benchslappro:not(.site-labs) .silo-card,
html.bs-tablet body.site-basicbench .silo-card-actions,
html.bs-tablet body.site-benchslappro:not(.site-labs) .silo-card-actions {
  min-width: 0;
}

html.bs-tablet body.site-basicbench .silo-card-actions,
html.bs-tablet body.site-benchslappro:not(.site-labs) .silo-card-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

html.bs-tablet body.site-basicbench .silo-card-btn,
html.bs-tablet body.site-benchslappro:not(.site-labs) .silo-card-btn {
  max-width: 100%;
  white-space: normal;
}

@media (max-width: 979px) {
  html.bs-tablet body.site-basicbench .silos-grid,
  html.bs-tablet body.site-benchslappro:not(.site-labs) .silos-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* ---- 4. Tablet typography + touch targets (purpose-built, not scaled) ---- */
html.bs-tablet h1 { font-size: clamp(28px, 4.4vw, 40px) !important; letter-spacing: -.01em; }
html.bs-tablet h2 { font-size: clamp(22px, 3.2vw, 28px) !important; }
html.bs-tablet button,
html.bs-tablet .btn,
html.bs-tablet .nav-link { min-height: 44px; }

/* Landscape iPad: give the reading measure a touch more room */
@media (min-width: 1100px) {
  html.bs-tablet #app-view { max-width: 1040px; }
}

/* ==========================================================================
   SOVEREIGN TABLET EDITION — a briefing desk, never a stretched phone.
   ========================================================================= */
html.bs-tablet,
html.bs-tablet body {
  background: #0b0d10 !important;
}

html.bs-tablet #app-header:not(.hidden) {
  width: 224px;
  border-right-color: var(--color-border, #2a2d32) !important;
  background: #0b0d10 !important;
}

html.bs-tablet #app-header .header-content { padding: 28px 18px !important; }
html.bs-tablet #app-header .logo { border-bottom-color: var(--color-border, #2a2d32); }

html.bs-tablet .desktop-nav .nav-link,
html.bs-tablet .desktop-nav .dropdown-trigger {
  min-height: 46px;
  border-radius: 6px 6px 18px 6px;
  color: var(--color-text-muted, #8f959d) !important;
}

html.bs-tablet .desktop-nav .nav-link:hover,
html.bs-tablet .desktop-nav .nav-link.active {
  color: var(--color-text, #f1f0ec) !important;
  background: var(--color-bg-tertiary, #171a1f) !important;
  box-shadow: inset 3px 0 0 var(--color-accent, #c6cbd2);
}

html.bs-tablet #app-main { margin-left: 224px !important; }
html.bs-tablet #app-view {
  max-width: 1080px;
  padding: 38px 38px 70px !important;
}

html.bs-tablet .tools-showcase,
html.bs-tablet .tools-grid {
  grid-template-columns: 1.16fr .84fr !important;
  grid-template-rows: repeat(3, minmax(184px, auto));
  gap: 1px !important;
  border: 1px solid var(--color-border, #2a2d32);
  border-radius: 9px 9px 28px 9px;
  overflow: hidden;
  background: var(--color-border, #2a2d32);
}

html.bs-tablet .tools-showcase .tool-card,
html.bs-tablet .tools-grid .tool-card {
  min-height: 184px;
  padding: 24px !important;
  border: 0 !important;
  border-radius: 0 !important;
}

html.bs-tablet .tools-showcase .tool-card:first-child,
html.bs-tablet .tools-grid .tool-card:first-child {
  grid-row: 1 / span 2;
  min-height: 369px;
  padding: 32px !important;
}

html.bs-tablet .tools-showcase .tool-card:first-child h2,
html.bs-tablet .tools-grid .tool-card:first-child h2 {
  margin-top: auto;
  font-size: clamp(2rem, 4vw, 3.1rem);
}

html.bs-tablet .home-main {
  grid-template-columns: 1.2fr .8fr;
  gap: 32px;
}

html.bs-tablet .home-cases-grid {
  grid-template-columns: 1fr !important;
  border-radius: 8px 8px 24px 8px;
}

@media (orientation: landscape) and (min-width: 980px) {
  html.bs-tablet #app-view { max-width: 1180px; padding-inline: 46px !important; }
  html.bs-tablet .home-main { grid-template-columns: 1.45fr .55fr; gap: 48px; }
  html.bs-tablet .home-cases-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Free tablet edition — paper briefing desk with a navy rail hierarchy.
   The shared tablet geometry stays intact, but PRO's obsidian canvas must not
   bleed into BenchSlap Free merely because both products use the same shell. */
html.bs-tablet body.site-basicbench {
  color: #294052 !important;
  background: #f4f1e9 !important;
}

html.bs-tablet body.site-basicbench #app-main,
html.bs-tablet body.site-basicbench #app-view {
  background: #f4f1e9 !important;
}

html.bs-tablet body.site-basicbench #app-header:not(.hidden) {
  color: #294052 !important;
  border-right-color: rgba(18, 42, 62, .16) !important;
  background: #fffdf8 !important;
}

html.bs-tablet body.site-basicbench #app-header .logo {
  color: #10283a !important;
  border-bottom-color: rgba(18, 42, 62, .16) !important;
}

/* Calm portrait authority: a navigation rail should orient the work, not take
   more than a fifth of the iPad canvas. The prior 224px rail left the matter
   pane narrower than a phone in portrait. */
@media (max-width: 1099px) {
  html.bs-tablet #app-header:not(.hidden) {
    width: 152px !important;
  }

  html.bs-tablet #app-header .header-content {
    padding: 24px 12px !important;
  }

  html.bs-tablet #app-header .logo {
    padding-inline: 4px !important;
  }

  html.bs-tablet #app-header .logo-text {
    font-size: 14px !important;
  }

  html.bs-tablet #app-header .logo-pro {
    margin-left: 5px;
    font-size: 7px !important;
  }

  html.bs-tablet .desktop-nav .nav-link,
  html.bs-tablet .desktop-nav .dropdown-trigger {
    padding-inline: 8px !important;
    font-size: 13px !important;
  }

  html.bs-tablet #app-main {
    margin-left: 152px !important;
  }

  html.bs-tablet #app-view {
    padding: 34px 24px 64px !important;
  }
}

html.bs-tablet body.site-basicbench .desktop-nav .nav-link,
html.bs-tablet body.site-basicbench .desktop-nav .dropdown-trigger,
html.bs-tablet body.site-basicbench .desktop-nav .dropdown-menu .dropdown-item {
  color: #526879 !important;
}

html.bs-tablet body.site-basicbench .desktop-nav .nav-link:hover,
html.bs-tablet body.site-basicbench .desktop-nav .nav-link.active,
html.bs-tablet body.site-basicbench .desktop-nav .dropdown-trigger:hover,
html.bs-tablet body.site-basicbench .desktop-nav .dropdown-trigger[aria-expanded="true"] {
  color: #10283a !important;
  background: #edf0f2 !important;
  box-shadow: inset 3px 0 0 #315f7e;
}

html.bs-tablet body.site-basicbench .desktop-user-menu {
  border-top-color: rgba(18, 42, 62, .16);
}

html.bs-tablet body.site-basicbench .desktop-user-menu .user-trigger,
html.bs-tablet body.site-basicbench .desktop-lang-toggle {
  color: #40596c !important;
  border-color: rgba(18, 42, 62, .18) !important;
  background: #fffdf8 !important;
}
