/* ==========================================================================
   WayToType Comprehensive Responsive Stylesheet
   Ultra-optimized mobile layouts, zero-wasted margins, fluid grids
   ========================================================================== */

/* Tablet Breakpoint (<= 1024px) */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .typing-tools-grid,
  .guides-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .seo-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .device-guides-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile & Tablet Portrait (<= 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }

  /* Reduce Left & Right Gutters on Mobile */
  .container {
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }

  /* Header & Navigation */
  .site-header {
    height: var(--header-height);
  }

  .header-container {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .brand-icon-wrapper {
    width: 34px;
    height: 34px;
  }

  .brand-name-main {
    font-size: 1.15rem;
  }

  .brand-name-sub {
    font-size: 0.52rem;
    letter-spacing: 0.08em;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-medium);
    padding: 1rem 0.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
  }

  .nav-menu.open {
    display: flex;
    animation: mobileMenuSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes mobileMenuSlide {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .nav-link {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
  }

  .mobile-menu-btn {
    display: flex;
  }

  /* Hero Section */
  .hero-section {
    padding: 2.25rem 0 1.5rem;
  }

  .hero-breadcrumbs {
    margin-bottom: 0.85rem;
  }

  .hero-badge {
    margin-bottom: 0.85rem;
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
  }

  .hero-title {
    font-size: clamp(1.65rem, 5.5vw, 2.25rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.65rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    padding: 0 0.25rem;
  }

  /* Search Bar */
  .search-wrapper {
    margin-bottom: 1.25rem;
  }

  .search-box {
    padding: 0.65rem 0.85rem;
  }

  .search-shortcut {
    display: none;
  }

  .search-input {
    font-size: 0.95rem;
  }

  /* Realtime Search Dropdown on Mobile */
  .search-realtime-dropdown {
    max-height: 360px;
    padding: 0.4rem;
  }

  .search-realtime-row {
    padding: 0.6rem 0.65rem;
    gap: 0.65rem;
  }

  .search-row-glyph {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 1.4rem;
  }

  .search-row-name {
    font-size: 0.84rem;
  }

  .shortcut-pill {
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
  }

  .pill-label {
    font-size: 0.58rem;
  }

  .pill-val {
    font-size: 0.65rem;
  }

  .btn-search-copy {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    min-width: 64px;
  }

  /* Quick Tags Pills */
  .quick-tags-wrapper {
    gap: 0.35rem;
    margin-bottom: 1.5rem;
  }

  .quick-tag-chip {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
  }

  /* Category Filter Tabs & Horizontal Scroll */
  .category-filter-bar,
  .category-tabs {
    gap: 0.4rem;
    padding-bottom: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .category-tab-btn {
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    flex-shrink: 0;
  }

  /* Symbols Grid on Mobile */
  .symbols-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 0.45rem;
  }

  .symbol-card {
    padding: 0.75rem 0.35rem 0.5rem;
  }

  .symbol-char {
    font-size: 1.75rem;
    margin-bottom: 0.35rem;
  }

  .symbol-name {
    font-size: 0.68rem;
  }

  .symbol-alt {
    font-size: 0.65rem;
  }

  /* Alt Codes Grid & Table */
  .alt-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.5rem;
  }

  .alt-card {
    padding: 0.75rem 0.55rem;
  }

  .alt-card-char {
    font-size: 1.75rem;
  }

  .alt-codes-table-container,
  .seo-comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-radius: var(--radius-md);
  }

  .altcode-table th,
  .altcode-table td,
  .seo-comparison-table th,
  .seo-comparison-table td {
    padding: 0.55rem 0.65rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  /* Multi-Symbol Workspace Tray (Mobile Responsive) */
  .symbol-workspace,
  .workspace-tray {
    padding: 0.85rem 0.65rem !important;
    margin-bottom: 1.5rem !important;
  }

  .workspace-header {
    margin-bottom: 0.5rem;
  }

  .workspace-body {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }

  .workspace-input {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 1.1rem !important;
    padding: 0.65rem 0.75rem !important;
    min-height: 46px !important;
  }

  .workspace-actions {
    display: flex !important;
    flex-direction: row !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .workspace-btn,
  .workspace-actions .btn {
    flex: 1 !important;
    width: 50% !important;
    min-width: 0 !important;
    justify-content: center !important;
    padding: 0.65rem 0.65rem !important;
    font-size: 0.86rem !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Accent Letters Builder on Mobile */
  .accent-builder-panel {
    padding: 1rem 0.65rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.75rem;
  }

  .base-letters-row {
    gap: 0.25rem;
    margin-bottom: 1.25rem;
  }

  .base-letter-btn {
    width: 34px;
    height: 34px;
    font-size: 0.92rem;
    border-radius: var(--radius-sm);
  }

  .accent-types-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 0.35rem;
    margin-bottom: 1.25rem;
  }

  .accent-type-btn {
    padding: 0.45rem 0.2rem;
  }

  .accent-type-symbol {
    font-size: 1.15rem;
    height: 18px;
  }

  .accent-type-name {
    font-size: 0.58rem;
  }

  .builder-previews-wrapper {
    gap: 0.65rem;
  }

  .builder-preview-box {
    width: 85px;
    height: 95px;
  }

  .builder-glyph {
    font-size: 2rem;
  }

  .builder-actions-group {
    flex-direction: column;
    width: 100%;
  }

  .builder-actions-group .btn {
    width: 100%;
  }

  .quick-accent-grid {
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 0.35rem;
  }

  .quick-accent-btn {
    padding: 0.45rem 0.2rem;
    font-size: 1.1rem;
  }

  /* Typing Tools & Guides on Mobile */
  .typing-tools-grid,
  .guides-cards-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .tool-card,
  .guide-card {
    padding: 1.25rem 0.85rem;
  }

  /* ==========================================================================
     SEO Content & Authority Sections on Mobile (Zero Wasted Space)
     ========================================================================== */
  .seo-content-container,
  .seo-content-section {
    margin-top: 2rem !important;
    gap: 1.5rem !important;
  }

  .seo-block,
  .seo-article-card {
    padding: 1.25rem 0.75rem !important;
    border-radius: var(--radius-lg) !important;
    margin-bottom: 1.25rem !important;
  }

  .seo-header {
    margin-bottom: 1.25rem !important;
  }

  .seo-tag {
    font-size: 0.75rem !important;
    padding: 0.25rem 0.65rem !important;
    margin-bottom: 0.65rem !important;
  }

  .seo-title,
  .seo-article-title {
    font-size: clamp(1.35rem, 5vw, 1.65rem) !important;
    line-height: 1.3 !important;
    margin-bottom: 0.5rem !important;
  }

  .seo-subtitle,
  .seo-article-subtitle {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
  }

  .device-guides-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    margin-top: 1rem !important;
  }

  .device-card {
    padding: 1rem 0.75rem !important;
    border-radius: var(--radius-md) !important;
  }

  .device-card-header {
    gap: 0.6rem !important;
    margin-bottom: 0.75rem !important;
  }

  .device-icon-box {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
  }

  .device-card-title {
    font-size: 1.05rem !important;
  }

  .device-steps {
    padding-left: 0 !important;
    gap: 0.55rem !important;
    font-size: 0.86rem !important;
  }

  .device-steps li {
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
  }

  .device-steps li::before {
    margin-right: 0.35rem !important;
    position: static !important;
  }

  .seo-features-grid {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
    margin-top: 1rem !important;
  }

  .seo-feature-card {
    padding: 0.9rem 0.75rem !important;
  }

  /* Mobile Tables & Comparison Grids */
  .table-responsive-wrapper,
  .seo-comparison-table-wrapper,
  .currency-table-wrapper,
  .altcode-table-wrapper {
    margin: 1.25rem 0 !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-subtle) !important;
  }

  .reference-styled-table,
  .seo-comparison-table,
  .currency-table,
  .altcode-table {
    min-width: 560px !important;
    font-size: 0.85rem !important;
  }

  .reference-styled-table th,
  .seo-comparison-table th,
  .currency-table th,
  .altcode-table th {
    padding: 0.75rem 0.85rem !important;
    font-size: 0.78rem !important;
  }

  .reference-styled-table td,
  .seo-comparison-table td,
  .currency-table td,
  .altcode-table td {
    padding: 0.75rem 0.85rem !important;
  }

  .faq-accordion,
  .faq-container,
  .faq-list {
    gap: 0.65rem !important;
  }

  .faq-item {
    border-radius: var(--radius-md) !important;
  }

  .faq-question {
    padding: 1rem 0.9rem !important;
    font-size: 0.95rem !important;
    line-height: 1.35 !important;
  }

  .faq-answer {
    padding: 0 0.9rem 1rem !important;
    font-size: 0.88rem !important;
    line-height: 1.6 !important;
  }

  /* Safe bullet indentation for mobile & tablets */
  ul:not(.nav-menu):not(.footer-links):not(.category-tabs):not(.device-steps),
  ol:not(.nav-menu):not(.footer-links),
  .seo-bullet-list,
  .seo-section ul:not(.nav-menu):not(.footer-links):not(.category-tabs):not(.device-steps) {
    padding-left: 1.5rem !important;
    margin-left: 0.35rem !important;
  }

  /* Footer on Mobile */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
}

/* Extra Small Devices (<= 480px) */
@media (max-width: 480px) {
  .container {
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
  }

  .header-container {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  .hero-section {
    padding: 1.5rem 0 1.25rem;
  }

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

  .hero-subtitle {
    font-size: 0.86rem;
  }

  .seo-block,
  .seo-article-card {
    padding: 1.25rem 0.95rem !important;
  }

  .device-card {
    padding: 1rem 0.85rem !important;
  }

  /* Safe bullet indentation on mobile */
  ul:not(.nav-menu):not(.footer-links):not(.category-tabs):not(.device-steps),
  ol:not(.nav-menu):not(.footer-links),
  .seo-bullet-list,
  .seo-section ul:not(.nav-menu):not(.footer-links):not(.category-tabs):not(.device-steps) {
    padding-left: 1.4rem !important;
    margin-left: 0.25rem !important;
  }

  .seo-bullet-list li,
  .seo-section ul li {
    padding-left: 0.25rem !important;
  }

  .base-letters-row {
    gap: 0.2rem;
  }

  .base-letter-btn {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .accent-types-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.3rem;
  }

  .symbols-grid {
    grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
    gap: 0.35rem;
  }

  .symbol-char {
    font-size: 1.55rem;
  }

  .popular-symbols-grid {
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 0.35rem;
  }

  .popular-symbol-card {
    padding: 0.5rem 0.2rem;
  }

  .quick-copy-grid {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.3rem;
  }
}
