/**
 * tablet.css
 * Tablet-only visual & layout overrides (max-width: 1024px)
 * Loaded ONLY when viewport matches, keeping desktop unchanged.
 * 
 * IMPORTANT: These styles use equal or higher specificity to override
 * desktop styles without modifying desktop CSS files.
 */

@media screen and (max-width: 1024px) {
  /* === ROOT VARIABLES FOR TABLET === */
  :root {
    --tablet-base-font-size: 16px;
    --tablet-container-max-width: 920px;
    --tablet-touch-target: 48px;
    --tablet-spacing-unit: 16px;
  }

  html {
    font-size: var(--tablet-base-font-size);
    -webkit-text-size-adjust: 100%;
  }

  /* === LAYOUT: Container reflow === */
  .container,
  .site-wrapper,
  main,
  section {
    max-width: var(--tablet-container-max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--tablet-spacing-unit);
    padding-right: var(--tablet-spacing-unit);
  }

  /* === NAVIGATION: Condensed layout === */
  header {
    padding: 12px var(--tablet-spacing-unit);
  }

  header nav,
  header .nav {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  header nav a,
  header .nav a,
  header .nav-item {
    padding: 10px 12px;
    min-height: var(--tablet-touch-target);
    display: inline-flex;
    align-items: center;
  }

  /* === IMAGES: Responsive sizing === */
  img,
  picture,
  video {
    max-width: 100%;
    height: auto;
    display: block;
  }

  /* === BUTTONS: Larger touch targets === */
  button,
  .btn,
  [role="button"] {
    padding: 12px 18px;
    min-height: var(--tablet-touch-target);
    font-size: 15px;
    touch-action: manipulation;
  }

  /* === HERO: Disable parallax for performance === */
  .hero,
  [class*="hero"],
  [class*="parallax"] {
    background-attachment: scroll !important;
    background-size: cover;
  }

  /* === GRID LAYOUTS: 2-column max === */
  .grid-3col,
  [class*="grid-cols-3"],
  [class*="lg:grid-cols-3"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--tablet-spacing-unit);
  }

  /* === TYPOGRAPHY: Balanced sizing === */
  h1, .h1 {
    font-size: 1.75rem;
    line-height: 1.15;
  }

  h2, .h2 {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  h3, .h3 {
    font-size: 1.15rem;
  }

  /* === PERFORMANCE: Reduced animations === */
  *,
  *::before,
  *::after {
    transition-duration: 180ms !important;
    transition-timing-function: ease-out !important;
  }

  /* Respect user preference for reduced motion */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* === ACCESSIBILITY: Focus outlines === */
  :focus {
    outline: 3px solid hsl(var(--primary) / 0.7);
    outline-offset: 2px;
  }

  :focus:not(:focus-visible) {
    outline: none;
  }

  :focus-visible {
    outline: 3px solid hsl(var(--primary) / 0.7);
    outline-offset: 2px;
  }

  /* === FORMS: Better touch interaction === */
  input,
  textarea,
  select {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 12px;
    min-height: var(--tablet-touch-target);
  }

  /* === CARDS: Simplified shadows === */
  .card,
  [class*="card"] {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  /* === MODALS: Better fit === */
  [role="dialog"],
  .modal,
  .dialog {
    max-width: 90vw;
    max-height: 85vh;
    margin: auto;
  }

  /* === PORTFOLIO SPECIFIC: Gallery adjustments === */
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px;
  }

  /* === VIDEO PLAYER: Touch-friendly controls === */
  .video-controls button {
    min-width: var(--tablet-touch-target);
    min-height: var(--tablet-touch-target);
  }

  /* === ADMIN AREA: Hide from public view === */
  .admin-link,
  [href*="/admin"]:not(.admin-nav-link) {
    display: none;
  }

  /* === TABLET NAV VISIBILITY === */
  .tablet-nav {
    display: flex !important;
  }

  .mobile-nav,
  .mobile-nav-toggle {
    display: none !important;
  }

  /* === REDUCED MOTION CLASS (set by JS) === */
  .reduced-motion-tablet *,
  .reduced-motion-tablet *::before,
  .reduced-motion-tablet *::after {
    animation-duration: 100ms !important;
    transition-duration: 100ms !important;
  }
}
