/* ==========================================================================
   Base Styles - Reset & Foundation
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + var(--topbar-height) + 20px);
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-gray-800);
  background-color: var(--color-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-navy);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  margin-bottom: var(--space-4);
  line-height: var(--line-height-relaxed);
}

a {
  color: var(--color-navy);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-gold);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Selection --- */
::selection {
  background-color: var(--color-gold);
  color: var(--color-white);
}

/* --- Focus visible --- */
:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(196, 162, 101, 0.4);
}

/* 紺背景セクションでは明るいゴールドで視認性を確保 */
.section--navy :focus-visible,
.footer :focus-visible,
.cta-section :focus-visible,
.topbar :focus-visible,
.mobile-menu :focus-visible {
  outline-color: var(--color-gold-light);
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: var(--z-modal);
  background: var(--color-navy);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* スキップリンクから #main（tabindex="-1"）へのプログラムフォーカス時は
   アウトラインを表示しない（キーボード操作の妨げにならない） */
#main:focus {
  outline: none;
  box-shadow: none;
}

/* --- Touch device improvements --- */
@media (hover: none) and (pointer: coarse) {
  /* タッチデバイスでタップハイライトを制御 */
  a, button {
    -webkit-tap-highlight-color: rgba(196, 162, 101, 0.2);
  }

  /* ホバーエフェクトの無効化（タッチデバイスで残像を防ぐ） */
  .card:hover {
    transform: none;
  }

  .service-card:hover {
    transform: none;
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fade-in {
    opacity: 1;
    transform: none;
  }
}

/* --- Screen reader only --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
