/* ============================================================================
   Learn Italian for Kids - Shared Stylesheet
   This stylesheet is used by the Learn page (it-learn-colo.html)
   ============================================================================ */

/* ============================================================================
   CSS VARIABLES - Color scheme matching Italian flag colors
   ============================================================================ */
:root{
  --flag-green:#1fa34a;  /* Italian flag green */
  --flag-red:#e53935;     /* Italian flag red */
  --cream:#fff8e6;        /* Cream background color */
  --ink:#2f2f2f;          /* Dark text color */
  --accent:#ffd86a;        /* Yellow accent color */
}

/* ============================================================================
   GLOBAL STYLES
   ============================================================================ */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: "Comic Sans MS", "Trebuchet MS", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--ink);
  background:var(--cream);
}

/* ============================================================================
   LAYOUT COMPONENTS
   ============================================================================ */
/* Main container with max width for centered content */
.container{ max-width:1100px; margin:0 auto; padding:24px; }

/* Header section (currently unused but kept for consistency) */
.header{ text-align:center; padding:10px 0 0; }
.header h1{ margin:0 0 6px 0; font-size:clamp(28px, 4vw, 44px); letter-spacing:1px; color:#333; }
.header p{ margin:0 0 20px 0; opacity:.8; font-size:clamp(14px, 2.2vw, 18px); }

/* Grid layout (currently unused but kept for consistency) */
.grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:20px; }
@media (max-width:900px){ .grid{ grid-template-columns:1fr; } }

/* ============================================================================
   TILE BUTTONS - Navigation Cards (currently unused but kept for consistency)
   ============================================================================ */
/* Main tile button with Italian flag colors (green, white, red) */
.tile{
  position:relative; border-radius:22px; overflow:hidden; min-height:180px;
  background: linear-gradient(90deg, var(--flag-green) 0 33%, white 33% 66%, var(--flag-red) 66%);
  box-shadow: 0 8px 18px rgba(0,0,0,.12), inset 0 0 0 6px rgba(255,255,255,.7);
  transition: transform .15s ease, box-shadow .15s ease; cursor:pointer;
}
.tile:focus-visible{ outline: 3px solid var(--accent); outline-offset: 4px; }
.tile:hover{ transform: translateY(-3px); box-shadow:0 10px 24px rgba(0,0,0,.16), inset 0 0 0 6px rgba(255,255,255,.8); }
.tile .label{
  position:absolute; inset:0; display:flex; flex-direction:column; align-items:center;
  justify-content:center; gap:6px; text-align:center; padding:20px; color:#222;
  text-shadow:0 2px 0 rgba(255,255,255,.75); font-weight:800; font-size: clamp(18px, 2.1vw, 24px); line-height:1.2;
}
/* Playful text styling with slight rotation on each letter */
.stylish{ letter-spacing: .5px; }
.stylish span{ display:inline-block; transform: rotate(var(--r, 0deg)); padding:0 1px; }
.stylish span:nth-child(3n){ --r: 2deg; }
.stylish span:nth-child(3n+1){ --r: -2deg; }
.stylish span:nth-child(4n){ --r: 1.5deg; }
.tag{ position:absolute; bottom:10px; right:10px; background:rgba(255,255,255,.85); color:#3a3a3a;
  font-weight:700; font-size:12px; padding:6px 10px; border-radius:999px; box-shadow:0 1px 3px rgba(0,0,0,.15); }

/* ============================================================================
   TOP NAVIGATION BAR
   ============================================================================ */
/* Sticky top bar with blur effect for Learn and Practice pages */
.topbar{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; gap:12px;
  background:linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.85));
  position:sticky; top:0; z-index:30; border-bottom:1px solid rgba(0,0,0,.06); backdrop-filter: blur(6px); }

/* Center the progress bar in the topbar */
.topbar > div:nth-child(2){ 
  position:absolute; 
  left:50%; 
  transform:translateX(-50%);
  width:auto;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
/* Standard button styling with press-down effect */
.btn{ appearance:none; border:none; border-radius:999px; padding:10px 16px; background:var(--accent); color:#222; font-weight:700; font-size:12px; cursor:pointer; box-shadow:0 6px 12px rgba(0,0,0,.18); transition: transform .1s ease, box-shadow .1s ease, background .2s ease; font-family: "Comic Sans MS", "Trebuchet MS", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; text-decoration:none; }
.btn:hover{ box-shadow:0 8px 16px rgba(0,0,0,.22); }
.btn:active{ transform: translateY(2px); box-shadow:0 3px 6px rgba(0,0,0,.15); } /* Press-down effect */
.btn.alt{ background:var(--accent); color:#222; }
.btn.alt.active{ background:#1fa34a; color:#fff; } /* Active state (green) */

/* ============================================================================
   SCENE/IMAGE CONTAINER
   ============================================================================ */
/* Wrapper for the scene image */
.scene-wrap{ max-width:1150px; margin:14px auto; padding:0 16px 32px; position:relative; }
.scene{ width:100%; border-radius:22px; display:block; box-shadow:0 10px 26px rgba(0,0,0,.15); }

/* ============================================================================
   PROGRESS BAR AND STARS
   ============================================================================ */
/* Progress bar container - centered in topbar */
.progress-bar{
  display:flex; align-items:center; justify-content:center; gap:9px;
  position:absolute; left:50%; transform:translateX(-50%);
  width:auto; min-width:400px; max-width:600px;
}

/* Completion message - animated celebration when all hotspots are found */
.completion-message{
  animation: none;
}
.completion-message.celebrate{
  animation: celebrate 1.5s ease-in-out infinite;
}
/* Celebration animation - bouncy rotation effect */
@keyframes celebrate{
  0%, 100%{ transform: scale(1) rotate(0deg); }
  25%{ transform: scale(1.1) rotate(-3deg); }
  50%{ transform: scale(1.15) rotate(0deg); }
  75%{ transform: scale(1.1) rotate(3deg); }
}

/* Container for progress stars */
.progress-stars{
  display:flex; align-items:center; gap:4.5px; flex-wrap:wrap; justify-content:center;
}

/* Individual progress star - gray when incomplete */
.progress-star{
  width:9.9px; height:9.9px; background-repeat:no-repeat; background-size:contain; background-position:center;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 61,38 95,38 67,58 77,91 50,72 23,91 33,58 5,38 39,38' fill='%23e0e0e0' stroke='%23ccc' stroke-width='3' /></svg>");
  transition:all .2s ease;
}

/* Completed progress star - gold with glow effect */
.progress-star.completed{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 61,38 95,38 67,58 77,91 50,72 23,91 33,58 5,38 39,38' fill='%23ffd700' stroke='white' stroke-width='5' /></svg>");
  filter: drop-shadow(0 0 3px rgba(255,215,0,.9)) drop-shadow(0 0 6px rgba(255,215,0,.45));
}
/* ============================================================================
   RESET BUTTON
   ============================================================================ */
/* Small reset button (currently unused but kept for consistency) */
.reset-btn{
  appearance:none; border:none; border-radius:999px; padding:4.5px 10.5px;
  background:var(--accent); color:#222; font-weight:700; font-size:9.75px; cursor:pointer;
  box-shadow:0 2px 6px rgba(0,0,0,.15); transition: transform .1s ease, box-shadow .1s ease;
  white-space:nowrap;
}
.reset-btn:hover{ transform: translateY(-1px); box-shadow:0 4px 9px rgba(0,0,0,.2); }
.reset-btn:active{ transform: translateY(0); box-shadow:0 1.5px 4.5px rgba(0,0,0,.15); }
.footer-note{ text-align:center; font-size:12px; opacity:.7; padding:16px; }

/* ============================================================================
   SCENE BOX AND HOTSPOTS
   ============================================================================ */
/* Container for scene image - clips hotspots to image boundaries */
#sceneBox{ position:relative; display:block; width:100%; max-width:100%; overflow:hidden; border-radius:22px; line-height:0; }

/* Flashlight effect overlay - highlights area around hotspot on hover */
#flashlight{
  position:absolute; pointer-events:none; opacity:0; transition:opacity .12s ease;
  width:110px; height:110px; border-radius:50%;
  box-shadow:0 0 0 9999px rgba(0,0,0,.0), 0 0 28px rgba(0,0,0,.28) inset, 0 0 34px rgba(0,0,0,.28);
  outline: 3px solid rgba(255,255,255,.9); mix-blend-mode: multiply;
  z-index:2;
}

/* Hotspot buttons - interactive clickable areas on the scene image */
.hotspot{
  position:absolute;
  width:32px; height:32px;
  transform:translate(-50%, -50%);
  border:none; background:transparent; cursor:pointer; border-radius:0;
  z-index:3;
}

/* Hotspot star icon - yellow when unclicked, animated sparkle effect */
.hotspot::after{
  content:"";
  position:absolute; left:50%; top:50%;
  width:12px; height:12px; transform:translate(-50%,-50%) scale(1);
  background-repeat:no-repeat; background-size:contain; background-position:center;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 61,38 95,38 67,58 77,91 50,72 23,91 33,58 5,38 39,38' fill='%23ffd86a' stroke='%231e3a8a' stroke-width='4' /></svg>");
  filter: drop-shadow(0 0 3px rgba(255,216,106,.9)) drop-shadow(0 0 6px rgba(255,216,106,.45));
  animation: sparkle 1.6s ease-in-out infinite alternate;
  transition: all .2s ease;
}

/* Hotspot star icon - green when clicked/completed */
.hotspot.clicked::after{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 61,38 95,38 67,58 77,91 50,72 23,91 33,58 5,38 39,38' fill='%231fa34a' stroke='%231e3a8a' stroke-width='4' /></svg>");
  filter: drop-shadow(0 0 3px rgba(31,163,74,.9)) drop-shadow(0 0 6px rgba(31,163,74,.45));
}

/* Hotspot hover effect - scales and rotates star */
.hotspot:hover::after,.hotspot:focus::after{
  transform:translate(-50%,-50%) scale(1.12) rotate(6deg);
}

/* Sparkle animation for unclicked hotspots */
@keyframes sparkle{
  from{ transform:translate(-50%,-50%) scale(.95) rotate(-6deg); opacity:.9; }
  to{ transform:translate(-50%,-50%) scale(1.05) rotate(6deg); opacity:1; }
}

/* Accessibility: Focus outline for keyboard navigation */
.hotspot:focus-visible{ outline:3px solid var(--accent); outline-offset:3px; }

/* Coordinate tag for debugging (hidden in production) */
#coordTag{ display:none !important; }

/* ============================================================================
   BOTTOM BAR
   ============================================================================ */
/* Sticky bottom instruction bar */
#bottomBar{ position:sticky; bottom:0; left:0; right:0; display:flex; justify-content:center; align-items:center; gap:10px; padding:14px 16px; background:rgba(255,255,255,.96); border-top:1px solid rgba(0,0,0,.08); font-size:16px; min-height:54px; }
#bottomBar b{ font-size:18px; }

/* ============================================================================
   HIGHLIGHT PULSE ANIMATION
   ============================================================================ */
/* Pulsing highlight effect for important words in instructions */
.highlight-pulse{
  color:#ff6b9d;
  font-weight:800;
  animation: highlightPulse 1.5s ease-in-out infinite;
  display:inline-block;
}

/* Animation that pulses between pink and blue with slight scale */
@keyframes highlightPulse{
  0%, 100%{ 
    color:#ff6b9d;  /* Pink */
    transform:scale(1);
  }
  50%{ 
    color:#4a9eff;  /* Blue */
    transform:scale(1.1);
  }
}

/* Hotspot hover shadow effect */
.hotspot:hover,.hotspot:focus{ box-shadow:0 2px 8px rgba(0,0,0,.2) inset, 0 2px 8px rgba(0,0,0,.16); }
