@use "variables" as *; // --------------------------------------------------------------------------- // Fixed header // > 1024 : inline PC nav (links + SNS) // <=1024 : hamburger + fullscreen overlay (tablet & SP) // --------------------------------------------------------------------------- // Offset page content for the fixed header + keep in-page anchors visible. body { padding-top: $header-h-pc; @include sp { padding-top: $header-h-sp; } } html { scroll-padding-top: $header-h-pc; @include sp { scroll-padding-top: $header-h-sp; } } // Lock scroll while the overlay is open. body.is-nav-open { overflow: hidden; } .site-header { position: fixed; inset: 0 0 auto; z-index: $z-header; height: $header-h-pc; background: rgba(255, 255, 255, 0.9); // 90% white (design) @include sp { height: $header-h-sp; } } // Pass the header height down the gutter layer so the flex row can center. .site-header > .inner { height: 100%; } .site-header__inner { display: flex; align-items: center; justify-content: space-between; column-gap: rem(40); // breathing room between logo and nav height: 100%; } .site-header__logo { position: relative; z-index: 1; // overlay sits ABOVE the logo when open a { display: block; transition: opacity 0.3s; &:hover { opacity: 0.6; // hover -> semi-transparent } } img { display: block; width: rem(180); height: auto; } @include sp { img { width: auto; height: rem(40); // SP logo 103x40 } } } // --------------------------------------------------------------------------- // Global nav — PC inline row. // --------------------------------------------------------------------------- .gnav { display: flex; align-items: center; gap: rem(24); } .gnav__list { display: flex; align-items: center; gap: rem(28); } .gnav__link { display: flex; flex-direction: column; align-items: center; gap: rem(10); // JP / EN gap text-decoration: none; transition: opacity 0.3s; &:hover { text-decoration: none; opacity: 0.6; } } .gnav__ja { font-family: $font-serif; font-weight: 700; font-size: rem(16); color: $color-text; // design: black line-height: 1; } .gnav__en { font-family: $font-sans; font-weight: 400; font-size: rem(12); color: $color-green; line-height: 1; } .gnav__sns { display: flex; align-items: center; gap: rem(20); img { display: block; width: rem(40); height: rem(40); } } // --------------------------------------------------------------------------- // Hamburger — visible <=1024. Bars 40 / 30 / 20 (design), 3px, 10px apart. // --------------------------------------------------------------------------- .hamburger { display: none; flex-direction: column; align-items: flex-start; gap: rem(7); position: relative; z-index: 3; // above the overlay so it stays tappable (becomes the close X) padding: rem(4) 0; background: none; border: 0; cursor: pointer; @include tab { display: flex; } } .hamburger__box { position: relative; display: block; width: rem(40); height: rem(23); // bars at 0 / 10 / 20 + 3px } .hamburger__bar { position: absolute; left: 0; height: rem(3); background: $color-green; transition: width 0.25s, top 0.25s, transform 0.25s, opacity 0.25s; &--1 { top: 0; width: rem(40); } &--2 { top: rem(10); width: rem(30); } &--3 { top: rem(20); width: rem(20); } } .hamburger__label { font-family: $font-serif; font-weight: 700; font-size: rem(11); letter-spacing: 0.04em; text-transform: uppercase; color: $color-green; line-height: 1; } // Hamburger -> X when open (bars equalize and cross at the middle). .is-nav-open .hamburger__bar { &--1 { top: rem(10); width: rem(40); transform: rotate(45deg); } &--2 { opacity: 0; } &--3 { top: rem(10); width: rem(40); transform: rotate(-45deg); } } // --------------------------------------------------------------------------- // Overlay behaviour (<=1024) // z-order within the header stacking context: logo(1) < overlay(2) < ham(3) // Scroll-safe: `safe center` falls back to top-align when the viewport is // too short, so the top never gets clipped; overflow-y allows scrolling. // --------------------------------------------------------------------------- @include tab { .gnav { position: fixed; inset: 0; z-index: 2; flex-direction: column; align-items: center; justify-content: center; justify-content: safe center; gap: rem(48); padding: calc(#{$header-h-pc} + #{rem(20)}) rem(30) rem(40); background: $color-white; // solid white overflow-y: auto; overscroll-behavior: contain; // closed state opacity: 0; visibility: hidden; transform: translateY(rem(-16)); transition: opacity 0.3s, transform 0.3s, visibility 0.3s; } .is-nav-open .gnav { opacity: 1; visibility: visible; transform: none; } .gnav__list { flex-direction: column; gap: rem(36); } .gnav__link { gap: rem(8); } .gnav__ja { font-size: rem(22); } .gnav__en { font-size: rem(13); } .gnav__sns { gap: rem(28); img { width: rem(48); height: rem(48); } } } @include sp { .gnav { padding: calc(#{$header-h-sp} + #{rem(20)}) rem(20) rem(40); } .gnav__sns img { width: rem(44); height: rem(44); } }