/* ==========================================================================
   マップレバレッジ ゲームスタジオ LP — studio.css
   デザイントーン: モダンベース + レトロアクセント(B案)
   見出し=DotGothic16(ピクセルフォント) / 本文=Zen Kaku Gothic New
   ========================================================================== */

/* ---------- リセット ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- デザイントークン ---------- */
:root {
  color-scheme: light dark;

  /* ベースカラー: light-dark()でダークモード自動対応 */
  --bg: light-dark(oklch(98% 0.005 260), oklch(18% 0.02 260));
  --bg-raise: light-dark(oklch(100% 0 0), oklch(22% 0.02 260));
  --fg: light-dark(oklch(25% 0.02 260), oklch(92% 0.01 260));
  --fg-muted: color-mix(in oklch, var(--fg) 65%, transparent);

  /* アクセント: 拳札の劇画系に合う朱赤 */
  --accent: oklch(70% 0.19 25);
  --accent-fg: oklch(99% 0.005 25);
  --accent-soft: color-mix(in oklch, var(--accent) 14%, transparent);

  --line: color-mix(in oklch, var(--fg) 15%, transparent);
  --line-strong: color-mix(in oklch, var(--fg) 30%, transparent);

  --shadow: 0 1.5rem 3rem -1.5rem color-mix(in oklch, var(--fg) 40%, transparent);

  --font-heading: "DotGothic16", sans-serif;
  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;

  --radius: 1rem;
  --radius-sm: 0.5rem;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* クロスドキュメントView Transition(local/等への遷移時にフェード) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

/* アニメ可能カスタムプロパティ(ボタンhoverのグラデ角度) */
@property --btn-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* ---------- ベース ---------- */
html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  text-wrap: balance;
}

h1,
h2,
.section-kicker,
.brand {
  font-family: var(--font-heading);
}

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

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 0.15rem solid var(--accent);
  outline-offset: 0.2rem;
  border-radius: var(--radius-sm);
}

/* ---------- 共通レイアウト ---------- */
.section {
  max-width: 64rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
  padding-block: clamp(4rem, 10vh, 7rem);
}

.section-kicker {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-block-end: 0.75rem;
}

/* ---------- サイトヘッダー: sticky+半透明ぼかし ---------- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
  padding-block: 1rem;
  background: color-mix(in oklch, var(--bg) 78%, transparent);
  backdrop-filter: blur(0.75rem) saturate(1.4);
  -webkit-backdrop-filter: blur(0.75rem) saturate(1.4);
  border-block-end: 1px solid var(--line);

  .brand {
    font-size: 1.1rem;
    text-decoration: none;
    letter-spacing: 0.04em;
    white-space: nowrap;

    &:hover {
      color: var(--accent);
    }
  }

  .site-nav {
    display: flex;
    gap: clamp(0.5rem, 3vw, 2rem);
    flex-wrap: wrap;
    justify-content: flex-end;

    a {
      font-size: 0.9rem;
      text-decoration: none;
      color: var(--fg-muted);
      transition: color 0.2s var(--ease);

      &:hover {
        color: var(--accent);
      }
    }
  }
}

/* ---------- ヒーロー ---------- */
.hero {
  position: relative;
  min-height: 90vh;
  min-height: 90svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: clip;
  isolation: isolate;
  background: var(--bg);

  .hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
  }

  .hero-inner {
    position: relative;
    z-index: 1;
    max-width: 42rem;
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 6vw, 2.5rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
  }

  .eyebrow {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    color: var(--accent);
  }

  h1 {
    font-size: clamp(1.75rem, 5vw + 0.5rem, 3rem);
    line-height: 1.4;
  }

  .hero-lead {
    color: var(--fg-muted);
    font-size: clamp(1rem, 1.5vw + 0.6rem, 1.15rem);
    max-width: 34rem;
  }
}

/* ---------- ボタン ---------- */
.button {
  --btn-angle: 0deg;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.4s linear;
  will-change: transform;

  &:hover,
  &:focus-visible {
    transform: translateY(-0.15rem);
  }

  &:active {
    transform: translateY(0);
  }
}

.button.primary {
  background: conic-gradient(from var(--btn-angle), var(--accent), oklch(78% 0.17 45), var(--accent));
  color: var(--accent-fg);
  box-shadow: 0 0.75rem 1.5rem -0.75rem color-mix(in oklch, var(--accent) 70%, transparent);

  &:hover,
  &:focus-visible {
    --btn-angle: 360deg;
    box-shadow: 0 1rem 2rem -0.75rem color-mix(in oklch, var(--accent) 80%, transparent);
  }
}

.button.store {
  background: light-dark(oklch(20% 0.01 260), oklch(96% 0.005 260));
  color: light-dark(oklch(98% 0 0), oklch(15% 0.01 260));

  &:hover,
  &:focus-visible {
    background: light-dark(oklch(30% 0.01 260), oklch(100% 0 0));
  }
}

.button.secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--fg);

  &:hover,
  &:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
  }
}

/* ---------- 作品カード ---------- */
/* container-typeは.work-card自身ではなく親の.worksに置く
   (コンテナクエリはコンテナ自身をスタイルできず子孫にのみ適用されるため) */
.works {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vw, 3rem);
}

.work-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--bg-raise) 92%, var(--bg));
  box-shadow: var(--shadow);
  overflow: clip;
  transition: border-color 0.3s var(--ease);

  &:has(img:hover) {
    border-color: var(--accent);
  }

  .work-shots {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.5rem;
    padding: 0.5rem;
    background: color-mix(in oklch, var(--fg) 4%, transparent);

    img {
      scroll-snap-align: start;
      flex: none;
      height: 320px;
      width: auto;
      border-radius: var(--radius-sm);
      transition: transform 0.3s var(--ease);

      &:hover {
        transform: scale(1.02);
      }
    }
  }

  .work-body {
    padding: clamp(1.5rem, 4vw, 2.25rem);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .work-tagline {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.95rem;
  }

  .work-desc {
    color: var(--fg-muted);
  }

  .work-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-block-start: 0.5rem;
  }

  .button.store {
    margin-block-start: 0.5rem;
    align-self: flex-start;
  }
}

/* Container Query: カード幅700px以上で横並び */
@container (min-width: 700px) {
  .work-card {
    flex-direction: row;
    align-items: stretch;

    .work-shots {
      flex: 0 0 46%;
      overflow-x: auto;
      scroll-snap-type: x mandatory;
    }

    .work-body {
      flex: 1;
      justify-content: center;
    }
  }
}

/* ---------- 次回作ティザー ---------- */
.teaser-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: clip;
  background: color-mix(in oklch, var(--bg-raise) 92%, var(--bg));
  box-shadow: var(--shadow);

  img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  .teaser-body {
    padding: clamp(1.5rem, 4vw, 2.25rem);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
  }

  .teaser-yomi {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--fg-muted);
    margin-inline-start: 0.5rem;
  }

  p:not(.teaser-yomi) {
    color: var(--fg-muted);
  }
}

/* ---------- スタジオについて / 連絡先 ---------- */
.about-text {
  color: var(--fg-muted);
  max-width: 42rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-start: 1.5rem;
}

/* ---------- フッター ---------- */
.site-footer {
  border-block-start: 1px solid var(--line);
  padding: clamp(2rem, 5vw, 3rem) clamp(1.25rem, 5vw, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;

  nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1.5rem;

    a {
      text-decoration: none;
      color: var(--fg-muted);

      &:hover {
        color: var(--accent);
      }
    }
  }

  .footer-note a {
    color: var(--fg-muted);
  }
}

/* ---------- ライトボックス(<dialog>、表示制御はJS側) ---------- */
.lightbox {
  border: none;
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--bg-raise);
  color: var(--fg);
  max-width: min(90vw, 60rem);
  max-height: 90vh;
  box-shadow: var(--shadow);

  &::backdrop {
    background: color-mix(in oklch, oklch(0% 0 0) 70%, transparent);
    backdrop-filter: blur(0.25rem);
  }

  img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    margin-inline: auto;
    border-radius: var(--radius-sm);
  }

  .lightbox-close {
    display: block;
    margin: 1rem auto 0;
    padding: 0.6rem 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--fg);
    font-family: var(--font-body);
    cursor: pointer;

    &:hover,
    &:focus-visible {
      border-color: var(--accent);
      color: var(--accent);
    }
  }
}

/* ---------- スクロール連動出現(フォールバック=常時表示) ---------- */
@supports (animation-timeline: view()) {
  .work-card,
  .teaser-card,
  .about-text {
    animation: rise-in linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
}

/* ---------- レスポンシブ調整 ---------- */
@media (max-width: 30rem) {
  .site-header {
    padding-inline: 1rem;
    gap: 0.5rem;

    .brand {
      font-size: 0.95rem;
    }

    .site-nav {
      gap: 0.5rem 0.85rem;

      a {
        font-size: 0.82rem;
      }
    }
  }
}

/* ---------- reduced-motion(必須・最後に置く) ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
