/* FILE: style.css */
/* PURPOSE: Custom styles with RTL, mobile support, and modern tech polish */

/* BLOCK: Alpine x-cloak */
[x-cloak] { display: none !important; }

/* BLOCK: Smooth scroll */
html { scroll-behavior: smooth; }

/* BLOCK: Base font stack */
body {
  font-family: 'Inter', 'Noto Sans Hebrew', 'Noto Sans Arabic', 'Noto Sans Devanagari', system-ui, sans-serif;
}
[dir="rtl"] body {
  font-family: 'Noto Sans Hebrew', 'Noto Sans Arabic', 'Inter', system-ui, sans-serif;
}

/* BLOCK: Selection + scrollbar + focus */
::selection { background: #0071e3; color: white; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7c7cc; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #0071e3; }
.dark ::-webkit-scrollbar-thumb { background: #3a3a3c; }
:focus-visible { outline: 2px solid #0071e3; outline-offset: 2px; }

/* BLOCK: Prose typography */
.prose { max-width: 65ch; line-height: 1.75; }
.prose h2 { font-size: 1.75rem; margin-top: 2rem; margin-bottom: 1rem; font-weight: 600; }
.prose h3 { font-size: 1.35rem; margin-top: 1.5rem; margin-bottom: 0.75rem; font-weight: 600; }
.prose p { margin-bottom: 1rem; }
.prose a { color: #0071e3; text-decoration: underline; }
.prose ul { list-style: disc; padding-inline-start: 1.5rem; margin-bottom: 1rem; }
.prose ol { list-style: decimal; padding-inline-start: 1.5rem; margin-bottom: 1rem; }
.prose img { border-radius: 1rem; margin: 1.5rem 0; }
.prose code { background: #f5f5f7; padding: 2px 6px; border-radius: 6px; font-size: 0.9em; font-family: 'JetBrains Mono', monospace; }
.dark .prose code { background: #1d1d1f; }

/* BLOCK: Reveal on scroll */
[data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* BLOCK: Tilt cards */
.tilt-card {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.3s ease;
}

/* BLOCK: Grid pattern background for dark mode */
.dark .grid-bg {
  background-image: linear-gradient(#0071e3 1px, transparent 1px),
                    linear-gradient(90deg, #0071e3 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.06;
}

/* BLOCK: Noise texture overlay */
.noise::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.15'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* BLOCK: Glow effect */
.glow:hover { box-shadow: 0 0 30px rgba(0, 113, 227, 0.5); }

/* BLOCK: Keyframes */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* BLOCK: Line clamp utilities */
.line-clamp-1, .line-clamp-2, .line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-1 { -webkit-line-clamp: 1; }
.line-clamp-2 { -webkit-line-clamp: 2; }
.line-clamp-3 { -webkit-line-clamp: 3; }

/* BLOCK: RTL flip for directional arrows */
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

/* BLOCK: RTL timeline */
[dir="rtl"] .timeline-line { left: auto; right: 1rem; }
@media (min-width: 768px) {
  [dir="rtl"] .timeline-line { right: 50%; left: auto; }
}

/* BLOCK: RTL dropdown */
[dir="rtl"] .dropdown-end { right: auto; left: 0; }
[dir="rtl"] .text-start-auto { text-align: right; }
[dir="ltr"] .text-start-auto { text-align: left; }

/* BLOCK: Touch targets */
@media (pointer: coarse) {
  button, a[role="button"], [type="submit"], [type="button"] {
    min-height: 44px;
    min-width: 44px;
  }
  .tilt-card { transform: none !important; }
}

/* BLOCK: iOS viewport fixes */
@supports (-webkit-touch-callout: none) {
  .min-h-screen { min-height: -webkit-fill-available; }
}
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
.safe-top { padding-top: env(safe-area-inset-top); }

/* BLOCK: No horizontal scroll */
html { overflow-x: hidden; }
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
.fixed.inset-0 {
  max-width: 100vw;
  max-height: 100vh;
}

/* BLOCK: Mobile input font size (prevents iOS zoom) */
@media (max-width: 640px) {
  input, textarea, select, button { font-size: 16px; }
}

/* BLOCK: Responsive hero text */
.text-responsive-hero {
  font-size: clamp(2.5rem, 8vw, 6rem);
  line-height: 1.05;
}

/* BLOCK: Skill bars */
.skill-bar {
  width: 0%;
  box-shadow: 0 0 8px rgba(0, 113, 227, 0.25);
}
.skill-row:hover .skill-bar {
  box-shadow: 0 0 14px rgba(0, 113, 227, 0.5);
  filter: brightness(1.15);
}
@media (max-width: 640px) {
  .skill-row span { font-size: 0.8rem; }
}
.skill-row[data-level] .skill-bar {
  transition-property: width;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  transition-duration: 1500ms;
}

/* BLOCK: Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .skill-bar { transition: none !important; }
}

/* BLOCK: Print */
@media print {
  nav, footer, .no-print, #scrollTopBtn, #section-dots, #scroll-progress, .mobile-menu-overlay {
    display: none !important;
  }
  body { background: white !important; color: black !important; }
}

/* BLOCK: Charts */
#trafficChart, #deviceChart {
  max-height: 100%;
  width: 100% !important;
}

/* BLOCK: Table hover */
table tbody tr:hover {
  background-color: rgba(0, 113, 227, 0.03);
}
.dark table tbody tr:hover {
  background-color: rgba(0, 113, 227, 0.08);
}

/* BLOCK: Floating snippets */
.snippet {
  pointer-events: none;
  user-select: none;
  transition: transform 0.3s ease-out;
  transform: translate(var(--parallax-x, 0), var(--parallax-y, 0));
}

/* BLOCK: 3D Carousel */
.carousel-3d-wrap {
  position: relative;
  height: 420px;
  perspective: 1200px;
  outline: none;
}
@media (min-width: 768px) {
  .carousel-3d-wrap { height: 500px; }
}
.carousel-3d-stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
  touch-action: pan-y;
}
.carousel-3d-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 260px;
  height: 340px;
  margin: -170px 0 0 -130px;
  border-radius: 1.25rem;
  overflow: hidden;
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s ease;
  backface-visibility: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  background: #f5f5f7;
}
@media (min-width: 640px) {
  .carousel-3d-slide { width: 320px; height: 420px; margin: -210px 0 0 -160px; }
}
@media (min-width: 1024px) {
  .carousel-3d-slide { width: 400px; height: 500px; margin: -250px 0 0 -200px; }
}
.carousel-3d-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.carousel-3d-slide.is-active {
  box-shadow: 0 30px 80px rgba(0, 113, 227, 0.35);
}
.carousel-3d-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 1rem 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
}
.carousel-3d-prev,
.carousel-3d-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.9);
  color: #1d1d1f;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  z-index: 200;
  cursor: pointer;
  border: none;
}
.dark .carousel-3d-prev,
.dark .carousel-3d-next {
  background: rgba(29, 29, 31, 0.9);
  color: #f5f5f7;
}
.carousel-3d-prev:hover,
.carousel-3d-next:hover {
  background: #0071e3;
  color: white;
  transform: translateY(-50%) scale(1.1);
}
.carousel-3d-prev { left: 1rem; }
.carousel-3d-next { right: 1rem; }
@media (min-width: 1024px) {
  .carousel-3d-prev { left: 4rem; }
  .carousel-3d-next { right: 4rem; }
}
.carousel-3d-dots {
  position: absolute;
  bottom: -1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 200;
}
.carousel-3d-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #c7c7cc;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.dark .carousel-3d-dot { background: #3a3a3c; }
.carousel-3d-dot.is-active {
  background: #0071e3;
  width: 24px;
}
[dir="rtl"] .carousel-3d-prev { left: auto; right: 1rem; }
[dir="rtl"] .carousel-3d-next { right: auto; left: 1rem; }
@media (min-width: 1024px) {
  [dir="rtl"] .carousel-3d-prev { right: 4rem; left: auto; }
  [dir="rtl"] .carousel-3d-next { left: 4rem; right: auto; }
}

/* BLOCK: Game overlays */
#game-pause-overlay,
#game-start-overlay,
#game-over-overlay {
  animation: fadeIn 0.2s ease-out;
}

/* BLOCK: Game buttons */
#game-pause-btn:disabled,
#game-quit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

body.game-paused { overflow: hidden; }

/* BLOCK: Header nav */
.nav-link { color: #4b5563; }
.dark .nav-link { color: #9ca3af; }
.nav-link:hover {
  color: #0071e3;
  background-color: rgba(0, 113, 227, 0.05);
}
.dark .nav-link:hover {
  color: #0a84ff;
  background-color: rgba(10, 132, 255, 0.1);
}

.icon-btn { color: #4b5563; }
.dark .icon-btn { color: #9ca3af; }
.icon-btn:hover {
  color: #0071e3;
  background-color: rgba(0, 113, 227, 0.05);
}
.dark .icon-btn:hover {
  color: #0a84ff;
  background-color: rgba(10, 132, 255, 0.1);
}

#main-header.scrolled .header-shell {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
.dark #main-header.scrolled .header-shell {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
#main-header.scrolled .header-shell > div { height: 56px; }
@media (min-width: 1024px) {
  #main-header.scrolled .header-shell > div { height: 60px; }
}

.mobile-menu-overlay {
  -webkit-tap-highlight-color: transparent;
  z-index: 55;
}
.mobile-menu-overlay .bg-white { background-color: #ffffff; }
.dark .mobile-menu-overlay .bg-black { background-color: #000000; }
.mobile-nav-link {
  position: relative;
  display: block;
  -webkit-tap-highlight-color: transparent;
}
body.menu-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
}
#main-header { z-index: 50; }

/* ============================================================ */
/* BLOCK: Game stage + canvas — responsive sizing               */
/*                                                              */
/* Height is set by JS (game-shell.js) on every resize.         */
/* CSS must not set aspect-ratio or max-height here.            */
/* The stage is a plain block (NOT flex) so its width is         */
/* determined by its parent's CSS — not by the canvas bitmap.   */
/* ============================================================ */

.game-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  display: block;
  overflow: hidden;
  box-sizing: border-box;
  background: #ffffff;
}
.dark .game-stage { background: #0b0b0d; }

.game-stage #swipe-area {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.game-stage #game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  vertical-align: middle;
}

/* Mobile — remove the rounded corners so the canvas fills edge to edge */
@media (max-width: 640px) {
  .game-stage {
    border-radius: 0.75rem;
  }
  .game-stage #game-canvas {
    border-radius: 0;
  }
}

/* ============================================================ */
/* BLOCK: Touch D-pad — cleaner, more modern design             */
/* ============================================================ */

#touch-dpad {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.touch-dpad-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.touch-dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  width: 168px;
  height: 168px;
  max-width: 100%;
  touch-action: none;
  flex-shrink: 0;
}

.touch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
  color: #1d1d1f;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  touch-action: manipulation;
  min-width: 44px;
  min-height: 44px;
  user-select: none;
  -webkit-user-select: none;
}

.dark .touch-btn {
  background: linear-gradient(180deg, #1d1d1f 0%, #0b0b0d 100%);
  color: #f5f5f7;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.touch-btn:active {
  transform: scale(0.92);
  background: linear-gradient(180deg, #0071e3 0%, #005bb8 100%);
  color: white;
  border-color: #0071e3;
  box-shadow:
    0 1px 2px rgba(0, 113, 227, 0.3),
    0 4px 12px rgba(0, 113, 227, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Action button — circular, gradient, stands out */
.touch-btn-action {
  background: linear-gradient(135deg, #0071e3 0%, #0a84ff 100%);
  color: white;
  border: none;
  border-radius: 9999px;
  box-shadow:
    0 4px 12px rgba(0, 113, 227, 0.35),
    0 8px 24px rgba(0, 113, 227, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-weight: 700;
  width: 88px;
  height: 88px;
  min-width: 68px;
  min-height: 68px;
  flex-shrink: 0;
}

.touch-btn-action:active {
  transform: scale(0.88);
  background: linear-gradient(135deg, #005bb8 0%, #0071e3 100%);
  box-shadow:
    0 2px 6px rgba(0, 113, 227, 0.5),
    0 4px 12px rgba(0, 113, 227, 0.4);
}

.touch-btn-action .touch-action-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}

/* Center dot — replaces the middle empty cell */
.touch-dpad-center {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.touch-dpad-center::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: rgba(0, 113, 227, 0.15);
}
.dark .touch-dpad-center::after {
  background: rgba(10, 132, 255, 0.2);
}

/* Mobile sizing */
@media (max-width: 640px) {
  .touch-dpad-wrap {
    gap: 8px;
    padding: 10px 0 6px;
  }
  .touch-dpad-grid {
    width: 156px;
    height: 156px;
    gap: 5px;
  }
  .touch-btn {
    border-radius: 14px;
    min-width: 44px;
    min-height: 44px;
  }
  .touch-btn-action {
    width: 78px;
    height: 78px;
    min-width: 64px;
    min-height: 64px;
  }
  #touch-dpad {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .touch-dpad-wrap {
    gap: 6px;
  }
  .touch-dpad-grid {
    width: 138px;
    height: 138px;
    gap: 4px;
  }
  .touch-btn-action {
    width: 68px;
    height: 68px;
    min-width: 60px;
    min-height: 60px;
  }
}

/* Swipe area */
#swipe-area {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  height: 100%;
}

/* END FILE: style.css */