/* ==========================================================================
   MATSUYA R&D - HEADER COMPONENT (SCOPED STYLES)
   Namespace: .mrd-header-*
   All rules are strictly scoped to prevent conflicts with other sections.
   ========================================================================== */

:root {
  --mrd-primary-blue: #004b87;
  --mrd-cyan-accent: #009fe3;
  --mrd-cyan-hover: #0081bb;
  --mrd-navy-dark: #0a2540;
  --mrd-text-main: #1f2937;
  --mrd-text-muted: #64748b;
  --mrd-border-color: #e5e7eb;
  --mrd-bg-light: #f8fafc;
  --mrd-white: #ffffff;
  --mrd-shadow-header: 0 4px 20px rgba(0, 0, 0, 0.07);
  --mrd-font-main: 'Roboto', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- HEADER CONTAINER & SCROLL BEHAVIOR --- */
.mrd-header-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  background-color: var(--mrd-white);
  box-shadow: var(--mrd-shadow-header);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
  font-family: var(--mrd-font-main);
  will-change: transform;
}

/* Hidden state when scrolling down */
.mrd-header-wrapper.mrd-header-hidden {
  transform: translateY(-100%);
  box-shadow: none;
}

/* Visible state when scrolling up */
.mrd-header-wrapper.mrd-header-visible {
  transform: translateY(0);
}

/* Header Full-Width Container (Edge-to-Edge) */
.mrd-header-container {
  width: 100%;
  max-width: 100%;
  padding-left: clamp(20px, 3.5vw, 60px);
  padding-right: clamp(20px, 3.5vw, 60px);
  box-sizing: border-box;
}

/* Base Content Container for Lower Sections (Boxed & Centered) */
.mrd-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

/* --- TIER 1: TOP BAR (DESKTOP) --- */
.mrd-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  background-color: #ffffff;
  width: 100%;
}

.mrd-topbar-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.mrd-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.mrd-logo-img {
  height: 50px;
  width: auto;
  object-fit: contain;
  display: block;
}

.mrd-topbar-right {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.5vw, 40px);
  overflow: hidden;
}

.mrd-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.mrd-contact-item:hover {
  opacity: 0.85;
}

.mrd-contact-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 159, 227, 0.1);
  color: var(--mrd-cyan-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mrd-contact-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.mrd-contact-text {
  display: flex;
  flex-direction: column;
}

.mrd-contact-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--mrd-text-muted);
  text-transform: capitalize;
  line-height: 1.2;
}

.mrd-contact-val {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--mrd-navy-dark);
  line-height: 1.3;
}

/* Running Marquee / Ticker for Address */
.mrd-contact-address-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: clamp(340px, 25vw, 460px);
  position: relative;
  overflow: hidden;
}

.mrd-ticker-wrap {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.mrd-ticker-content {
  display: inline-block;
  white-space: nowrap;
  animation: mrdMarquee 20s linear infinite;
  padding-left: 20px;
}

.mrd-contact-address-box:hover .mrd-ticker-content {
  animation-play-state: paused;
}

@keyframes mrdMarquee {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* --- TIER 2: NAVIGATION BAR --- */
.mrd-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  background-color: #ffffff;
}

.mrd-nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.mrd-nav-item {
  position: relative;
}

.mrd-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 16px 14px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--mrd-navy-dark);
  text-decoration: none;
  position: relative;
  transition: color 0.2s ease;
}

.mrd-nav-link svg {
  width: 10px;
  height: 10px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.mrd-nav-link:hover {
  color: var(--mrd-cyan-accent);
}

.mrd-nav-link:hover svg {
  transform: rotate(180deg);
}

/* Active item indicator (cyan top border like main website) */
.mrd-nav-item.active > .mrd-nav-link,
.mrd-nav-link.active {
  color: var(--mrd-cyan-accent);
}

.mrd-nav-item.active::before,
.mrd-nav-item:hover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 3px;
  background-color: var(--mrd-cyan-accent);
  border-radius: 0 0 2px 2px;
}

/* Desktop Dropdown Submenu */
.mrd-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: var(--mrd-white);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid #f1f5f9;
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  list-style: none;
  z-index: 100;
}

.mrd-nav-item:hover .mrd-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mrd-nav-item:last-child .mrd-dropdown {
  left: auto;
  right: 0;
}

.mrd-dropdown-link {
  display: block;
  padding: 10px 20px;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--mrd-text-main);
  text-decoration: none;
  transition: all 0.2s ease;
}

.mrd-dropdown-link:hover {
  background-color: #f0f9ff;
  color: var(--mrd-cyan-accent);
  padding-left: 24px;
}

/* CTA BUTTON */
.mrd-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--mrd-cyan-accent);
  color: var(--mrd-white);
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 11px 24px;
  border-radius: 6px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  box-shadow: 0 4px 12px rgba(0, 159, 227, 0.28);
}

.mrd-cta-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.mrd-cta-btn:hover {
  background-color: var(--mrd-cyan-hover);
  box-shadow: 0 6px 16px rgba(0, 159, 227, 0.38);
  transform: translateY(-1px);
}

.mrd-cta-btn:hover svg {
  transform: translateX(3px);
}

/* --- MOBILE SPECIFIC HEADER --- */
.mrd-mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background-color: #ffffff;
}

.mrd-mobile-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.mrd-hamburger-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.mrd-hamburger-btn:hover {
  background-color: #f1f5f9;
}

.mrd-hamburger-line {
  display: block;
  width: 24px;
  height: 2.5px;
  background-color: var(--mrd-navy-dark);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Mobile Drawer Overlay */
.mrd-mobile-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mrd-mobile-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Drawer */
.mrd-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 85%;
  max-width: 340px;
  height: 100%;
  background-color: #ffffff;
  z-index: 10001;
  box-shadow: -8px 0 25px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.mrd-mobile-drawer.active {
  transform: translateX(0);
}

.mrd-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.mrd-drawer-close-btn {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--mrd-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.mrd-drawer-close-btn:hover {
  color: var(--mrd-navy-dark);
  background-color: #f1f5f9;
}

.mrd-drawer-nav {
  padding: 8px 0;
  flex: 1;
}

.mrd-drawer-item {
  border-bottom: 1px solid #f8fafc;
}

.mrd-drawer-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--mrd-navy-dark);
  font-size: 17px;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mrd-drawer-link-row:hover,
.mrd-drawer-link-row.active {
  background-color: #f0f9ff;
  color: var(--mrd-cyan-accent);
}

.mrd-drawer-arrow-btn {
  background: #f1f5f9;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mrd-drawer-arrow-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  transition: transform 0.25s ease;
}

.mrd-drawer-arrow-btn.open svg {
  transform: rotate(180deg);
}

.mrd-drawer-submenu {
  display: none;
  background-color: #f8fafc;
  padding: 6px 0 6px 16px;
  border-left: 3px solid var(--mrd-cyan-accent);
}

.mrd-drawer-submenu.open {
  display: block;
}

.mrd-drawer-sublink {
  display: block;
  padding: 10px 16px;
  font-size: 16px;
  color: var(--mrd-text-main);
  text-decoration: none;
  font-weight: 500;
}

.mrd-drawer-sublink:hover {
  color: var(--mrd-cyan-accent);
}

.mrd-drawer-footer {
  padding: 20px;
  border-top: 1px solid #f1f5f9;
  background-color: #ffffff;
}

.mrd-drawer-footer .mrd-cta-btn {
  width: 100%;
  padding: 12px 20px;
}

.mrd-drawer-contact-quick {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
  color: var(--mrd-text-muted);
}

.mrd-drawer-contact-quick a {
  color: var(--mrd-navy-dark);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mrd-drawer-contact-quick a svg {
  width: 14px;
  height: 14px;
  fill: var(--mrd-cyan-accent);
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 1024px) {
  .mrd-topbar,
  .mrd-navbar {
    display: none;
  }

  .mrd-mobile-bar {
    display: flex;
  }
}
