@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --accent-rgb: 59,130,246;
  --background: 0 0% 100%;
  --foreground: 0 0% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 3.9%;
  --primary: 0 0% 9%;
  --primary-foreground: 0 0% 98%;
  --secondary: 0 0% 96.1%;
  --secondary-foreground: 0 0% 9%;
  --muted: 0 0% 96.1%;
  --muted-foreground: 0 0% 45.1%;
  --accent: 0 0% 96.1%;
  --accent-foreground: 0 0% 9%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 0 0% 89.8%;
  --input: 0 0% 89.8%;
  --ring: 0 0% 3.9%;
  --radius: 0.5rem;
}

.dark {
  --background: 0 0% 3.9%;
  --foreground: 0 0% 98%;
  --card: 0 0% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 0 0% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 0 0% 9%;
  --secondary: 0 0% 14.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 0 0% 14.9%;
  --muted-foreground: 0 0% 63.9%;
  --accent: 0 0% 14.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 0 0% 14.9%;
  --input: 0 0% 14.9%;
  --ring: 0 0% 83.1%;
}

* {
  border-color: hsl(var(--border));
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-display: swap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Article Content ───────────────────────────────────────────── */

.article-content pre {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.article-content pre::-webkit-scrollbar {
  height: 8px;
}

.article-content pre::-webkit-scrollbar-track {
  background: transparent;
}

.article-content pre::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.article-content pre::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

.article-content code {
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.6;
}

.article-content strong {
  color: #fff;
  font-weight: 700;
}

/* ─── Scrollbar hide ────────────────────────────────────────────── */

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ─── macOS Tahoe Glass System ──────────────────────────────────── */
/*
  All glass materials follow the real macOS Tahoe pattern:
  - backdrop-filter: blur(20-40px) saturate(180%)
  - Thin top highlight: inset 0 1px 0 rgba(255,255,255,0.15-0.30)
  - Subtle bottom shadow: inset 0 -1px 0 rgba(0,0,0,0.12-0.22)
  - One outer shadow, max two layers
  - No hue-rotate, no chromatic aberration, no displacement
*/

/* iOS app icon tile — continuous-corner squircle */
.ios-icon-tile {
  position: relative;
  border-radius: 22%;
  overflow: hidden;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  box-shadow: none;
  transition: transform 0.18s ease;
}

.ios-icon-tile::before {
  display: none;
}

.ios-icon-tile:active {
  transform: scale(0.92);
}

/* Dynamic Island — mobile status pill */
.dynamic-island {
  position: relative;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 4px 20px rgba(0, 0, 0, 0.5),
    0 1px 4px rgba(0, 0, 0, 0.3);
}

/* macOS Tahoe dock — frosted horizontal bar */
.macos-dock {
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.14),
    0 8px 40px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.30);
}

/* macOS menu bar — liquid glass monochrome */
.macos-menubar {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(48px) saturate(200%) brightness(1.05);
  -webkit-backdrop-filter: blur(48px) saturate(200%) brightness(1.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 4px 24px rgba(0, 0, 0, 0.18);
}

/* liquid glass tile — control center widget */
.liquid-glass-tile {
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(40px) saturate(180%) brightness(1.08);
  -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.08);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom-color: rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.22),
    0 2px 6px rgba(0, 0, 0, 0.12);
}

.liquid-glass-tile:hover {
  background: rgba(255, 255, 255, 0.20);
  border-color: rgba(255, 255, 255, 0.36);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    0 10px 40px rgba(0, 0, 0, 0.28),
    0 3px 10px rgba(0, 0, 0, 0.16);
}

/* liquid glass icon circle */
.liquid-glass-icon {
  background: rgba(255, 255, 255, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.70);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 2px 8px rgba(0, 0, 0, 0.14);
}

/* liquid glass control center container */
.liquid-glass-cc {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(60px) saturate(200%) brightness(1.06);
  -webkit-backdrop-filter: blur(60px) saturate(200%) brightness(1.06);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-color: rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.40),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 24px 80px rgba(0, 0, 0, 0.50),
    0 8px 32px rgba(0, 0, 0, 0.28);
}

/* Frosted sheet / bottom sheet modal */
.glass-sheet {
  background: rgba(20, 20, 22, 0.72);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.20),
    0 24px 80px rgba(0, 0, 0, 0.65),
    0 8px 32px rgba(0, 0, 0, 0.40);
}

/* Sheet grabber handle */
.sheet-grabber {
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.24);
  margin: 10px auto 4px;
}

/* Glass card — widget, tooltip, caption */
.glass-card {
  background: rgba(10, 10, 12, 0.55);
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.22);
}

/* macOS window / panel — dark frosted */
.glass-panel {
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 20px 60px rgba(0, 0, 0, 0.55),
    0 4px 16px rgba(0, 0, 0, 0.30);
}

/* macOS window / panel — interactive hover */
.glass-panel-interactive {
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 8px 32px rgba(0, 0, 0, 0.40),
    0 2px 8px rgba(0, 0, 0, 0.24);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.glass-panel-interactive:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 12px 40px rgba(0, 0, 0, 0.50),
    0 3px 10px rgba(0, 0, 0, 0.28);
}

/* Dock icon running dot */
.dock-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  margin: 2px auto 0;
}

/* ─── iOS Wiggle animation ──────────────────────────────────────── */

@keyframes ios-wiggle {
  0%, 100% { transform: rotate(0deg); }
  20%       { transform: rotate(-2.5deg); }
  40%       { transform: rotate(2.5deg); }
  60%       { transform: rotate(-2deg); }
  80%       { transform: rotate(2deg); }
}

.ios-wiggle {
  animation: ios-wiggle 0.45s ease-in-out infinite;
  transform-origin: center 85%;
}

/* ─── macOS Navigation / Dock ───────────────────────────────────── */

.macos-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.macos-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  z-index: 1000;
}

.macos-nav-item:hover .macos-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-3px);
}

/* ─── Reduced motion ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .ios-icon-tile,
  .macos-dock,
  .glass-sheet,
  .dynamic-island,
  .glass-panel,
  .glass-panel-interactive {
    transition: none !important;
    animation: none !important;
  }
  .ios-wiggle {
    animation: none !important;
  }
}

/* ─── Reduced transparency fallback ────────────────────────────── */

@media (prefers-reduced-transparency: reduce) {
  .ios-icon-tile,
  .macos-dock,
  .glass-sheet,
  .glass-card,
  .glass-panel,
  .glass-panel-interactive,
  .dynamic-island {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(15, 15, 18, 0.94) !important;
  }
}
