/* ==========================================================================
   Mirei IT and Solar Energy Solution — custom styles
   Tailwind (CDN) handles utility classes; this file covers what utilities
   can't: glassmorphism, gradients, timeline connectors, masonry, lightbox,
   custom scrollbar, and motion.
   ========================================================================== */

:root {
  --mirei-yellow: #F3AF12;
  --mirei-orange: #F17A08;
  --mirei-green: #2A7D32;
  --mirei-dark: #011833;
  --mirei-dark-2: #032D5D;
}

* { scroll-behavior: smooth; }

html { scroll-padding-top: 84px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #ffffff;
  transition: background-color .35s ease, color .35s ease;
}

.dark body { background-color: var(--mirei-dark); }

h1, h2, h3, h4, .font-display {
  font-family: 'Poppins', 'Inter', sans-serif;
}

/* ---------- Custom scrollbar ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--mirei-orange), var(--mirei-yellow));
  border-radius: 999px;
}

/* ---------- Gradient helpers ---------- */
.gradient-brand {
  background: linear-gradient(135deg, var(--mirei-orange) 0%, var(--mirei-yellow) 100%);
}
.text-gradient-brand {
  background: linear-gradient(135deg, var(--mirei-orange) 0%, var(--mirei-yellow) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.gradient-dark-overlay {
  background: linear-gradient(180deg, rgba(17,24,39,.35) 0%, rgba(17,24,39,.75) 60%, rgba(17,24,39,.95) 100%);
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.dark .glass {
  background: rgba(31, 41, 55, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.glass-nav {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
.dark .glass-nav {
  background: rgba(17, 24, 39, 0.75);
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--mirei-orange), var(--mirei-yellow));
  color: #111827;
  font-weight: 600;
  box-shadow: 0 8px 24px -8px rgba(249, 115, 22, .55);
  transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -10px rgba(249, 115, 22, .65);
  filter: brightness(1.05);
}
.btn-outline {
  border: 2px solid rgba(255,255,255,.85);
  color: #fff;
  font-weight: 600;
  transition: all .25s ease;
}
.btn-outline:hover { background: rgba(255,255,255,.15); transform: translateY(-2px); }

/* ---------- Cards ---------- */
.card-hover { transition: transform .35s ease, box-shadow .35s ease; }
.card-hover:hover { transform: translateY(-8px); box-shadow: 0 24px 48px -18px rgba(0,0,0,.25); }

.icon-badge {
  width: 3.25rem; height: 3.25rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(241,122,8,.15), rgba(243,175,18,.15));
  color: var(--mirei-orange);
}
.dark .icon-badge { color: var(--mirei-yellow); }

.icon-badge.icon-badge-green,
.dark .icon-badge.icon-badge-green {
  background: linear-gradient(135deg, rgba(42,125,50,.15), rgba(42,125,50,.08));
  color: var(--mirei-green);
}

/* ---------- Hero floating stat chips ---------- */
.stat-chip {
  animation: floatY 5s ease-in-out infinite;
}
.stat-chip:nth-child(2) { animation-delay: .6s; }
.stat-chip:nth-child(3) { animation-delay: 1.2s; }
.stat-chip:nth-child(4) { animation-delay: 1.8s; }
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---------- Section reveal fallback (if AOS fails to load) ---------- */
[data-aos] { transition-property: opacity, transform; }

/* ---------- Pricing highlight ---------- */
.pricing-popular {
  border: 2px solid var(--mirei-orange);
  transform: scale(1.03);
}
.ribbon {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  white-space: nowrap;
}

/* ---------- Timeline ---------- */
.timeline-line {
  background: linear-gradient(180deg, var(--mirei-orange), var(--mirei-yellow));
}
@media (min-width: 768px) {
  .timeline-line-h { background: linear-gradient(90deg, var(--mirei-orange), var(--mirei-yellow)); }
}
.timeline-dot {
  box-shadow: 0 0 0 6px rgba(249,115,22,.15);
}

/* ---------- Masonry gallery ---------- */
.masonry {
  column-count: 1;
  column-gap: 1rem;
}
@media (min-width: 640px) { .masonry { column-count: 2; } }
@media (min-width: 1024px) { .masonry { column-count: 3; } }
.masonry-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  cursor: zoom-in;
}
.masonry-item img { transition: transform .5s ease, filter .5s ease; display: block; width: 100%; }
.masonry-item:hover img { transform: scale(1.08); filter: brightness(.75); }
.masonry-overlay {
  position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 1rem;
  opacity: 0; transition: opacity .35s ease;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.75) 100%);
}
.masonry-item:hover .masonry-overlay { opacity: 1; }

/* ---------- Lightbox ---------- */
#lightbox { backdrop-filter: blur(6px); }

/* ---------- Logo marquee (Partners / Clients) ---------- */
.marquee-wrap {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  gap: 3.5rem;
  animation: marquee-left 48s linear infinite;
}
.marquee-track.marquee-reverse {
  animation-name: marquee-right;
}
.marquee-wrap:hover .marquee-track {
  animation-play-state: paused;
}
@keyframes marquee-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes marquee-right {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}
.marquee-logo {
  flex: 0 0 auto;
  height: 3.75rem;
  display: flex;
  align-items: center;
  filter: grayscale(100%);
  opacity: .6;
  transition: filter .35s ease, opacity .35s ease, transform .35s ease;
}
.marquee-logo:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: translateY(-3px);
}
.marquee-logo img { height: 100%; width: auto; }
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* ---------- Floating action buttons ---------- */
.fab {
  width: 3.25rem; height: 3.25rem; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -6px rgba(0,0,0,.35);
  transition: transform .25s ease;
}
.fab:hover { transform: scale(1.1); }

/* ---------- Animated counter number ---------- */
.counter { font-variant-numeric: tabular-nums; }

/* ---------- FAQ ---------- */
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .4s ease; }
.faq-item.active .faq-answer { max-height: 400px; }
.faq-item.active .faq-icon { transform: rotate(45deg); }
.faq-icon { transition: transform .3s ease; }

/* ---------- Utility: line clamp for card text ---------- */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Preloader ---------- */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: #111827;
  transition: opacity .5s ease, visibility .5s ease;
}
#preloader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.sun-spinner {
  width: 56px; height: 56px; border-radius: 999px;
  background: linear-gradient(135deg, var(--mirei-orange), var(--mirei-yellow));
  animation: spin 1s linear infinite, pulseGlow 1.6s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251,191,36,.5); }
  50% { box-shadow: 0 0 0 18px rgba(251,191,36,0); }
}

/* ==========================================================================
   Installer PV Sizing Tool
   ========================================================================== */

/* ---------- Form controls ---------- */
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  margin-bottom: .375rem;
  color: #4b5563;
}
.dark .form-label { color: #9ca3af; }
.form-input {
  width: 100%;
  padding: .65rem .9rem;
  border-radius: .75rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.dark .form-input { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1); color: #f3f4f6; }
.form-input:focus { outline: none; box-shadow: 0 0 0 2px var(--mirei-orange); border-color: var(--mirei-orange); }
.form-input.field-invalid { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.4); }

/* ---------- Appliance row card ---------- */
.appliance-card {
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1rem;
  position: relative;
  background: rgba(255,255,255,.6);
}
.dark .appliance-card { border-color: rgba(255,255,255,.1); background: rgba(255,255,255,.03); }
.appliance-remove-btn {
  position: absolute; top: .6rem; right: .6rem;
  width: 1.75rem; height: 1.75rem; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(239,68,68,.1); color: #ef4444;
}
.toggle-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .75rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  border: 1px solid #e5e7eb; cursor: pointer; user-select: none;
}
.dark .toggle-pill { border-color: rgba(255,255,255,.15); }
.toggle-pill.active { background: var(--mirei-orange); border-color: var(--mirei-orange); color: #fff; }

/* ---------- Calculation cards (results) ---------- */
.calc-card {
  background: rgba(255,255,255,.7);
  border-radius: 1rem;
  padding: 1.1rem;
}
.dark .calc-card { background: rgba(255,255,255,.05); }
.calc-card .calc-value { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1.15rem; }
.calc-card .calc-label { font-size: .72rem; color: #6b7280; margin-bottom: .2rem; }
.dark .calc-card .calc-label { color: #9ca3af; }
.calc-card .calc-formula {
  font-size: .68rem; color: #9ca3af; margin-top: .4rem; font-family: ui-monospace, monospace;
  border-top: 1px dashed #e5e7eb; padding-top: .4rem;
}
.dark .calc-card .calc-formula { color: #6b7280; border-color: rgba(255,255,255,.1); }

/* ---------- Tables ---------- */
.calc-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.calc-table th {
  text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .03em;
  color: #9ca3af; padding: .6rem .75rem; border-bottom: 2px solid #e5e7eb;
}
.dark .calc-table th { border-color: rgba(255,255,255,.1); }
.calc-table td { padding: .65rem .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.dark .calc-table td { border-color: rgba(255,255,255,.06); }
.calc-table tr:last-child td { border-bottom: none; }

/* ---------- Status badges ---------- */
.status-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .65rem; border-radius: 999px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap;
}
.status-pass { background: rgba(42,125,50,.12); color: var(--mirei-green); }
.status-review { background: rgba(59,130,246,.12); color: #3b82f6; }
.status-warning { background: rgba(243,175,18,.15); color: #b45309; }
.status-critical { background: rgba(220,38,38,.14); color: #dc2626; }
.dark .status-warning { color: var(--mirei-yellow); }
.dark .status-critical { color: #f87171; }

.banner-pass { background: rgba(42,125,50,.12); color: var(--mirei-green); }
.banner-review { background: rgba(59,130,246,.12); color: #2563eb; }
.banner-warning { background: rgba(243,175,18,.15); color: #b45309; }
.dark .banner-warning { color: var(--mirei-yellow); }
.banner-critical { background: rgba(220,38,38,.14); color: #dc2626; }
.dark .banner-critical { color: #f87171; }

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff !important; color: #000 !important; }
  .glass { background: #fff !important; border: 1px solid #ddd !important; backdrop-filter: none !important; box-shadow: none !important; }
  .calc-card { background: #f9fafb !important; }
  #results-section { display: block !important; }
  a[href]:after { content: none !important; }
  .rounded-3xl { border-radius: .5rem !important; }
}

/* ---------- Focus visibility (a11y) ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--mirei-orange);
  outline-offset: 2px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 10000;
  background: #fff; color: #111827; padding: .75rem 1rem; border-radius: 0 0 .5rem 0;
}
.skip-link:focus { left: 0; }
