/**
 * FENN mobile bottom navigation — retail IA chrome only.
 * Hidden on desktop so existing top links keep working.
 */

:root {
  --touch-min: 44px;
  --mobile-nav-h: 3.75rem;
}

.mobile-nav {
  display: none;
}

.mobile-capture-cta {
  display: none;
}

@media (max-width: 720px) {
  body {
    padding-bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 0.5rem);
  }

  .shell {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 1.25rem;
  }

  .controls .ghost:not(.mobile-keep) {
    display: none;
  }

  .controls select,
  .controls button,
  .controls a.ghost.mobile-keep {
    min-height: var(--touch-min);
  }

  .controls select {
    min-width: 0;
    flex: 1 1 auto;
  }

  .controls button {
    min-width: var(--touch-min);
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    height: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px));
    padding: 0.2rem 0.35rem env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    justify-content: space-around;
    align-items: stretch;
    box-shadow: 0 -8px 24px rgba(28, 25, 21, 0.06);
  }

  .mobile-nav a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    padding: 0.35rem 0.25rem;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav a:hover,
  .mobile-nav a:focus-visible {
    color: var(--text);
    background: var(--bg-soft);
    outline: none;
  }

  .mobile-nav a:focus-visible {
    box-shadow: 0 0 0 2px var(--focus-ring);
  }

  .mobile-nav a[aria-current="page"] {
    color: var(--accent);
  }

  .mobile-nav .nav-icon {
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid currentColor;
    border-radius: 6px;
    opacity: 0.9;
  }

  .mobile-nav a[data-nav="home"] .nav-icon {
    border-radius: 50%;
  }

  .mobile-nav a[data-nav="month"] .nav-icon {
    border-radius: 4px;
    background:
      linear-gradient(currentColor, currentColor) center 30% / 60% 2px no-repeat,
      linear-gradient(currentColor, currentColor) center 55% / 60% 2px no-repeat,
      linear-gradient(currentColor, currentColor) center 80% / 40% 2px no-repeat;
  }

  .mobile-nav a[data-nav="coming"] .nav-icon {
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg) scale(0.85);
  }

  .mobile-nav a[data-nav="outlook"] .nav-icon {
    border-radius: 50%;
    background:
      linear-gradient(currentColor, currentColor) center / 2px 55% no-repeat,
      linear-gradient(currentColor, currentColor) center / 55% 2px no-repeat;
  }

  .mobile-nav a[data-nav="activity"] .nav-icon {
    border-radius: 50%;
    background:
      linear-gradient(currentColor, currentColor) center 35% / 55% 2px no-repeat,
      linear-gradient(currentColor, currentColor) center 65% / 55% 2px no-repeat;
  }

  .mobile-nav a[data-nav="plan"] .nav-icon {
    border-radius: 3px;
    background:
      linear-gradient(currentColor, currentColor) 30% center / 2px 55% no-repeat,
      linear-gradient(currentColor, currentColor) 50% center / 2px 55% no-repeat,
      linear-gradient(currentColor, currentColor) 70% center / 2px 55% no-repeat;
  }

  .mobile-capture-cta {
    display: block;
    margin: 0.85rem 0 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-elev);
    text-decoration: none;
    color: var(--text);
    min-height: var(--touch-min);
  }

  .mobile-capture-cta strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 650;
  }

  .mobile-capture-cta span {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.35;
  }

  /* Stacked summary cards instead of desktop table grids */
  .table .row:not(.head) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.75rem;
    margin: 0 0 0.65rem;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    align-items: start;
  }

  .table .row:not(.head) > :first-child {
    grid-column: 1 / -1;
    font-weight: 600;
  }

  .table .row:not(.head) > [data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
  }

  .table .row:not(.head) > .desc,
  .table .row:not(.head) > [data-label="Context"] {
    grid-column: 1 / -1;
  }

  .table .row.head {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav a {
    transition: none;
  }
}
