/* =====================================================
   layout.css — Header, Footer, Container, Nav, Sections
   ===================================================== */

/* ---- Container ---- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
}

/* ---- Section Base ---- */
.section { padding: var(--sp-2xl) 0; }
.section-alt { background: var(--bg-cream); }

.section-tag {
  display: block;
  font-family: var(--font-en);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.section-tag.accent { color: var(--accent); }

.section-title {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-light);
  font-size: 0.925rem;
  line-height: 1.85;
  margin-bottom: 2.5rem;
}
.section-desc small { font-size: 0.8em; }

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.header.scrolled {
  border-color: var(--border-warm);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-inline: var(--content-pad-x);
}

.logo { flex-shrink: 0; }
.logo-img {
  display: block;
  height: 29px;
  width: auto;
}

/* ---- Navigation ---- */
.nav { flex: 1; }
.nav-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
}
.nav-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-light);
  transition: color var(--transition);
}
.nav-list a:hover {
  opacity: 1;
  color: var(--text-main);
}
/* Desktop only — stretch the trigger link to fill the full header height.
   Text stays visually centered, but the hover zone now extends edge-to-edge
   so the cursor can travel from the trigger down into the dropdown panel
   without crossing a dead gap that would drop the :hover state. */
@media (min-width: 1024px) {
  .nav-list > li > a {
    height: var(--header-h);
    padding-top: 0;
    padding-bottom: 0;
  }
}
.header-cta {
  flex-shrink: 0;
  font-size: 0.85rem;
  padding: 0.6rem 1.35rem;
}
.header-cta:hover { transform: none; }

/* Chevron — rotates from down (default) to up (open), Stripe-style.
   Rotation is driven by the JS-applied .is-active class so it stays in
   sync with the actual panel state during inter-item hover transitions. */
.nav-chevron {
  flex-shrink: 0;
  width: 10px;
  height: 6px;
  opacity: 0.65;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.has-dropdown.is-active > a .nav-chevron,
.has-dropdown:focus-within > a .nav-chevron {
  transform: rotate(180deg);
  opacity: 1;
}
.has-dropdown.is-active > a { color: var(--text-main); }

/* ---- Shared mega-menu panel ----
   One persistent panel that morphs between content groups. Height is set
   by JS to match the active .dropdown-content; contents cross-fade at the
   same position so the panel never "closes and reopens" between hovers. */
.dropdown-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border-warm);
  border-bottom: 1px solid var(--border-warm);
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.10);
  z-index: 9;
  height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    height 0.28s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.2s ease,
    visibility 0s linear 0.28s;
}
.dropdown-panel.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    height 0.28s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.18s ease;
}

/* Each content group stacks at the same position; only .active is opaque.
   offsetHeight on the active group drives the panel's animated height. */
.dropdown-content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.dropdown-content.active {
  opacity: 1;
  pointer-events: auto;
}
.dropdown-content-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.5rem var(--content-pad-x) 1.75rem;
}

.dropdown-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.25rem 0.75rem;
  max-width: 720px;
  margin: 0 auto;
}
.dropdown-list li { list-style: none; }
.dropdown-list a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--r-sm);
  white-space: normal;
  transition: background var(--transition);
}
.dropdown-list a:hover { background: var(--bg-cream); }
.dropdown-link-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  transition: color var(--transition);
}
.dropdown-link-desc {
  font-size: 0.78rem;
  color: var(--text-light);
  line-height: 1.5;
}
.dropdown-list a:hover .dropdown-link-label { color: var(--primary); }

/* ---- Mobile Toggle ---- */
.menu-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-left: auto;
  background: rgba(0, 174, 239, 0.12);
  border: none;
  border-radius: 12px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.menu-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Footer ---- */
.footer {
  position: relative;
  background: #16213E;
  color: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}
/* Top accent rule — soft white line with a slow blue→orange glow bar
   that sweeps left to right. The white base makes the colors read
   noticeably brighter than they would against the dark navy; the
   streak is narrow with soft edges so the motion stays ambient
   rather than attention-grabbing. */
.footer::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  /* White base — the canvas on which the colored glow bar moves. */
  background-color: rgba(255, 255, 255, 0.78);
  /* Glow bar — narrow blue→orange streak with soft transparent edges.
     Image is 2.5× the container width so the streak can ride fully
     off-screen at both ends of the sweep, giving a seamless loop. */
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    transparent 40%,
    rgba(0, 174, 239, 0.92)  47%,
    rgba(245, 158, 11, 0.92) 53%,
    transparent 60%,
    transparent 100%
  );
  background-size: 250% 100%;
  background-position: 120% 0;
  background-repeat: no-repeat;
  /* Soft bloom downward into the navy — gives the streak a halo */
  filter:
    drop-shadow(0 0 6px rgba(0, 174, 239, 0.32))
    drop-shadow(0 0 10px rgba(245, 158, 11, 0.22));
  animation: footer-glow-sweep 10s linear infinite;
  will-change: background-position;
}

@keyframes footer-glow-sweep {
  /* Streak starts fully off-screen LEFT and ends fully off-screen RIGHT.
     Because both endpoints have no visible streak, the loop is seamless. */
  0%   { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

/* Respect users who prefer reduced motion — keep the colors,
   drop the sweep and pin the glow bar in the center. */
@media (prefers-reduced-motion: reduce) {
  .footer::before {
    animation: none;
    background-image: linear-gradient(
      90deg,
      transparent 0%,
      rgba(0, 174, 239, 0.7)  30%,
      rgba(245, 158, 11, 0.7) 70%,
      transparent 100%
    );
    background-size: 100% 100%;
    background-position: 0 0;
  }
}

.footer-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr);
  align-items: flex-start;
  gap: var(--sp-2xl);
  padding-top: var(--sp-2xl);
  padding-bottom: var(--sp-xl);
}

/* ---- Brand block ---- */
.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.05rem;
}
.footer-logo-link {
  display: inline-block;
  transition: opacity var(--transition);
}
.footer-logo-link:hover { opacity: 0.85; }
.footer-logo-img {
  display: block;
  height: 32px;
  width: auto;
}
.footer-tagline {
  font-size: 0.86rem;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.62);
  max-width: 30ch;
}
.footer-slogan {
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--primary);
  margin-top: -0.2rem;
}

/* ---- Nav columns ---- */
.footer-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-lg);
}
.footer-nav-col {
  display: flex;
  flex-direction: column;
}
.footer-nav-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.footer-nav-list a {
  display: inline-block;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.68);
  transition: color var(--transition);
}
.footer-nav-list a:hover {
  opacity: 1;
  color: #fff;
}

/* ---- Footer bottom ---- */
.footer-bottom {
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--sp-md) 0;
}
.footer-bottom-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1.2rem;
}
.footer-copy {
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}
.footer-trademark {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
}

/* ---- Mobile Sticky CTA ---- */
.mobile-sticky-cta {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border-warm);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  /* Two siblings now: compact video trigger + primary CTA filling rest */
  gap: 0.55rem;
  align-items: stretch;
}
.mobile-sticky-cta-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.mobile-sticky-cta-link:hover { transform: none; }
/* Video trigger pill — sits alongside the LINE CTA.
   Mirrors the hero floating trigger's pattern (play disc + label) at
   a tighter, mobile-appropriate size. */
.mobile-sticky-video {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 50px;       /* match the primary CTA's height exactly */
  padding: 0 0.95rem 0 0.35rem;
  background: #fff;
  border: 1.5px solid var(--primary);
  border-radius: var(--r-full);
  color: var(--primary);
  font-family: var(--font-ja);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.mobile-sticky-video:hover,
.mobile-sticky-video:focus-visible {
  background: var(--primary);
  color: #fff;
  outline: none;
}
/* Play-icon disc inside the pill — colors invert on hover to keep contrast */
.mobile-sticky-video-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.mobile-sticky-video:hover .mobile-sticky-video-icon,
.mobile-sticky-video:focus-visible .mobile-sticky-video-icon {
  background: #fff;
  color: var(--primary);
}
/* Play triangle: path is geometrically centered (centroid at 12,12 of
   the 24×24 viewBox), so no margin/transform hacks are needed. */
.mobile-sticky-video-icon svg {
  width: 16px;
  height: 16px;
}
.mobile-sticky-video-label {
  display: inline-block;
  line-height: 1;
}
/* When the sticky CTA becomes visible (≤520px), switch to a flex row */
@media (max-width: 520px) {
  .mobile-sticky-cta { display: flex; }
}

/* ---- Intro video modal — native <dialog> + native video controls ---- */
.video-modal {
  /* Reset <dialog> defaults so we own the layout */
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  overflow: hidden;
}
/* When <dialog> is closed it shouldn't take up layout space.
   The native <dialog> already does this, but make it explicit. */
.video-modal:not([open]) { display: none; }
.video-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Backdrop — the native pseudo-element styled to a deep dark wash */
.video-modal::backdrop {
  background: rgba(8, 12, 22, 0.92);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Vertical 9:16 video, height-bound so it fits the viewport without crop */
.video-modal-player {
  display: block;
  width: auto;
  height: min(92dvh, 92vh);
  max-width: 92vw;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: var(--r-md);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  outline: none;
}

/* Close affordance — glass disc, top-right of the viewport */
.video-modal-close {
  position: absolute;
  top: clamp(1rem, 3vw, 1.5rem);
  right: clamp(1rem, 3vw, 1.5rem);
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
}
.video-modal-close:hover,
.video-modal-close:focus-visible {
  background: rgba(255, 255, 255, 0.26);
  outline: none;
  transform: scale(1.06);
}
.video-modal-close svg { width: 22px; height: 22px; }

/* Mobile: pull the close button slightly inside so it doesn't collide
   with the iOS status bar / safe area */
@media (max-width: 520px) {
  .video-modal-player {
    height: auto;
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }
  .video-modal-close {
    top: max(env(safe-area-inset-top, 0), 0.75rem);
    right: 0.75rem;
  }
}

/* ---- Responsive ---- */

/* Hamburger menu kicks in at ≤1023px (laptop/tablet boundary).
   The desktop nav crowds together when 5 nav items + logo + CTA share
   the limited width below ~1024px, causing awkward line wraps. Swap to
   a drawer-style menu earlier, while keeping the header CTA visible
   down to 768px so the "無料体験" call-to-action stays in reach. */
@media (max-width: 1023px) {
  .nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 400;
    flex: none;
    display: flex;
    flex-direction: column;
    padding: calc(var(--header-h) + 2.5rem) 0 2rem;
    overflow-y: auto;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear 0.38s;
  }
  .nav.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s linear;
  }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 0 var(--content-pad-x);
    max-width: 560px;
    margin: 0 auto;
  }
  .nav-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.7rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-warm);
    overflow: hidden;
  }
  .nav-list a::after {
    content: '';
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--text-light);
    border-top: 1.5px solid var(--text-light);
    transform: rotate(45deg);
    margin-left: 0.5rem;
    margin-right: 1px;
  }
  .dropdown-panel { display: none !important; }
  .nav-chevron { display: none; }
  .menu-toggle { display: flex; position: relative; z-index: 500; }
  .logo { position: relative; z-index: 500; }
  /* Header CTA stays visible alongside the hamburger from 768-1023px */
  .header-cta {
    margin-left: auto;
    position: relative;
    z-index: 500;
  }
  .header-inner { gap: 0.75rem; }
  .menu-toggle { margin-left: 0; }
}

/* Narrow mobile (≤520px): hide header CTA — sticky bottom CTA takes over.
   The header CTA and the bottom sticky CTA are mutually exclusive; whichever
   one is visible owns the call-to-action so the user only sees it in one place. */
@media (max-width: 520px) {
  .header-cta { display: none; }
  .menu-toggle { margin-left: auto; }
  /* .mobile-sticky-cta becomes a flex row at this breakpoint —
     see the .mobile-sticky-cta-link / .mobile-sticky-video block above */
}

/* Tablet — stack brand block above the nav columns */
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--sp-xl);
    padding-top: var(--sp-xl);
  }
}

/* True mobile (≤767px): collapse footer + section spacing */
@media (max-width: 767px) {
  .section { padding: var(--sp-xl) 0; }

  .footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-lg) var(--sp-md);
  }
  .footer-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .footer-logo-img { height: 28px; }
  .footer-slogan { font-size: 1.4rem; }
}

/* Narrow phones — single nav column + extra bottom space for the sticky CTA */
@media (max-width: 480px) {
  .footer-nav { grid-template-columns: 1fr; gap: var(--sp-md); }
  .footer-bottom { padding-bottom: calc(var(--sp-md) + 60px); }
}

/* Tighten header CTA on small viewports so it fits next to the logo + hamburger */
@media (max-width: 767px) {
  .header-cta {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }
  .logo-img { height: 24px; }
}
