/* ======================================================================
   Seitaro Arai — Unified Stylesheet
   Path: /in/css/header.css
   Purpose: Header / Global Navigation / Drawer (visuals & dimensions only)
   Notes:
   - Breakpoints are consolidated at the bottom.
   - Navigation visibility toggles should preferably live in layout.css.
   ====================================================================== */


/* ======================================================================
   01) Header Shells
   - .header: legacy shell (kept for backward compatibility)
   - .site-header: primary sticky header with blur backdrop
   ====================================================================== */

/* Legacy header wrapper (kept for compatibility with older pages) */
.header {
  position: sticky;
  top: 0;
  right: auto;
  bottom: auto;
  left: auto;

  z-index: 100;

  /* Visuals */
  background-color: transparent;
  background-image: none;
  background-repeat: no-repeat;
  background-position: 0% 0%;
  background-size: auto;

  /* Backdrop effect */
  -webkit-backdrop-filter: saturate(150%) blur(6px);
  backdrop-filter: saturate(150%) blur(6px);

  /* Thin divider */
  border-top-width: 0;
  border-right-width: 0;
  border-bottom-width: 1px;
  border-left-width: 0;
  border-top-style: none;
  border-right-style: none;
  border-bottom-style: solid;
  border-left-style: none;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: rgba(0, 0, 0, 0.06);
  border-left-color: transparent;

  /* Subtle mixed white background */
  background: color-mix(in oklab, #ffffff 85%, white);
}

/* Primary sticky header */
.site-header {
  position: sticky;
  top: 0;
  right: auto;
  bottom: auto;
  left: auto;

  z-index: 3000; /* Keep above hero */

  /* Background with blur */
  background-color: rgba(255, 255, 255, 0.97);
  background-image: none;
  background-repeat: no-repeat;
  background-position: 0% 0%;
  background-size: auto;

  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}


/* ======================================================================
   02) Header Inner: .nav & Columns
   - Flex container for brand / links / utilities
   ====================================================================== */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 16px;
}


/* Overflow cut for decorative elements that may extend horizontally */
.header,
.nav,
.nav > .container {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
}


/* ======================================================================
   03) Branding
   - Symbol + Logotype
   ====================================================================== */

.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}


.brand .logotype {
  width: auto;
  height: 72px;
  object-fit: contain;

  transition-property: transform;
  transition-duration: 0.25s;
  transition-timing-function: ease;
  transition-delay: 0s;
}

.brand:hover .symbol,
.brand:hover .logotype {
  transform: scale(1.05);
}


/* ======================================================================
   04) Global Nav Links
   - Horizontal link group
   - CTA button style within nav
   ====================================================================== */

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-start;

  gap: 28px;
}

.nav-links a {
  font-weight: 600;
  color: #0f1a2b;
  transition-property: color;
  transition-duration: 0.2s;
  transition-timing-function: ease;
  transition-delay: 0s;
}

.nav-links a:hover {
  color: var(--blue);
}

/* Header Contact CTA (emphasized item inside nav-links) */
.nav .nav-links a.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 6px;

  background-color: var(--blue);
  background-image: none;
  color: #ffffff !important;

  padding-top: 10px;
  padding-right: 16px;
  padding-bottom: 10px;
  padding-left: 16px;

  border-top-left-radius: 9999px;
  border-top-right-radius: 9999px;
  border-bottom-right-radius: 9999px;
  border-bottom-left-radius: 9999px;

  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;

  /* outline is handled on :focus-visible below */
  border-top-width: 1px;
  border-right-width: 1px;
  border-bottom-width: 1px;
  border-left-width: 1px;
  border-top-style: solid;
  border-right-style: solid;
  border-bottom-style: solid;
  border-left-style: solid;
  border-top-color: rgba(0, 0, 0, 0.08);
  border-right-color: rgba(0, 0, 0, 0.08);
  border-bottom-color: rgba(0, 0, 0, 0.08);
  border-left-color: rgba(0, 0, 0, 0.08);

  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.08);

  transition-property: transform, box-shadow, background-color;
  transition-duration: 0.15s;
  transition-timing-function: ease;
  transition-delay: 0s;
}

.nav .nav-links a.cta:hover {
  background-color: #093a86; /* darker tone for hover */
  background-image: none;

  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
}

.nav .nav-links a.cta:focus-visible {
  outline-width: 2px;
  outline-style: solid;
  outline-color: var(--blue-2);
  outline-offset: 2px;
}


/* High-contrast support */
@media (prefers-contrast: more) {
  .nav .nav-links a.cta,
  .drawer-menu a.cta {
    border-top-color: rgba(255, 255, 255, 0.7);
    border-right-color: rgba(255, 255, 255, 0.7);
    border-bottom-color: rgba(255, 255, 255, 0.7);
    border-left-color: rgba(255, 255, 255, 0.7);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    transition-property: none;
    transition-duration: 0s;
  }
}


/* ======================================================================
   05) Language Switch
   - Simple inline links with accent color
   ====================================================================== */

.lang-switch {
  font-weight: 600;
  color: var(--blue);

  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 8px;
}

.lang-switch a {
  color: var(--blue);

  display: inline-block;

  padding-top: 0;
  padding-right: 4px;
  padding-bottom: 0;
  padding-left: 4px;
}

.lang-switch a.active {
  font-weight: 800;
  text-decoration-line: underline;
  text-decoration-thickness: auto;
  text-decoration-style: solid;
  text-underline-offset: auto;
}


/* ======================================================================
   06) Hamburger Button (SP)
   - Touch target, safe-area support
   - Visibility toggle is controlled elsewhere (layout)
   ====================================================================== */

.hamburger {
  /* Size & safe touch target */
  min-width: 44px;
  min-height: 44px;

  /* Visuals */
  background-color: #ffffff;
  background-image: none;
  background-repeat: no-repeat;
  background-position: 0% 0%;
  background-size: auto;

  color: var(--blue);

  /* Reset default button styles */
  border-top-width: 0;
  border-right-width: 0;
  border-bottom-width: 0;
  border-left-width: 0;
  border-top-style: none;
  border-right-style: none;
  border-bottom-style: none;
  border-left-style: none;

  /* Typography & box */
  font-size: 26px;
  line-height: 1;

  /* Box metrics */
  padding-top: 8px;
  padding-right: 8px;
  padding-bottom: 8px;
  padding-left: 8px;

  margin-top: 0;
  margin-right: max(6px, env(safe-area-inset-right));
  margin-bottom: 0;
  margin-left: auto;

  /* Layering */
  z-index: 4100;

  /* Interaction */
  cursor: pointer;

  /* By default hidden; layout.css will show at <920px */
  display: block;

  /* If shown as grid to center icon: */
  /* display: grid; place-items: center; width/height if needed */
  /* Keeping width/height as defaults unless overridden */
  transition-property: transform, color;
  transition-duration: 0.2s;
  transition-timing-function: ease;
  transition-delay: 0s;

  /* Touch action */
  touch-action: manipulation;
}

.hamburger:hover {
  transform: scale(1.1);
  color: var(--blue);
}

@supports (padding: max(0px)) {
  .hamburger {
    padding-right: max(0px, env(safe-area-inset-right));
  }
}


/* ======================================================================
   07) Drawer Panel (SP)
   - Right-side slide-in panel with backdrop
   ====================================================================== */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;

  width: min(82vw, 340px);
  height: 100dvh;

  background-color: #ffffff;
  background-image: none;
  background-repeat: no-repeat;
  background-position: 0% 0%;
  background-size: auto;

  border-top-width: 0;
  border-right-width: 0;
  border-bottom-width: 0;
  border-left-width: 1px;
  border-top-style: none;
  border-right-style: none;
  border-bottom-style: none;
  border-left-style: solid;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: transparent;
  border-left-color: #e5eaf0;

  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.08);

  transform: translateX(100%);
  transition-property: transform;
  transition-duration: 0.3s;
  transition-timing-function: ease;
  transition-delay: 0s;

  z-index: 4000;

  /* Spacing */
  padding-top: 28px;
  padding-right: 20px;
  padding-bottom: 28px;
  padding-left: 20px;

  overflow-x: hidden;
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(0);
}

/* Prevent body scroll when drawer is open */
html.drawer-open,
body.drawer-open {
  overflow-x: hidden;
  overflow-y: hidden;
}

/* Drawer menu links */
.drawer-menu {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;

  gap: 20px;
}

.drawer-menu a.cta {
  display: block;

  background-color: var(--blue);
  background-image: none;
  color: #ffffff !important;

  padding-top: 12px;
  padding-right: 18px;
  padding-bottom: 12px;
  padding-left: 18px;

  border-top-left-radius: 9999px;
  border-top-right-radius: 9999px;
  border-bottom-right-radius: 9999px;
  border-bottom-left-radius: 9999px;

  font-weight: 700;
  text-align: center;

  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
}

.drawer-menu a.cta:hover {
  background-color: #093a86;
  background-image: none;
}

.drawer-menu a.cta:focus-visible {
  outline-width: 2px;
  outline-style: solid;
  outline-color: var(--blue-2);
  outline-offset: 2px;
}


/* Drawer backdrop layer */
.drawer-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;

  background-color: rgba(0, 0, 0, 0.25);

  display: none;
  pointer-events: none;
  opacity: 0;

  z-index: 9998;
}

html.drawer-open .drawer-backdrop {
  display: block;
  pointer-events: auto;
  opacity: 1;
}


/* ======================================================================
   08) Active States (current page / current section)
   - aria-current で現在地を強調
   - Side menu present cases handled with same token family
   ====================================================================== */

.nav-links a[aria-current="section"],
.drawer-menu a[aria-current="section"],
.sidemenu__item a[aria-current="section"] {
  color: var(--pf-accent);
  font-weight: 800;
}

.sidemenu__item a[aria-current="section"] {
  background-color: #f5f8ff;

  border-top-width: 1px;
  border-right-width: 1px;
  border-bottom-width: 1px;
  border-left-width: 1px;
  border-top-style: solid;
  border-right-style: solid;
  border-bottom-style: solid;
  border-left-style: solid;
  border-top-color: rgba(13, 71, 161, 0.18);
  border-right-color: rgba(13, 71, 161, 0.18);
  border-bottom-color: rgba(13, 71, 161, 0.18);
  border-left-color: rgba(13, 71, 161, 0.18);

  transform: translateX(2px);
}

/* Focus-visible for accessibility */
.nav-links a[aria-current]:focus-visible,
.drawer-menu a[aria-current]:focus-visible,
.sidemenu__item a[aria-current]:focus-visible {
  outline-width: 3px;
  outline-style: solid;
  outline-color: var(--pf-focus);
  outline-offset: 3px;

  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: 6px;
}


/* ======================================================================
   09) Global Nav — Current Page underline (index2 style)
   - Underline only on the current page link
   ====================================================================== */

.nav a[aria-current="page"],
.nav-links a[aria-current="page"] {
  position: relative;
  color: var(--pf-accent);
  font-weight: 800;
}

.nav a[aria-current="page"]::after,
.nav-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;

  height: 3px;

  background-image: linear-gradient(90deg, var(--blue), var(--blue-2));
  background-color: transparent;

  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;

  opacity: 0.9;
}


/* ======================================================================
   10) Read Progress Indicator
   - Fixed bar under header; supports width-based and transform-based updates
   ====================================================================== */

#read-progress {
  position: fixed;
  top: calc(var(--header-h, 0px) + env(safe-area-inset-top));
  right: 0;
  bottom: auto;
  left: 0;

  height: 4px;

  z-index: 2147483647; /* Bring to front */
  pointer-events: none;

  background-color: transparent;
  background-image: linear-gradient(90deg, var(--blue, #0d47a1), var(--blue-2, #64b5f6));
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: var(--w, 0%) 100%;

  /* Soft track hint (optional) */
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.08);
}

#read-progress::before {
  content: "";
  display: block;

  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;            /* inset: 0; と同義 */

  width: 100%;
  height: 100%;

  transform-origin: left center;
  will-change: transform;

  background-image: linear-gradient(90deg, var(--blue) 0%, var(--blue-2) 100%);
  background-color: transparent;

  /* Track edge illumination */
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1);

  transition-property: transform;
  transition-duration: 0.08s;
  transition-timing-function: linear;
  transition-delay: 0s;

  border-top-left-radius: 0;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: 0;
}

/* Reduced motion for progress indicator */
@media (prefers-reduced-motion: reduce) {
  #read-progress::before {
    transition-property: none;
    transition-duration: 0s;
  }
}


/* ======================================================================
   11) Drawer Link Readability (spacing & hover)
   ====================================================================== */

.drawer-menu a {
  display: inline;
  line-height: 1.35;

  padding-top: 14px;
  padding-right: 4px;
  padding-bottom: 14px;
  padding-left: 4px;

  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 16px;
}

@media (hover: hover) {
  .drawer-menu a:hover {
    background-color: #f5f8ff;
    background-image: none;
  }
}


/* ======================================================================
   12) Media Queries (Consolidated at bottom)
   - Site header behavior change at < 920px
   - Body padding to prevent overlap with fixed header
   - Navigation visibility should be controlled in layout.css
   ====================================================================== */

/* < 920px: make header fixed and push body content */
@media (max-width: 920px) {
  .site-header {
    position: fixed;
    top: 0;
    right: 0;
    bottom: auto;
    left: 0;
  }

  body {
    padding-top: 76px !important; /* Push content by header height */
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
  }

  .nav {
    min-height: 76px;
  }
}
