/**
 * Ewan Automation — main theme styles.
 * Ported from the original single-page HTML site.
 */

/* ===== BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: #FFFFFF; color: #111; overflow-x: hidden; }
::selection { background: #DC2626; color: #fff; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #F5F5F6; }
::-webkit-scrollbar-thumb { background: #DC2626; border-radius: 3px; }

/* ===== LOADING SCREEN ===== */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #FFFFFF !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.loader-inner {
  text-align: center;
}
.loader-logo {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 2.5rem;
  letter-spacing: 0.15em;
  color: #DC2626;
  margin-bottom: 1.5rem;
}
.loader-bar {
  width: 200px;
  height: 2px;
  background: #E5E5E5;
  margin: 0 auto 1rem;
  overflow: hidden;
}
.loader-fill {
  width: 0;
  height: 100%;
  background: #DC2626;
  animation: loaderProgress 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes loaderProgress {
  0%   { width: 0; }
  100% { width: 100%; }
}
.loader-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: #B0B0B0;
  text-transform: uppercase;
}

/* ===== GRID PATTERN ===== */
.grid-pattern {
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ===== CUSTOM LOGO (auto-scales to fit navbar/footer brand link) ===== */
.custom-logo {
  max-height: 40px;
  max-width: 220px;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.custom-logo-link {
  display: inline-flex;
  align-items: center;
}
@media (max-width: 768px) {
  .custom-logo {
    max-height: 34px;
    max-width: 180px;
  }
}

/* ===== ANIMATED LINES & NODES ===== */
@keyframes flowRight { 0% { stroke-dashoffset: 1000; } 100% { stroke-dashoffset: 0; } }
@keyframes flowDown { 0% { stroke-dashoffset: 800; } 100% { stroke-dashoffset: 0; } }
.flow-line { stroke-dasharray: 8 12; animation: flowRight 8s linear infinite; }
.flow-line-v { stroke-dasharray: 8 12; animation: flowDown 6s linear infinite; }

@keyframes nodePulse { 0%, 100% { opacity: 0.15; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.8); } }
.node-pulse { animation: nodePulse 2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.node-pulse-delay { animation: nodePulse 2s ease-in-out 0.5s infinite; transform-origin: center; transform-box: fill-box; }
.node-pulse-delay2 { animation: nodePulse 2s ease-in-out 1s infinite; transform-origin: center; transform-box: fill-box; }

@keyframes scanLine { 0% { transform: translateY(-100%); } 100% { transform: translateY(100vh); } }
.scan-line {
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(220,38,38,0.12), transparent);
  animation: scanLine 6s linear infinite; pointer-events: none;
}

/* ===== REVEAL ANIMATIONS ===== */
.reveal {
  opacity: 0; transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ===== SOLUTION CARDS ===== */
.solution-card {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #E5E5E5;
}
.solution-card:hover {
  border-color: rgba(220,38,38,0.5);
  transform: translateY(-6px);
  box-shadow: 0 20px 60px -15px rgba(220,38,38,0.12), 0 4px 20px -5px rgba(0,0,0,0.06);
}
.solution-card:hover .card-icon { color: #DC2626; }
.solution-card:hover .card-arrow { transform: translateX(4px); color: #DC2626; }

/* ===== INDUSTRY CARDS ===== */
.industry-card { position: relative; overflow: hidden; cursor: pointer; }
.industry-card img {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.7s;
  filter: grayscale(20%) contrast(1.05) brightness(0.85);
}
.industry-card:hover img {
  transform: scale(1.08);
  filter: grayscale(0%) contrast(1.05) brightness(0.75);
}
.industry-card .overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
}
.industry-card:hover .overlay {
  background: linear-gradient(to top, rgba(220,38,38,0.4) 0%, rgba(0,0,0,0.35) 60%, transparent 100%);
}
.industry-card:hover .ind-label { color: #DC2626; }
.industry-card:hover .ind-arrow { opacity: 1; transform: translateX(0); }
.industry-card:hover .ind-view { opacity: 1; transform: translateY(0); }

/* ===== SECTION NUMBER ===== */
.section-num {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(5rem, 12vw, 10rem);
  font-weight: 700; line-height: 1;
  color: rgba(0,0,0,0.03);
  position: absolute; top: -1rem; left: -0.5rem;
  pointer-events: none; user-select: none;
}

/* ===== TECH BADGES ===== */
.tech-badge { transition: all 0.3s; border: 1px solid #E5E5E5; }
.tech-badge:hover {
  border-color: rgba(220,38,38,0.4);
  background: rgba(220,38,38,0.03);
  transform: translateY(-2px);
}

/* ===== WHY CARDS ===== */
.why-card { transition: all 0.4s; border-left: 2px solid #E5E5E5; }
.why-card:hover { border-left-color: #DC2626; background: rgba(220,38,38,0.02); }
.why-card:hover .why-icon { color: #DC2626; }

/* ===== NAVIGATION ===== */
.nav-scrolled {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid #E5E5E5;
  box-shadow: 0 1px 20px rgba(0,0,0,0.04);
}

.mobile-menu { transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.mobile-menu.open { transform: translateX(0); }

/* ===== BUTTONS ===== */
.btn-primary {
  background: #DC2626; transition: all 0.3s;
  position: relative; overflow: hidden;
}
.btn-primary::before {
  content: ''; position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s;
}
.btn-primary:hover::before { left: 100%; }
.btn-primary:hover { background: #B91C1C; box-shadow: 0 0 30px rgba(220,38,38,0.3); }

.btn-outline { border: 1px solid rgba(0,0,0,0.2); transition: all 0.3s; }
.btn-outline:hover { border-color: #DC2626; color: #DC2626; }

/* ===== STATUS BLINK ===== */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.status-blink { animation: blink 2s ease-in-out infinite; }

/* ===== GEARS ===== */
@keyframes rotateCW { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rotateCCW { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
.gear-cw { animation: rotateCW 20s linear infinite; }
.gear-ccw { animation: rotateCCW 15s linear infinite; }

/* ===== TEXT SHIMMER ===== */
@keyframes shimmer { 0% { background-position: -200% center; } 100% { background-position: 200% center; } }
.text-shimmer {
  background: linear-gradient(90deg, #111 0%, #111 40%, #DC2626 50%, #111 60%, #111 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; animation: shimmer 6s linear infinite;
}

/* ===== TOAST ===== */
.toast { transform: translateY(100px); opacity: 0; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.toast.show { transform: translateY(0); opacity: 1; }

/* ===== CHECKBOX LABELS ===== */
.cb-label input:checked + span {
  background: rgba(220,38,38,0.1);
  border-color: rgba(220,38,38,0.4);
  color: #DC2626;
}

/* ===== MODAL ===== */
.modal-overlay { opacity: 0; pointer-events: none; transition: opacity 0.4s ease; }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-content { transform: translateY(40px) scale(0.97); transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-overlay.open .modal-content { transform: translateY(0) scale(1); }
.modal-tag { transition: all 0.3s; }
.modal-tag:hover { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.3); color: #DC2626; }
.modal-stat-card { border: 1px solid #E5E5E5; transition: all 0.3s; }
.modal-stat-card:hover { border-color: rgba(220,38,38,0.3); }

/* ===== INFO MODAL BODY ===== */
#infoModalBody p { margin-bottom: 1rem; }
#infoModalBody strong { color: #374151; }
#infoModalBody ul { margin: 0.5rem 0 1rem 0; padding-left: 0; list-style: none; }
#infoModalBody ul.list-disc { list-style: disc; padding-left: 1.25rem; }
#infoModalBody ul.list-disc li { margin-bottom: 0.4rem; padding-left: 0.25rem; }
#infoModalBody ul.list-disc li::marker { color: #DC2626; }
#infoModalBody em { color: #6B7280; }

/* Standalone Company page article body (About / Team / Careers / Cases / News / Supplier) */
.ewan-article-body p { margin-bottom: 1.1rem; }
.ewan-article-body strong { color: #374151; font-weight: 600; }
.ewan-article-body ul { margin: 0.5rem 0 1.1rem 0; padding-left: 0; list-style: none; }
.ewan-article-body ul.list-disc { list-style: disc; padding-left: 1.25rem; }
.ewan-article-body ul.list-disc li { margin-bottom: 0.5rem; padding-left: 0.25rem; }
.ewan-article-body ul.list-disc li::marker { color: #DC2626; }
.ewan-article-body em { color: #6B7280; }
.ewan-article-body h2, .ewan-article-body h3 { font-family: 'Rajdhani', sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #111827; margin-top: 1.75rem; margin-bottom: 0.75rem; }

/* ===== BLOG / CONTENT PAGES ===== */
.entry-content { font-family: 'Inter', sans-serif; font-weight: 300; color: #374151; line-height: 1.75; }
.entry-content h2 { font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 1.875rem; color: #111; margin: 2rem 0 1rem; }
.entry-content h3 { font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 1.5rem; color: #111; margin: 1.5rem 0 0.75rem; }
.entry-content p { margin-bottom: 1.25rem; }
.entry-content a { color: #DC2626; text-decoration: underline; }
.entry-content a:hover { color: #991B1B; }
.entry-content ul, .entry-content ol { margin: 0 0 1.25rem 1.5rem; }
.entry-content li { margin-bottom: 0.5rem; }
.entry-content blockquote { border-left: 4px solid #DC2626; padding-left: 1.5rem; margin: 1.5rem 0; font-style: italic; color: #6B7280; }
.entry-content img { border-radius: 2px; margin: 1.5rem 0; }
.entry-content code { font-family: 'Share Tech Mono', monospace; background: #F5F5F6; padding: 0.15rem 0.4rem; font-size: 0.875em; border-radius: 2px; }
.entry-content pre { background: #0A0A0A; color: #E5E5E5; padding: 1.5rem; border-radius: 2px; overflow-x: auto; margin: 1.5rem 0; }
.entry-content pre code { background: transparent; padding: 0; }

/* WordPress alignment classes */
.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { display: block; margin: 1.5rem auto; }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; justify-content: center; margin: 2rem 0; }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.5rem; height: 2.5rem; padding: 0 0.75rem;
  border: 1px solid #E5E5E5; font-family: 'Rajdhani', sans-serif; font-weight: 600;
  color: #6B7280; transition: all 0.3s; border-radius: 2px;
}
.pagination .page-numbers:hover { border-color: #DC2626; color: #DC2626; }
.pagination .page-numbers.current { background: #DC2626; border-color: #DC2626; color: #fff; }

/* Comments */
.comments-area { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid #E5E5E5; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .comment { padding: 1.5rem 0; border-bottom: 1px solid #F3F4F6; }
.comment-list .children { list-style: none; margin-left: 2rem; padding-left: 1rem; border-left: 2px solid #F3F4F6; }
.comment-author { font-family: 'Rajdhani', sans-serif; font-weight: 600; color: #111; }
.comment-meta { font-family: 'Share Tech Mono', monospace; font-size: 0.7rem; color: #9CA3AF; margin-bottom: 0.5rem; }

/* WordPress caption */
.wp-caption { max-width: 100%; }
.wp-caption-text { font-family: 'Share Tech Mono', monospace; font-size: 0.75rem; color: #9CA3AF; text-align: center; margin-top: 0.5rem; }

/* Screen reader text */
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
