/* ═══════════════════════════════════════════════════════
   TECH/INSIDE — MOBILE.CSS
   Full mobile layout: 320px → 768px
   Layered on top of style.css
═══════════════════════════════════════════════════════ */

/* ── MOBILE TOKENS ───────────────────────────────────── */
:root {
  --ti-nav-h:      52px;
  --ti-ticker-h:   28px;
  --ti-safe-top:   calc(var(--ti-nav-h) + var(--ti-ticker-h));
}

/* ═══════════════════════════════════════════════════════
   NAV — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-nav {
    height: var(--ti-nav-h);
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 300;
  }

  /* Logo stays visible */
  .ti-logo-wrap { margin-right: auto; }
  .ti-logo-wrap img { height: 24px; }

  /* Hide desktop links and CTA */
  .ti-nav__links,
  .ti-nav__right { display: none; }

  /* Hamburger button */
  .ti-nav__toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    cursor: pointer;
    background: none;
    border: none;
    flex-shrink: 0;
  }
  .ti-nav__toggle span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--ti-text);
    transition: transform .25s ease, opacity .2s ease;
    transform-origin: center;
  }

  /* Animated X state */
  .ti-nav__toggle.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .ti-nav__toggle.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .ti-nav__toggle.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  /* Mobile nav drawer */
  .ti-nav__links {
    position: fixed;
    top: var(--ti-nav-h);
    left: 0; right: 0;
    background: var(--ti-white);
    border-bottom: 2px solid var(--ti-text);
    z-index: 299;
    flex-direction: column;
    gap: 0;
    /* Hidden by default */
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .2s ease;
  }
  .ti-nav__links.is-open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .ti-nav__links a {
    height: 52px;
    padding: 0 20px;
    border-right: none;
    border-bottom: 1px solid var(--ti-line);
    font-size: .75rem;
    letter-spacing: .06em;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .ti-nav__links a:first-child { border-left: none; }
  .ti-nav__links a::after { content: '→'; color: var(--ti-dim); font-size: .625rem; }
  .ti-nav__links a:hover::after { content: '→'; color: var(--ti-blue); }
  /* Remove desktop underline effect on mobile */
  .ti-nav__links a:hover::before,
  .ti-nav__links a[aria-current="page"]::before { display: none; }

  /* Overlay behind drawer */
  .ti-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,15,14,.4);
    z-index: 298;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  .ti-nav-overlay.is-open { opacity: 1; pointer-events: auto; }
}

/* ═══════════════════════════════════════════════════════
   TICKER — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ti-ticker { height: var(--ti-ticker-h); }
  .ti-ticker__badge {
    padding: 0 12px;
    font-size: .5rem;
    letter-spacing: .1em;
    gap: 5px;
  }
  .ti-ticker__badge::before { width: 4px; height: 4px; }
  .ti-ticker__content { font-size: .625rem; padding: 0 14px; gap: 14px; }
  .ti-ticker__sep { margin: 0 8px; }
}

/* ═══════════════════════════════════════════════════════
   HERO — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-hero {
    grid-template-columns: 1fr;
    border-bottom: 1px solid var(--ti-line);
  }

  .ti-hero__main { border-right: none; }

  /* Taller image ratio on mobile — feels more editorial */
  .ti-hero__img,
  .ti-hero__img img {
    aspect-ratio: 4/3;
  }
  .ti-hero__img--placeholder { aspect-ratio: 4/3; }

  .ti-hero__body { padding: 18px 16px 16px; }

  .ti-hero__title { font-size: clamp(1.3rem, 6vw, 1.7rem); margin-bottom: 14px; }

  /* Verdict block — stack on mobile */
  .ti-verdict {
    flex-direction: column;
    gap: 10px;
    padding: 12px 0;
  }
  .ti-verdict__divider { width: 100%; height: 1px; }
  .ti-score { font-size: 1.75rem; }

  /* Verdict tags — allow natural wrap */
  .ti-vtags { gap: 4px; }
  .ti-vtag { font-size: .5625rem; padding: 3px 7px; }

  .ti-hero__meta { flex-wrap: wrap; gap: 6px; font-size: .5rem; }
  .ti-hero__meta span::before { content: '/ '; }

  /* Sidebar — horizontal scroll strip on mobile instead of stacking */
  .ti-sidebar {
    border-top: 2px solid var(--ti-blue);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ti-sidebar::-webkit-scrollbar { display: none; }
  .ti-sidebar__hd { flex-shrink: 0; white-space: nowrap; }

  /* Convert sidebar items to horizontal cards */
  .ti-sidebar > .ti-si {
    display: inline-flex;
    flex-direction: column;
    width: 220px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--ti-line);
    vertical-align: top;
  }

  /* Restore normal flow via flex row on the parent */
  .ti-sidebar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
  }
  .ti-sidebar__hd {
    display: none; /* hidden — space too tight */
  }
}

/* ═══════════════════════════════════════════════════════
   BLUE RULE — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ti-blue-rule { height: 2px; }
}

/* ═══════════════════════════════════════════════════════
   HIGHLIGHT ROW — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-hl-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .ti-hl {
    padding: 14px 16px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--ti-line);
  }

  /* Orange reveal still works on tap — keep the ::before */
  .ti-hl::before { height: 2px; }

  .ti-hl__tag { flex-shrink: 0; min-width: 70px; }
  .ti-hl__title { font-size: .8125rem; flex: 1; }
  .ti-hl__meta { display: none; } /* too cramped on mobile */
}

/* ═══════════════════════════════════════════════════════
   SECTION BAR + FILTERS — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-secbar {
    padding: 8px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .ti-secbar__label { font-size: .5rem; }
  .ti-secbar__link { margin-left: auto; font-size: .5rem; }

  /* Filters — horizontal scroll */
  .ti-filters {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    margin-left: 0;
    padding-bottom: 2px;
  }
  .ti-filters::-webkit-scrollbar { display: none; }
  .ti-filter {
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: .5rem;
    white-space: nowrap;
  }
}

/* ═══════════════════════════════════════════════════════
   ARTICLE GRID — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* 2 columns on tablet-ish, 1 on small */
  .ti-grid-4 { grid-template-columns: repeat(2,1fr); }
  .ti-grid-3 { grid-template-columns: repeat(2,1fr); }

  .ti-card { padding: 12px; }
  .ti-card__thumb { margin-bottom: 10px; }
  .ti-card__title { font-size: .75rem; }
  .ti-card__date { font-size: .5rem; }

  /* Square deco — smaller on mobile */
  .ti-card__thumb::after { width: 16px; height: 16px; }
  .ti-card__thumb::before { width: 13px; height: 13px; bottom: 3px; right: 3px; }
}

@media (max-width: 420px) {
  .ti-grid-4,
  .ti-grid-3 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   BRAND STRIP — MOBILE (horizontal scroll)
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-brands {
    padding: 10px 16px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Fade out right edge to hint scrollability */
    -webkit-mask-image: linear-gradient(90deg, black 85%, transparent 100%);
    mask-image: linear-gradient(90deg, black 85%, transparent 100%);
  }
  .ti-brands::-webkit-scrollbar { display: none; }
  .ti-brands__label { flex-shrink: 0; }
  .ti-brand-pill { flex-shrink: 0; font-size: .5rem; padding: 4px 10px; }
}

/* ═══════════════════════════════════════════════════════
   ARTICLE PAGE — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-article-wrap { max-width: 100%; }

  /* Full bleed hero image */
  .ti-article-hero img {
    aspect-ratio: 16/9;
    width: 100%;
  }

  /* Single column — no sidebar */
  .ti-article-layout {
    grid-template-columns: 1fr;
    border-left: none;
    border-right: none;
  }

  /* Hide desktop TOC sidebar */
  .ti-toc { display: none; }

  .ti-article-header { padding: 18px 16px 14px; }
  .ti-article-header h1 { font-size: clamp(1.4rem, 6vw, 1.8rem); }

  /* Verdict on article page */
  .ti-verdict--article {
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .ti-article-meta { font-size: .5rem; gap: 6px; }
  .ti-article-body { padding: 18px 16px; }
  .ti-article-body p { font-size: 1rem; }
  .ti-article-body h2 { font-size: 1.25rem; margin: 1.75rem 0 .875rem; }
  .ti-article-body h3 { font-size: 1.05rem; margin: 1.25rem 0 .625rem; }
  .ti-article-body blockquote { padding: 10px 14px; }

  /* Mobile TOC drawer — shown on mobile/tablet only */
  /* display:none on desktop is controlled in style.css patch */
  .ti-toc-mobile {
    background: var(--ti-white);
    border-bottom: 1px solid var(--ti-line);
  }
  .ti-toc-mobile__toggle {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ti-bg2);
    border: none;
    cursor: pointer;
    font-family: var(--ti-font-mono);
    font-size: .5625rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--ti-muted);
  }
  .ti-toc-mobile__toggle::before { content: '//'; color: var(--ti-blue); margin-right: 6px; }
  .ti-toc-mobile__toggle .ti-toc-arrow {
    font-size: .75rem;
    color: var(--ti-dim);
    transition: transform .2s ease;
  }
  .ti-toc-mobile__toggle.is-open .ti-toc-arrow { transform: rotate(180deg); }
  .ti-toc-mobile__content {
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease, padding .2s ease;
  }
  .ti-toc-mobile__content.is-open {
    max-height: 400px;
    padding: 12px 16px;
    overflow-y: auto;
  }
  .ti-toc-mobile__content a {
    display: block;
    font-family: var(--ti-font-mono);
    font-size: .625rem;
    color: var(--ti-muted);
    padding: 6px 0 6px 10px;
    border-left: 2px solid transparent;
    transition: all .12s;
    line-height: 1.4;
  }
  .ti-toc-mobile__content a:hover,
  .ti-toc-mobile__content a.is-active {
    color: var(--ti-blue);
    border-left-color: var(--ti-blue);
  }
  .ti-toc-mobile__content a.ti-toc__h3 {
    padding-left: 20px;
    font-size: .5625rem;
    color: var(--ti-dim);
  }

  /* FAQ block */
  .ti-faq-item { padding: 16px; }
  .ti-faq-q { font-size: .9375rem; }
  .ti-faq-a { padding-left: 24px; font-size: .9375rem; }
}

/* ═══════════════════════════════════════════════════════
   BRAND DIRECTORY — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-archive-header { padding: 18px 16px; flex-direction: column; gap: 4px; }
  .ti-archive-header h1 { font-size: 1.4rem; }

  .ti-brand-grid { grid-template-columns: repeat(2,1fr); }
  .ti-brand-card { padding: 14px; }
  .ti-brand-card__logo { width: 44px; height: 44px; padding: 6px; }
  .ti-brand-card__name { font-size: .875rem; }
  .ti-brand-card__score { font-size: 1rem; }

  /* Brand page header */
  .ti-brand-header {
    grid-template-columns: 70px 1fr;
    gap: 16px;
    padding: 18px 16px;
  }
  .ti-brand-header__logo { width: 70px; height: 70px; }
  .ti-brand-header__name { font-size: 1.4rem; }
  .ti-brand-header__meta { flex-wrap: wrap; gap: 8px; }

  /* Scores — 2×2 on mobile */
  .ti-brand-scores { grid-template-columns: repeat(2,1fr); }
  .ti-brand-score { padding: 12px 14px; }
  .ti-brand-score__num { font-size: 1.4rem; }

  /* Pros/cons — stack */
  .ti-brand-proscons { grid-template-columns: 1fr; }
  .ti-brand-pros, .ti-brand-cons { padding: 16px; }
}

@media (max-width: 480px) {
  .ti-brand-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════
   SECTION BAR — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ti-secbar { padding: 8px 16px; }
}

/* ═══════════════════════════════════════════════════════
   FOOTER — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .ti-footer__top {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 28px 16px;
  }
  .ti-footer__brand img { height: 22px; }
  .ti-footer__desc { font-size: .75rem; }
  .ti-footer__cols {
    grid-template-columns: repeat(2,1fr);
    gap: 20px;
  }
  .ti-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
  }
  .ti-footer__menu { flex-wrap: wrap; gap: 12px; }
}

@media (max-width: 480px) {
  .ti-footer__cols { grid-template-columns: 1fr; }
  .ti-footer__menu { gap: 10px; }
}

/* ═══════════════════════════════════════════════════════
   PAGINATION — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ti-pagination { padding: 20px 16px; }
  .ti-pagination a,
  .ti-pagination span { padding: 7px 10px; font-size: .5rem; }
}

/* ═══════════════════════════════════════════════════════
   SEARCH / 404 — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ti-search-header { padding: 18px 16px; }
  .ti-search-header h1 { font-size: 1.2rem; }
  .ti-no-results { padding: 32px 16px; }
  .ti-404 { padding: 48px 16px; }
  .ti-404__code { font-size: 4rem; }
  .ti-404 h1 { font-size: 1.25rem; }
}

/* ═══════════════════════════════════════════════════════
   COMMENTS — MOBILE
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ti-comments { padding: 20px 16px; }
}

/* ═══════════════════════════════════════════════════════
   TABLET BREAKPOINT (769px–1100px)
═══════════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1100px) {

  /* Nav — show links, hide toggle */
  .ti-nav { padding: 0 20px; }
  .ti-nav__links a { padding: 0 10px; font-size: .625rem; }
  .ti-nav__toggle { display: none; }
  .ti-nav__right { display: flex; }

  /* Hero — stack on tablet */
  .ti-hero { grid-template-columns: 1fr; }
  .ti-hero__main { border-right: none; border-bottom: 1px solid var(--ti-line); }
  .ti-hero__img, .ti-hero__img img { aspect-ratio: 16/7; }
  .ti-hero__body { padding: 22px 24px 20px; }
  .ti-hero__title { font-size: 1.6rem; }

  /* Sidebar horizontal on tablet */
  .ti-sidebar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-top: 2px solid var(--ti-blue);
    -webkit-overflow-scrolling: touch;
  }
  .ti-sidebar::-webkit-scrollbar { display: none; }
  .ti-sidebar__hd { display: none; }
  .ti-si {
    min-width: 240px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--ti-line);
  }

  /* Grid 3 cols on tablet */
  .ti-grid-4 { grid-template-columns: repeat(3,1fr); }

  /* Highlight row — 3 cols still fine */
  .ti-hl-row { grid-template-columns: repeat(3,1fr); }

  /* Article — single col, no TOC sidebar */
  .ti-article-layout { grid-template-columns: 1fr; }
  .ti-toc { display: none; }

  /* Brand grid */
  .ti-brand-grid { grid-template-columns: repeat(3,1fr); }
  .ti-brand-scores { grid-template-columns: repeat(2,1fr); }

  /* Footer */
  .ti-footer__top { grid-template-columns: 220px 1fr; gap: 32px; }
  .ti-footer__cols { grid-template-columns: repeat(2,1fr); }
}

/* ═══════════════════════════════════════════════════════
   SAFE AREA (iPhone notch / Dynamic Island)
═══════════════════════════════════════════════════════ */
@supports (padding: max(0px)) {
  .ti-nav {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .ti-brands {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .ti-footer__bottom {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* ═══════════════════════════════════════════════════════
   TOUCH IMPROVEMENTS
═══════════════════════════════════════════════════════ */
@media (hover: none) {
  /* On touch devices, show card hover states immediately on tap */
  .ti-card:active { background: var(--ti-blue-light); }
  .ti-card:active::after { transform: scaleX(1); }
  .ti-hl:active::before { transform: scaleX(1); }
  .ti-si:active { background: var(--ti-blue-light); }
  .ti-brand-card:active { background: var(--ti-blue-light); }

  /* Remove hover-only effects that don't work on touch */
  .ti-card__thumb img { transition: none; }
}

/* ═══════════════════════════════════════════════════════
   REDUCED MOTION
═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ti-ticker__content { animation: none; }
  .ti-nav__links { transition: none; }
  .ti-nav__toggle span { transition: none; }
  .ti-toc-mobile__content { transition: none; }
  .ti-hl::before { transition: none; }
  .ti-card::after { transition: none; }
}
