/* Mobile Responsive Styles - FIXED VERSION
   Path: docs/styles/mobile.css
   Fixed hamburger menu with proper nav drawer
   ============================================= */

/* =====================================================
   DESKTOP - Keep nav visible above 1100px
   ===================================================== */

@media screen and (min-width: 1100px) {
  .md-header-nav { display: flex !important; }
  /* Hide mobile-only elements on desktop */
  .md-header__button[for="__drawer"],
  .md-nav__toggle,
  .md-toggle--drawer,
  #__drawer,
  .md-overlay { display: none !important; }
  /* Keep tabs visible on desktop */
  .md-tabs {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .md-tabs__list {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .md-tabs__item {
    display: block !important;
    visibility: visible !important;
  }
  .md-tabs__link {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* =====================================================
   MOBILE NAVIGATION - Under 1100px
   ===================================================== */

@media screen and (max-width: 1099px) {

  /* Mobile header base styles */
  .md-header {
    height: 3.5rem;
    padding: 0 0.5rem;
    position: fixed;
    width: 100%;
    z-index: 4;
  }

  .md-header__inner {
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
  }

  /* Hamburger button - order 4 (last) */
  .md-header__button[for="__drawer"] {
    display: flex !important;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #ffffff, #f0ede8);
    border-radius: 8px;
    box-shadow:
      2px 2px 6px rgba(26, 35, 50, 0.06),
      -2px -2px 6px rgba(255, 255, 255, 0.8);
    cursor: pointer;
    order: 4;
    flex-shrink: 0;
    margin-left: 0.25rem;
    margin-right: 0;
  }

  [data-md-color-scheme="slate"] .md-header__button[for="__drawer"] {
    background: linear-gradient(145deg, #2a3542, #222c3a);
    box-shadow:
      3px 3px 8px rgba(0, 0, 0, 0.3),
      -3px -3px 8px rgba(255, 255, 255, 0.03);
  }

  .md-header__button[for="__drawer"] svg {
    fill: #f59e0b;
  }

  /* Consistent header layout: Logo | Search | Theme | GitHub | Menu */

  /* Logo - always first (left) */
  .md-header__button.md-logo {
    order: 0;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }

  /* Search container - center space, prevent overlap */
  .md-header__inner .md-search {
    order: 1;
    display: flex !important;
    align-items: center;
    flex: 1 1 auto;
    max-width: 300px;
    min-width: 0; /* Allow shrinking */
    margin: 0 0.25rem;
    position: relative;
  }

  /* Search form - prevent icon/text overlap */
  .md-header__inner .md-search__form {
    display: flex !important;
    width: 100% !important;
    height: 28px !important;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 14px;
    position: relative;
    align-items: center;
  }

  /* Search input - proper padding to avoid icon */
  .md-header__inner .md-search__input {
    display: block !important;
    width: 100% !important;
    height: 28px !important;
    padding: 0 2rem 0 2rem !important; /* Left padding for search icon */
    background: transparent !important;
    border: none !important;
    font-size: 0.7rem !important;
    color: #2a2723 !important;
  }

  [data-md-color-scheme="slate"] .md-header__inner .md-search__form {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.15);
  }

  [data-md-color-scheme="slate"] .md-header__inner .md-search__input {
    color: #fdfdf9 !important;
  }

  /* Search icons - position absolutely to prevent overlap */
  .md-header__inner .md-search__icon {
    position: absolute !important;
    left: 0.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 1rem !important;
    height: 1rem !important;
    z-index: 2 !important;
    pointer-events: none !important;
  }

  /* Hide the search toggle button on mobile */
  .md-header__inner label.md-header__button[for="__search"] {
    display: none !important;
  }

  /* Theme toggle - order 2, always after search */
  label.md-header__button[for^="__palette_"] {
    display: none !important;
    order: 2;
    margin: 0 0.25rem;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: #fdfdf9;
    border-radius: 50%;
    box-shadow:
      2px 2px 5px rgba(26, 35, 50, 0.05),
      -2px -2px 5px rgba(255, 255, 255, 0.7);
    align-items: center;
    justify-content: center;
  }

  [data-md-color-scheme="slate"] label.md-header__button[for^="__palette_"] {
    background: #263244;
    box-shadow:
      2px 2px 6px rgba(0, 0, 0, 0.15),
      -2px -2px 6px rgba(255, 255, 255, 0.02);
  }

  /* Show only the toggle for switching TO the other theme */
  [data-md-color-scheme="default"] label.md-header__button[for="__palette_1"] {
    display: flex !important;
  }
  [data-md-color-scheme="slate"] label.md-header__button[for="__palette_0"] {
    display: flex !important;
  }

  /* Theme toggle icon */
  label.md-header__button[for^="__palette_"] svg {
    width: 14px;
    height: 14px;
    fill: #f59e0b !important;
  }

  /* GitHub source - order 3 */
  .md-source {
    display: inline-flex !important;
    order: 3;
    margin: 0 0.25rem;
    flex-shrink: 0;
    padding: 0.25rem 0.4rem;
    background: linear-gradient(135deg, #fff5e6 0%, #ffedcc 100%);
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    box-shadow:
      2px 2px 5px rgba(26, 35, 50, 0.04),
      -2px -2px 5px rgba(255, 255, 255, 0.7);
  }

  [data-md-color-scheme="slate"] .md-source {
    background: #263244;
    border: 1px solid rgba(251, 191, 36, 0.15);
    box-shadow:
      2px 2px 6px rgba(0, 0, 0, 0.15),
      -2px -2px 6px rgba(255, 255, 255, 0.02);
  }

  /* Hide repository text on mobile */
  .md-source__repository {
    display: none !important;
  }

  /* GitHub icon size */
  .md-source__icon svg {
    width: 14px;
    height: 14px;
  }

  /* Keep GitHub inline next to theme toggle (no fixed positioning) */
  .md-header__source,
  .md-header .md-source { position: static !important; margin-right: 0.25rem !important; }

  /* Fix GitHub icon color on mobile */
  .md-source__icon svg,
  .md-header .md-source__icon svg,
  .md-source svg {
    fill: #f59e0b !important;
  }

  [data-md-color-scheme="slate"] .md-source__icon svg,
  [data-md-color-scheme="slate"] .md-header .md-source__icon svg,
  [data-md-color-scheme="slate"] .md-source svg {
    fill: #fbbf24 !important;
  }

  /* Hide any GitHub/source block that theme may render inside drawer */
  .md-nav__source,
  .md-nav--primary .md-source,
  .md-sidebar--primary .md-source {
    display: none !important;
  }


  /* Medium view (tablet): consistent layout with more space */
  @media screen and (min-width: 601px) and (max-width: 1099px) {
    /* More spacing on tablets */
    .md-header__inner {
      gap: 0.5rem;
      padding: 0 1rem;
    }

    /* Search - wider on tablet */
    .md-header .md-search {
      max-width: 280px !important;
    }

    /* Larger buttons on tablet */
    .md-header__button[for="__drawer"],
    label.md-header__button[for^="__palette_"] {
      width: 2.25rem;
      height: 2.25rem;
    }

    /* Better spacing */
    .md-source {
      padding: 0.3rem 0.5rem;
    }
  }

  /* Force mobile drawer to be visible and styled */
  .md-sidebar--primary {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 242px !important;
    height: 100% !important;
    transform: translateX(-100%) !important;
    transition: transform .25s cubic-bezier(.4,0,.2,1) !important;
    z-index: 200 !important;
    background: #fff !important;
    overflow: hidden !important;
  }

  /* Show drawer when checkbox is checked - Material for MkDocs structure */
  .md-toggle--drawer:checked ~ .md-container .md-sidebar--primary,
  #__drawer:checked ~ .md-container .md-sidebar--primary,
  input[type="checkbox"]#__drawer:checked ~ .md-container .md-sidebar--primary {
    transform: translateX(0) !important;
  }

  /* Style the drawer content */
  .md-sidebar--primary .md-sidebar__scrollwrap {
    height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.3) transparent;
  }

  /* Custom scrollbar for webkit browsers */
  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar {
    width: 6px;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-track {
    background: transparent;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 3px;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.5);
  }

  .md-sidebar--primary .md-nav--primary {
    background: #fdfdf9 !important;
    height: 100% !important;
  }

  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav--primary {
    background: #1a2332 !important;
  }

  /* Overlay styling */
  .md-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transition: opacity .25s !important;
    background-color: rgba(0,0,0,.54) !important;
    opacity: 0 !important;
    z-index: 199 !important;
    pointer-events: none !important;
    cursor: pointer !important;
  }

  .md-toggle--drawer:checked ~ .md-overlay,
  #__drawer:checked ~ .md-overlay,
  input[type="checkbox"]#__drawer:checked ~ .md-overlay {
    opacity: 1 !important;
    pointer-events: auto !important;
    display: block !important;
  }

  /* Mobile nav header with logo */
  .md-nav--primary .md-nav__title:first-child,
  .md-sidebar--primary .md-nav__title:first-child {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(26, 35, 50, 0.1);
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    height: 60px;
    font-size: 0 !important; /* Hide text */
    color: transparent !important; /* Hide text */
    overflow: hidden;
  }

  /* Hide the text content but keep the container */
  .md-nav--primary .md-nav__title:first-child::after,
  .md-sidebar--primary .md-nav__title:first-child::after {
    display: none !important;
  }

  /* Hide any duplicate titles */
  .md-nav--primary .md-nav__title ~ .md-nav__title,
  .md-sidebar--primary .md-nav__title ~ .md-nav__title {
    display: none !important;
  }

  /* Hide any actual img logos that Material might inject */
  .md-nav--primary .md-nav__title img,
  .md-sidebar--primary .md-nav__title img,
  .md-nav--primary .md-logo img,
  .md-sidebar--primary .md-logo img,
  .md-nav--primary .md-nav__title .md-nav__button img,
  .md-sidebar--primary .md-nav__title .md-nav__button img {
    display: none !important;
  }

  /* Hide any text spans in the title */
  .md-nav--primary .md-nav__title span,
  .md-sidebar--primary .md-nav__title span,
  .md-nav--primary .md-nav__title .md-ellipsis,
  .md-sidebar--primary .md-nav__title .md-ellipsis {
    display: none !important;
  }

  /* Logo in drawer header - use pseudo element to show only icon */
  .md-nav--primary .md-nav__title:first-child::before,
  .md-sidebar--primary .md-nav__title:first-child::before {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    background: url('../logos/tenets_dark_icon_transparent_cropped.png') no-repeat center;
    background-size: contain;
    margin: 0 auto;
    position: relative;
    z-index: 1;
  }

  /* Light mode should use dark logo on amber background for contrast */
  [data-md-color-scheme="default"] .md-nav--primary .md-nav__title:first-child::before,
  [data-md-color-scheme="default"] .md-sidebar--primary .md-nav__title:first-child::before {
    background-image: url('../logos/tenets_dark_icon_transparent_cropped.png');
  }

  /* Dark mode uses dark logo too since background is amber */
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__title:first-child::before,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__title:first-child::before {
    background-image: url('../logos/tenets_dark_icon_transparent_cropped.png');
  }

  /* Ensure we're hiding ALL possible logo/title elements */
  .md-nav--primary *[class*="logo"],
  .md-sidebar--primary *[class*="logo"],
  .md-nav--primary .md-nav__title > *,
  .md-sidebar--primary .md-nav__title > *,
  .md-nav--primary .md-nav__title a,
  .md-sidebar--primary .md-nav__title a,
  .md-nav--primary .md-nav__title .md-nav__button,
  .md-sidebar--primary .md-nav__title .md-nav__button {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    font-size: 0 !important;
  }


  /* Navigation list container */
  .md-nav--primary .md-nav__list,
  .md-sidebar--primary .md-nav__list {
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    display: block !important;
  }

  /* Hide any nested titles or back buttons */
  .md-nav--primary .md-nav__item .md-nav__title,
  .md-sidebar--primary .md-nav__item .md-nav__title,
  .md-nav--primary .md-nav__back,
  .md-sidebar--primary .md-nav__back {
    display: none !important;
  }

  /* Navigation items - Minimal mobile styling */
  .md-nav--primary > .md-nav__list > .md-nav__item,
  .md-sidebar--primary > .md-nav__list > .md-nav__item {
    margin: 0 !important;
    display: block !important;
  }

  .md-nav--primary .md-nav__link,
  .md-sidebar--primary .md-nav__link {
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 400 !important;
    color: #2a2723 !important;
    display: block !important;
    transition: all 0.2s ease;
    text-decoration: none !important;
    position: relative !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    border-left: 3px solid transparent !important;
    overflow: hidden !important;
  }

  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__link {
    color: #f3f0e8 !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-left: 3px solid transparent !important;
  }

  .md-nav--primary .md-nav__link:hover,
  .md-nav--primary .md-nav__link:active,
  .md-sidebar--primary .md-nav__link:hover,
  .md-sidebar--primary .md-nav__link:active {
    background: rgba(245, 158, 11, 0.05) !important;
    color: #f59e0b !important;
    transform: none;
    box-shadow: none !important;
    border-left: 3px solid rgba(245, 158, 11, 0.3) !important;
  }

  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link:hover,
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link:active,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__link:hover,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__link:active {
    background: rgba(251, 191, 36, 0.08) !important;
    color: #fbbf24 !important;
    border-left: 3px solid rgba(251, 191, 36, 0.4) !important;
  }

  .md-nav--primary .md-nav__link--active,
  .md-sidebar--primary .md-nav__link--active {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #f59e0b !important;
    font-weight: 500;
    border: none !important;
    border-left: 3px solid #f59e0b !important;
    box-shadow: none !important;
  }

  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link--active,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__link--active {
    background: rgba(251, 191, 36, 0.12) !important;
    color: #fbbf24 !important;
    border: none !important;
    border-left: 3px solid #fbbf24 !important;
  }

  /* Remove glow effect - using simpler border-left instead */

  /* Remove icon decorations for cleaner look */

  /* Blog/Contact special styling - minimal */
  .md-nav--primary .md-nav__link[href*="blog"],
  .md-nav--primary .md-nav__link[href*="contact"],
  .md-sidebar--primary .md-nav__link[href*="blog"],
  .md-sidebar--primary .md-nav__link[href*="contact"] {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #f59e0b !important;
    font-weight: 500;
    margin: 0.5rem 0;
    padding: 0.75rem 1rem !important;
    border-radius: 0;
    border: none;
    border-left: 3px solid #f59e0b !important;
    box-shadow: none;
  }

  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link[href*="blog"],
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__link[href*="contact"],
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__link[href*="blog"],
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__link[href*="contact"] {
    background: rgba(251, 191, 36, 0.12) !important;
    color: #fbbf24 !important;
    border: none;
    border-left: 3px solid #fbbf24 !important;
  }

  /* Let Material theme handle overlay, just style it */
  [data-md-color-scheme="slate"] .md-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  /* Let MkDocs Material handle search positioning and overlay */


  /* Phones only: hide the right-hand TOC */
  @media screen and (max-width: 720px) {
    .md-sidebar--secondary { display: none !important; }
  }

  /* Small screens: more compact layout */
  @media screen and (max-width: 600px) {
    /* Tighter spacing on phones */
    .md-header__inner {
      gap: 0.2rem;
      padding: 0 0.4rem;
    }

    /* Compact search */
    .md-header__inner .md-search {
      flex: 1 1 auto;
      min-width: 0;
      max-width: 180px;
    }
    .md-header__inner .md-search__form {
      display: flex !important; /* keep form visible */
      width: 100% !important;
      height: 26px !important; /* very compact on mobile */
    }
    /* Adjust input for small screens */
    .md-header__inner .md-search__input {
      font-size: 0.65rem !important;
      padding: 0 1.8rem 0 0.4rem !important;
      height: 26px !important;
      line-height: 26px !important;
    }

    /* Compact GitHub/source: icon only */
    .md-header__source,
    .md-header .md-source { display: inline-flex !important; order: 3; }
    .md-header .md-source__repository { display: none !important; }
    .md-header .md-source__icon { margin: 0 !important; }

    /* Remove extra padding since we're using flexbox */
    .md-header__inner {
      padding: 0 0.5rem !important;
      justify-content: space-between;
    }
  }
}


/* =====================================================
   INSTALL COMMANDS WRAPPING ON SMALL SCREENS
   ===================================================== */
@media screen and (max-width: 768px) {
  /* Prefer wrapping for shell-like languages */
  .md-typeset .highlight[data-lang="bash"] pre,
  .md-typeset .highlight[data-lang="sh"] pre,
  .md-typeset .highlight[data-lang="shell"] pre,
  .md-typeset .highlight[data-lang="zsh"] pre,
  .md-typeset .highlight[data-lang="powershell"] pre,
  .md-typeset .highlight[data-lang="ps1"] pre,
  .md-typeset .highlight[data-lang="cmd"] pre {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* Fallback: if language attribute isn't present, allow wrapping inside pre > code */
  .md-typeset pre > code.language-bash,
  .md-typeset pre > code.language-sh,
  .md-typeset pre > code.language-shell,
  .md-typeset pre > code.language-zsh,
  .md-typeset pre > code.language-powershell,
  .md-typeset pre > code.language-cmd {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  /* Ensure code blocks fit viewport with smooth horizontal scroll when needed */
  .md-typeset .highlight,
  .md-typeset pre {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Slightly reduce code font size on mobile to increase fit */
  :root { --md-code-font-size: 0.85rem; }

  /* Let inline code wrap within paragraphs to avoid overflow */
  .md-typeset p code,
  .md-typeset li code,
  .md-typeset td code {
    white-space: break-spaces;
    word-break: break-word;
  }
}


/* =====================================================
   MOBILE CONTENT ADJUSTMENTS
   ===================================================== */

@media screen and (max-width: 1099px) {

  /* Content spacing to account for fixed header */
  .md-container {
    padding-top: 3.5rem;
  }

  .md-content {
    padding: 1rem;
    max-width: 100%;
  }

  .md-content__inner {
    margin: 0;
    padding: 0 0 2rem;
  }

  /* Typography adjustments */
  .md-typeset h1 {
    font-size: 1.75rem;
    margin: 1.5rem 0 1rem;
  }

  .md-typeset h2 {
    font-size: 1.375rem;
    margin: 1.25rem 0 0.75rem;
  }

  .md-typeset h3 {
    font-size: 1.125rem;
    margin: 1rem 0 0.5rem;
  }

  /* Terminal showcase on mobile */
  .terminal-showcase {
    margin: 1.5rem -1rem;
  }

  .terminal {
    border-radius: 0;
  }

  .terminal-body {
    padding: 1rem;
    font-size: 0.75rem;
    min-height: 200px;
    max-height: 350px;
  }

  /* Hero adjustments */
  .victorian-hero,
  .hero-section {
    min-height: calc(100vh - 3.5rem);
    padding: 1.5rem 1rem;
    margin-top: 3.5rem;
  }

  .lantern-container {
    width: 80px;
    height: 80px;
  }

  .hero-title {
    font-size: 2.25rem;
  }

  .hero-tagline {
    font-size: 1.1rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
  }

  /* Features grid on mobile */
  .features-grid,
  .why-tenets-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Installation section mobile overrides - FIXED CENTERING */
  .install-section {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    margin-left: 0;
    margin-right: 0;
    padding: 2rem 1rem;
  }

  .install-section .section-container {
    max-width: 100%;
    padding: 0 0.5rem;
  }

  .install-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
    margin: 1rem 0 !important;
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .install-card {
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0.5rem 0.4rem !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .install-card h3 {
    font-size: 0.65rem !important;
    margin-bottom: 0.3rem !important;
    line-height: 1.1 !important;
    word-wrap: break-word !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Shorter text for mobile */
  @media (max-width: 600px) {
    .install-card h3 span.full-text {
      display: none !important;
    }
    .install-card h3 span.short-text {
      display: inline !important;
    }
  }

  /* Default: show full text on larger screens */
  .install-card h3 span.short-text {
    display: none;
  }

  .install-card .code-block {
    position: relative !important;
    padding: 0.4rem !important;
    padding-right: 2.2rem !important;
    overflow: hidden !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .install-card .code-block code {
    font-size: 0.5rem !important;
    white-space: nowrap !important;
    overflow-x: auto !important;
    display: block !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .install-card .install-note {
    font-size: 0.6rem !important;
    line-height: 1.15 !important;
    word-wrap: break-word !important;
    padding: 0 0.2rem !important;
  }

  .install-card .copy-btn {
    position: absolute !important;
    top: 0.3rem !important;
    right: 0.3rem !important;
    padding: 0.15rem 0.25rem !important;
    font-size: 0.45rem !important;
    z-index: 10 !important;
  }

  /* Installation CTA buttons - mobile compact */
  .install-cta {
    flex-direction: row !important;
    gap: 0.5rem !important;
    margin-top: 1.5rem !important;
    padding: 0 0.5rem !important;
  }

  .install-cta .btn-primary.large,
  .install-cta .btn-secondary.large {
    min-width: auto !important;
    padding: 0.6rem 0.8rem !important;
    font-size: 0.75rem !important;
    flex: 1 !important;
    max-width: 150px !important;
  }

  .install-cta .btn-primary.large svg,
  .install-cta .btn-secondary.large svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Hide text on very small screens, show only icons */
  @media (max-width: 380px) {
    .install-cta .btn-secondary.large span {
      display: none !important;
    }
    .install-cta .btn-primary.large {
      font-size: 0.7rem !important;
    }
  }

  /* Workflow on mobile */
  .workflow-diagram {
    flex-direction: column;
  }

  .workflow-arrow {
    transform: rotate(90deg);
    margin: 0.5rem 0;
  }

  /* Prevent body scroll when drawer is open */
  body:has(.md-toggle--drawer:checked),
  body.drawer-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
  }
}

/* =====================================================
   SMALL PHONE - 480px and below
   ===================================================== */

@media screen and (max-width: 480px) {

  .md-header {
    height: 3rem;
  }

  .md-header__title {
    font-size: 1.1rem;
  }

  .md-header__button[for="__drawer"] {
    width: 2rem;
    height: 2rem;
  }

  /* Installation CTA buttons - ultra compact for small phones */
  .install-cta {
    gap: 0.4rem !important;
    margin-top: 1rem !important;
    padding: 0 0.25rem !important;
  }

  .install-cta .btn-primary.large,
  .install-cta .btn-secondary.large {
    padding: 0.45rem 0.6rem !important;
    font-size: 0.65rem !important;
    border-radius: 8px !important;
    max-width: 140px !important;
  }

  .install-cta .btn-primary.large svg,
  .install-cta .btn-secondary.large svg {
    width: 12px !important;
    height: 12px !important;
  }

  /* Shorten button text on small screens */
  .install-cta .btn-secondary.large span {
    font-size: 0.65rem !important;
  }

  .md-nav--primary,
  .md-sidebar--primary {
    width: 90% !important;
    max-width: 280px !important;
  }

  .hero-title {
    font-size: 1.875rem;
  }

  .lantern-container {
    width: 60px;
    height: 60px;
  }

  /* Adjust hero spacing for smaller header */
  .victorian-hero,
  .hero-section {
    margin-top: 3rem;
    min-height: calc(100vh - 3rem);
  }

  /* Content spacing adjustment */
  .md-container {
    padding-top: 3rem;
  }

  /* Fix install command centering on mobile */
  .hero-install,
  .install-command {
    width: auto !important;
    max-width: fit-content !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: inline-flex !important;
  }

  /* Ensure CTA section centers properly */
  .cta-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* Fix install commands on very small screens */
  @media screen and (max-width: 480px) {
    .hero-install,
    .install-command {
      padding: 0.625rem 0.875rem !important;
      font-size: 0.9rem !important;
    }

    .hero-install code,
    .install-command code {
      font-size: 0.85rem !important;
    }
  }
}
