/* =================================================================
   1. Variables & Global Styles
================================================================= */

:root {
  /* Fonts */
  --ff-serif-jp: 'Noto Serif JP', serif;
  --ff-serif-en: 'Crimson Pro', serif;

  /* ▼▼▼ ボタン用のフォント変数（順序を最小修正） ▼▼▼ */
  --font-action: 'Noto Sans JP', 'Inter', sans-serif;

  /* Colors */
  --brand-navy: #262e6b;
  --color-text: #333;
  --color-text-light: #6b7280;
  --color-heading: #111827;
  --color-bg: #f9f9f9;
  --color-bg-alt: #f3f3f7;
  --color-white: #ffffff;
  --color-border: #e5e7eb;

  /* Others */
  /* --header-h はJSによって動的に設定されます */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth; /* JSと競合しないよう、基本的なスムーススクロールをCSSで定義 */
}

body {
  margin: 0;
  font-family: var(--ff-serif-jp);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.7;
  background: var(--color-bg);
  color: var(--color-text);
}

main {
  padding-top: var(--header-h, 90px); /* JSが読み込まれるまでのフォールバック値を指定 */
}

/* =================================================================
   2. Layout & Typography Utilities
================================================================= */

.container {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.en {
  font-family: var(--ff-serif-en);
  font-size: 1.1em;
  letter-spacing: 0.02em;
}

/* =================================================================
   3. Component: Header
================================================================= */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  padding: 1rem 0;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  transition: padding 0.33s ease, background-color 0.33s ease, box-shadow 0.33s ease, backdrop-filter 0.33s ease;
  will-change: padding, background-color, box-shadow;
}

.site-header.is-scrolled {
  padding: 0.5rem 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(120%) blur(6px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.site-header.is-measuring,
.site-header.is-measuring .logo img {
  transition: none !important;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo img {
  display: block;
  height: 58px;
  width: auto;
  transition: height 0.33s ease;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--color-heading);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}
.nav-links a:hover {
  color: var(--color-text-light);
}

.menu-toggle {
  display: none; /* PCでは非表示 */
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  width: 44px;
  height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 4.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.menu-toggle:focus-visible {
  outline: 2px solid var(--brand-navy);
  outline-offset: 2px;
  border-radius: 4px;
}
.menu-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--brand-navy);
  border-radius: 1px;
  margin: 0 auto;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.menu-toggle.open .bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-toggle.open .bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Header: Mobile Styles */
@media (max-width: 767px) {
  .menu-toggle {
    display: flex;
    margin-left: auto;
  }

  /* ▼▼▼ スクロール時の重なりを防ぐため position を fixed に最小修正 ▼▼▼ */
  .nav-links {
    position: fixed;
    z-index: 1100;
    top: var(--header-h, 73px); /* JSが読み込まれるまでのフォールバック値 */
    left: 1rem;
    right: 1rem;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
  }
  .nav-links.active {
    max-height: 500px;
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header: Desktop Styles */
@media (min-width: 768px) {
  .logo img {
    height: 70px;
  }
  .site-header.is-scrolled .logo img {
    height: 58px;
  }
}

/* =================================================================
   4. Component: Hero
================================================================= */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-white);
  background: url('../assets/hero.jpg') center center/cover no-repeat;
  min-height: clamp(450px, 85svh, 850px);
  padding-block: 64px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.3);
}

.hero-content {
  position: relative;
  max-width: 800px;
  padding: 0 1rem;
}

.hero-content h1 {
  font-family: var(--ff-serif-en), var(--ff-serif-jp);
  font-size: clamp(2.5rem, 5vw, 3.2rem);
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 1rem;
}

.hero-content p {
  font-size: 1.1rem;
  line-height: 1.5;
  margin: 0;
}

/* Hero: Mobile Portrait */
@media (max-width: 767px) and (orientation: portrait){
  .hero {
    min-height: clamp(400px, 66svh, 640px);
    padding-block: 48px;
  }
}

/* =================================================================
   5. Component: Section
================================================================= */

.section {
  padding: clamp(42px, 6.2vw, 86px) 0;
  border-bottom: 1px solid #eef1f4;
}
.section:last-of-type {
  border-bottom: 0;
}
.section--alt {
  background: var(--color-bg-alt);
}

.section .container {
  display: flex;
  flex-direction: column; /* Mobile-first: default to vertical stacking */
  align-items: center;
  gap: 2rem;  
}

.section__title {
  font-family: var(--ff-serif-en), var(--ff-serif-jp);
  font-size: clamp(1.7rem, 2.2vw, 2.15rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-heading);
  text-align: center;
  margin: 0 0 1rem;
}

.section__lead {
  font-size: clamp(1rem, 1.25vw, 1.1rem);
  color: var(--color-text);
  max-width: 75ch;
  text-align: left;
  margin: 0;
}

/* Section: Desktop Layout */
@media (min-width: 768px) {
  .section .container {
    flex-direction: row; /* Switch to horizontal layout */
    flex-wrap: wrap;
    justify-content: center; /* Center flex items */
    gap: 1.2rem 3.5rem;
  }
  .section__title,
  .section__lead {
    flex-basis: 100%; /* Make title/lead take full width */
    margin-bottom: 2rem;
  }
}

/* =================================================================
   6. Component: Cards
================================================================= */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
}

.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
  transform: translateY(-3px);
}

.card__image-wrapper {
  width: 100%;
  aspect-ratio: 20 / 19;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.card__image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__title {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  color: var(--color-heading);
}
.card__title .en {
  font-weight: 500;
}

.card__text {
  margin: 0;
  color: var(--color-text-light);
  font-size: 0.95rem;
}

/* Cards: Desktop Layout */
@media (min-width: 768px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}
@media (min-width: 1024px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =================================================================
   7. Component: Media Block (Image+Text)
================================================================= */

.media-block__figure {
  margin: 0;
  text-align: center;
}

.media-block__image-wrapper {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin-left: auto;
  margin-right: auto;
}

.media-block__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%; /* 顔の位置を微調整 */
}

.media-block__caption {
  margin-top: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text);
}
.media-block__caption small {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-text-light);
}

.media-block__content {
  text-align: left;
  max-width: 75ch; /* ← この一行を追加 */
}
.media-block__content .section__title{  
  text-align: center;
  margin-bottom: 1.5rem;
}
.media-block__content .section__lead {
  text-align: left;
  margin: 0;
}

/* Media Block: Mobile Layout */
@media (max-width: 767px) {
  .media-block__figure {
    margin-bottom: 2rem;
  }
  .media-block__image-wrapper {
    width: 140px;
    height: 140px;
  }
  /* aboutセクションのモバイル表示順を反転させる */
  #about .media-block__content {
    order: -1;
  }
}

/* =================================================================
   8. Component: Contact & Footer
================================================================= */

.section--contact {
  background: var(--color-bg-alt);
  padding: 64px 0;
}

.contact-form {
  width: 80%; /* ← 親コンテナの80%の幅にする */
  max-width: 600px;
  margin-top: 1rem;
}
.contact-form__group { display:flex; flex-direction:column; gap:8px; margin-bottom:16px; }
.contact-form__label { font-weight:600; }
.contact-form__input,
.contact-form__textarea {
  width:100%;
  padding:1rem;
  border:1px solid #e5e7eb;
  border-radius:12px;
  font-size:16px; background:#fff;
  outline:none; border-color:#9ca3af; box-shadow:0 0 0 3px rgba(0,0,0,.05);
}
.contact-form__button {
  display:inline-block;
  padding:12px 20px;
  border-radius:12px;
  border:1px solid #111;
  background:#111;
  color:#fff;
  font-family: var(--font-action);
  font-weight:700;
}
.contact-form__button:hover { opacity:.9; }

.form-status { margin-top:10px; min-height:1.5em; }

/* お問い合わせセクションを常に縦積みにする */
#contact .container {
  flex-direction: column;
}

.site-footer {
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.site-footer__grid {
  display: grid;
  padding: 3rem 0;

  /* --- モバイルの基本スタイル (1列) --- */
  grid-template-columns: 1fr;
  gap: 2.5rem;
  text-align: center;
}

.site-footer__brand .logo-img {
  height: 125px;
  display: block;
  margin: 0 auto 0.5rem;
}

.site-footer__nav h3,
.site-footer__info h3 {
  font-size: .95rem;
  font-weight: 500;
  margin: 0 0 .8rem;
  color: var(--color-heading);
}

.site-footer__nav ul,
.site-footer__info ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer__nav a {
  text-decoration: none;
  color: var(--color-text);
  transition: color 0.2s ease;
}
.site-footer__nav a:hover {
  color: var(--brand-navy);
}

.site-footer__copy {
  border-top: 1px solid var(--color-border);
  text-align: center;
  padding: 1rem 0;
  color: var(--color-text-light);
  font-size: 0.75rem;
}

/* --- PC・タブレットのスタイル (3列) --- */
@media (min-width: 768px) {
  .site-footer__grid {
    grid-template-columns: .6fr 1fr 1fr;
    gap: 2rem 3rem;
    text-align: left;
  }
  .site-footer__brand .logo-img {
    margin: 0 0 0.5rem;
  }
}
