/* ══════════════════════════════════════════════
   s-common.css — main_01〜04 共通スタイル
   ページ固有の :root トークンは各 main_0X.css で上書き
══════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
img { display: block; width: 100%; }

/* ── BASE TOKENS (ページCSSで上書き) ── */
:root {
  --bg:       #F3F4F2;
  --bg-white: #FAFAF8;
  --ink:      #141412;
  --mid:      #5A5A55;
  --faint:    #9A9A94;
  --line:     rgba(20,20,18,.08);
  --green:    #2B5A4B;
  --green-lt: #3A7060;
  --black-s:  #111110;
  --serif:    'Noto Serif JP', serif;
  --sans:     'Jost', 'Noto Sans JP', sans-serif;
  --display:  'Cormorant Garamond', serif;
  --ui:       'Jost', sans-serif;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── UTILITIES ── */
.small-label {
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 300;
}

.green-label {
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 300;
}

/* ── LEGACY PAGE NAV ── */
.page-nav {
  position: fixed;
  top: 0; right: 0;
  z-index: 100;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-end;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.nav-links a {
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--mid);
  text-decoration: none;
  font-weight: 300;
  transition: color .25s;
}

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

/* Fixed logo top-left */
.nav-logo {
  position: fixed;
  top: 32px; left: 40px;
  z-index: 100;
  font-family: var(--ui);
  font-size: 14px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  font-weight: 400;
}

/* ── SIDE MENU (サブメニュー付きナビ) ── */
.side-menu {
  position: fixed;
  right: 55px;
  top: 18vh;
  transform: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: right;
  z-index: 700;
  color: var(--ink);
}

.menu-item {
  position: relative;
  font-size: 18px;
  letter-spacing: .2em;
  color: inherit;
}

.side-menu a,
.menu-toggle {
  color: inherit;
}

.menu-toggle {
  border: none;
  background: transparent;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  transition: opacity .2s ease;
}

.menu-toggle:hover,
.menu-toggle:focus {
  opacity: .6;
  outline: none;
}

.submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 140px;
  top: 0;
  transform: none;
  width: 260px;
  display: none;
  gap: 12px;
}

.submenu.is-open {
  display: flex;
  flex-direction: column;
}

.submenu::after {
  content: "";
  position: absolute;
  right: -80px;
  top: 12px;
  width: 60px;
  height: 1px;
  background: rgba(20,20,18,.35);
}

.submenu-card {
  display: flex;
  align-items: stretch;
  text-decoration: none;
  color: #333;
  background: rgba(255,255,255,.95);
  border-radius: 2px;
  box-shadow: 0 8px 20px rgba(0,0,0,.15);
  overflow: hidden;
  transition: transform .2s ease;
}

.side-menu .submenu-card,
.side-menu .submenu-card .card-title {
  color: #333;
}

.side-menu .submenu-card .card-tag {
  color: #999;
}

.submenu-card:hover {
  transform: translateY(-2px);
}

.submenu-card[aria-current="page"] {
  outline: 2px solid rgba(43,90,75,.4);
}

.card-no {
  flex: 0 0 60px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  letter-spacing: .1em;
  border-right: 1px solid #e5e5e5;
}

.card-body {
  padding: 12px 18px;
}

.card-tag {
  margin: 0;
  font-size: 11px;
  letter-spacing: .2em;
  color: #999;
}

.card-title {
  margin: 4px 0 0;
  font-size: 18px;
  letter-spacing: .08em;
  font-weight: 600;
}

/* ── SECTION WRAPPER ── */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 60px;
}

/* ── DIVIDER ── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--line);
}

/* ── PHOTO ── */
.photo {
  background: #C8CECA;
  overflow: hidden;
  position: relative;
}

.photo-inner {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-color: #B8BCB8;
}

.photo-caption {
  position: absolute;
  bottom: 20px; left: 24px;
  font-family: var(--ui);
  font-size: 9px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: rgba(255,255,255,.55);
  font-weight: 300;
}

/* ── TEXT LINK ── */
.text-link {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  font-weight: 300;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ink);
  transition: gap .3s, color .25s;
}
.text-link:hover { gap: 20px; color: var(--green); border-color: var(--green); }

/* ── SCROLL FADE ── */
.fade {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s cubic-bezier(.25,.46,.45,.94),
              transform .9s cubic-bezier(.25,.46,.45,.94);
}
.fade.on { opacity: 1; transform: none; }

.fade-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity .9s cubic-bezier(.25,.46,.45,.94),
              transform .9s cubic-bezier(.25,.46,.45,.94);
}
.fade-left.on { opacity: 1; transform: none; }

.fade-right {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity .9s cubic-bezier(.25,.46,.45,.94),
              transform .9s cubic-bezier(.25,.46,.45,.94);
}
.fade-right.on { opacity: 1; transform: none; }

.fade-scale {
  opacity: 0;
  transform: scale(.96) translateY(20px);
  transition: opacity .9s cubic-bezier(.25,.46,.45,.94),
              transform .9s cubic-bezier(.25,.46,.45,.94);
}
.fade-scale.on { opacity: 1; transform: none; }

.delay-1 { transition-delay: .1s; }
.delay-2 { transition-delay: .2s; }
.delay-3 { transition-delay: .3s; }
.delay-4 { transition-delay: .4s; }

/* ── PROGRESS LINE ── */
#prog {
  position: fixed;
  top: 0; left: 0;
  height: 1px;
  background: var(--green);
  z-index: 9999;
  width: 0%;
  transition: width .08s linear;
}

/* ── セクション名フロート表示 ── */
#section-float {
  position: fixed;
  bottom: 40px; left: 48px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--mid);
  font-weight: 300;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .5s, transform .5s;
  pointer-events: none;
}
#section-float.show { opacity: 1; transform: translateY(0); }
#section-float::before {
  content: '';
  width: 20px; height: 1px;
  background: var(--green);
  flex-shrink: 0;
}

/* ── 見出しマスクリビール ── */
.mask-reveal { display: block; overflow: hidden; }
.mask-reveal-inner {
  display: block;
  transform: translateY(105%);
  transition: transform 1s cubic-bezier(.77,0,.175,1);
}
.mask-reveal.on .mask-reveal-inner { transform: translateY(0); }

/* ── 写真パララックス ── */
.parallax-photo .photo-inner {
  transition: transform .08s linear;
  will-change: transform;
  transform-origin: center;
}

/* ── 磁力ボタン ── */
.magnetic-wrap {
  display: inline-block;
  transition: transform .4s cubic-bezier(.25,.46,.45,.94);
}

/* ── カスタムカーソル ── */
*, *::before, *::after { cursor: none !important; }

#cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: background .25s, opacity .25s;
}
#cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 36px; height: 36px;
  border: 1px solid rgba(43,90,75,.45);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  transition: border-color .3s, opacity .3s;
}
#cursor-label {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 99997;
  font-family: var(--ui);
  font-size: 9px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--bg-white);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity .2s;
  white-space: nowrap;
}
body.cursor-hover #cursor-dot { background: var(--green); opacity: .85; }
body.cursor-hover #cursor-ring { border-color: rgba(43,90,75,.7); }
body.cursor-hover #cursor-label { opacity: 1; }

/* ── 写真グレースケール → カラー ── */
.photo-inner {
  filter: grayscale(100%);
  transition: filter .7s cubic-bezier(.4,0,.2,1),
              transform .08s linear;
}
.photo:hover .photo-inner { filter: grayscale(0%); }
.parallax-photo:hover .photo-inner { filter: grayscale(0%); }

/* ── フィルムグレイン ── */
#grain {
  position: fixed;
  inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 9990;
  opacity: .028;
  animation: grain-move 0.12s steps(1) infinite;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
@keyframes grain-move {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-2%, -3%); }
  20%  { transform: translate(3%,  2%); }
  30%  { transform: translate(-1%,  4%); }
  40%  { transform: translate(4%, -1%); }
  50%  { transform: translate(-3%,  3%); }
  60%  { transform: translate(2%, -4%); }
  70%  { transform: translate(-4%,  1%); }
  80%  { transform: translate(1%,  3%); }
  90%  { transform: translate(3%, -2%); }
  100% { transform: translate(-2%, 4%); }
}

/* ── スクロール進捗ライン（右端縦） ── */
#scroll-track {
  position: fixed;
  right: 28px; top: 50%;
  transform: translateY(-50%);
  width: 1px; height: 120px;
  background: rgba(20,20,18,.1);
  z-index: 500;
  pointer-events: none;
}
#scroll-fill {
  position: absolute;
  top: 0; left: 0;
  width: 1px;
  height: 0%;
  background: var(--green);
  transition: height .12s linear;
}

/* ══════════════════════════════════════════════
   MOBILE-ONLY UI: デスクトップでは非表示
   sp-header.html の要素はモバイル専用
══════════════════════════════════════════════ */
.sp-main-header  { display: none; }
.smart_menu      { display: none; }
.sp-menu-overlay { display: none; }

/* ══════════════════════════════════════════════
   RESPONSIVE — MOBILE BOTTOM NAV (≤768px)
   共通: main_01〜04 で sp-header.html を使う場合
══════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Hide desktop-only elements ── */
  .side-menu     { display: none !important; }
  #section-float { display: none; }
  #scroll-track  { display: none; }
  #cursor-dot, #cursor-ring, #cursor-label { display: none; }

  /* Logo */
  .nav-logo { top: 18px; left: 20px; font-size: 12px; }

  /* Bottom padding so content clears the fixed bottom nav */
  body { padding-bottom: calc(50px + env(safe-area-inset-bottom, 0)); }

  /* ── BOTTOM NAV BAR ── */
  .sp-main-header {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: flex;
    align-items: stretch;
    background: rgba(250,250,248,.97);
    border-top: 1px solid rgba(20,20,18,.15);
    z-index: 500;
    backdrop-filter: blur(8px);
  }

  .main_menu.menu_black { flex: 1; }

  .main_menu.menu_black ul {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 0; margin: 0; list-style: none;
  }

  .main_menu.menu_black li {
    text-align: center;
    position: relative;
  }

  .main_menu.menu_black li + li::before {
    content: '';
    position: absolute;
    left: 0; top: 25%; bottom: 25%;
    width: 1px;
    background: rgba(20,20,18,.1);
  }

  .main_menu.menu_black .heading {
    background: none;
    border: none;
    color: var(--ink);
    font-family: var(--ui);
    font-size: 9px;
    letter-spacing: .2em;
    text-transform: uppercase;
    font-weight: 300;
    padding: 14px 6px calc(14px + env(safe-area-inset-bottom, 0));
    width: 100%;
    position: relative;
    cursor: pointer;
  }

  /* Submenu popup (above nav bar) */
  .main_menu.menu_black .wrap { display: none; }

  .main_menu.menu_black .wrap.is-open {
    display: block;
    position: fixed;
    left: 1rem; right: 1rem;
    bottom: calc(50px + env(safe-area-inset-bottom, 0) + 6px);
    background: var(--bg-white);
    padding: 20px 24px;
    border-radius: 4px;
    box-shadow: 0 -4px 32px rgba(0,0,0,.16);
    z-index: 510;
  }

  .main_menu.menu_black .wrap ul,
  .main_menu.menu_black .wrap ol {
    margin: 0; padding: 0; list-style: none;
  }

  .main_menu.menu_black .wrap ol li,
  .main_menu.menu_black .wrap ul li {
    margin: 0 0 18px;
    position: relative;
    padding-left: 28px;
  }

  .main_menu.menu_black .wrap ol li:last-child,
  .main_menu.menu_black .wrap ul li:last-child { margin-bottom: 0; }

  .main_menu.menu_black .wrap-label {
    display: block;
    margin: 0 0 2px;
    font-size: 9px;
    color: var(--faint);
    letter-spacing: .2em;
    font-family: var(--ui);
  }

  .main_menu.menu_black .wrap ol li::before,
  .main_menu.menu_black .wrap ul li::before {
    content: '';
    position: absolute;
    left: 0; top: 14px;
    width: 20px; height: 1px;
    background: rgba(20,20,18,.2);
  }

  .main_menu.menu_black .wrap a {
    font-family: var(--serif);
    display: block;
    padding: 2px 0 0;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 300;
  }

  /* ── HAMBURGER BUTTON ── */
  .menu_button.smart {
    width: 44px;
    border: none;
    background: var(--ink);
    flex-shrink: 0;
    position: relative;
    z-index: 999;
    cursor: pointer !important;
  }

  .menu_button.smart::before,
  .menu_button.smart::after {
    content: '';
    position: absolute;
    left: 50%; width: 18px; height: 1px;
    background: #fff;
    transform: translateX(-50%);
    transition: transform .25s ease, top .25s ease, background .2s ease;
  }

  .menu_button.smart::before { top: calc(50% - 5px); }
  .menu_button.smart::after  { top: calc(50% + 5px); }

  .menu_button.smart.is-open,
  body.is-mobile-menu-open .menu_button.smart {
    background: #fff;
  }

  .menu_button.smart.is-open::before,
  body.is-mobile-menu-open .menu_button.smart::before {
    top: 50%; transform: translate(-50%,-50%) rotate(45deg); background: var(--ink);
  }

  .menu_button.smart.is-open::after,
  body.is-mobile-menu-open .menu_button.smart::after {
    top: 50%; transform: translate(-50%,-50%) rotate(-45deg); background: var(--ink);
  }

  /* ── SMART MENU DRAWER ── */
  .smart_menu {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--black-s);
    color: #fff;
    display: none;
    flex-direction: column;
    padding: 64px 32px 40px;
    z-index: 520;
    overflow-y: auto;
  }

  .smart_menu.is-open { display: flex; }

  .smart_menu .logo {
    position: static;
    width: 100px; margin-bottom: 40px;
  }

  .smart_menu .logo img {
    position: static;
    width: 100%; height: auto;
    filter: brightness(0) invert(1);
    top: auto; left: auto;
  }

  .smart_menu nav ul { list-style: none; margin: 0; padding: 0; }

  .smart_menu nav li {
    border-bottom: 1px solid rgba(255,255,255,.08);
  }

  .smart_menu nav a {
    display: block;
    padding: 20px 0;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-family: var(--ui);
    font-size: 14px;
    letter-spacing: .22em;
    text-transform: uppercase;
  }

  .smart_menu .credit {
    margin-top: auto;
    padding-top: 40px;
    font-size: 9px;
    color: rgba(255,255,255,.2);
    letter-spacing: .15em;
  }

  /* ── OVERLAY ── */
  .sp-menu-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.25);
    backdrop-filter: blur(6px);
    z-index: 490;
    display: none;
  }

  .sp-menu-overlay.is-visible { display: block; }
}
