/* ============================================================
   components.css
   ボタン3種類 + カード + テーブル + タグ + アイコン
   ============================================================ */

@layer components {

  /* ============================================================
     ボタン
     ============================================================ */

  /* 共通ベース */
  a.c-btn,
  button.c-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.7em;
    padding: 1em 1.75em;
    font-family: var(--ff-sans);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    letter-spacing: 0.1em;
    line-height: 1;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
    white-space: nowrap;
  }

  /* Primary: メインCTA */
  a.c-btn--primary,
  button.c-btn--primary {
    background: var(--c-action-primary);
    color: var(--c-action-on);
    border-color: var(--c-action-primary);
  }
  a.c-btn--primary:hover,
  button.c-btn--primary:hover {
    background: var(--c-action-primary-hover);
    border-color: var(--c-action-primary-hover);
    opacity: 1;
  }

  /* Secondary: 副次アクション */
  a.c-btn--secondary,
  button.c-btn--secondary {
    background: transparent;
    color: var(--c-text);
    border-color: var(--c-text);
  }
  a.c-btn--secondary:hover {
    background: var(--c-text);
    color: var(--c-action-on);
    opacity: 1;
  }

  /* Text: カード内・リスト内のリンクボタン */
  a.c-btn--text {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--c-text);
    font-size: var(--fs-small);
    letter-spacing: 0.05em;
  }
  a.c-btn--text:hover {
    color: var(--c-accent);
    opacity: 1;
  }

  /* 反転(濃い背景の上) */
  a.c-btn--invert {
    background: var(--c-bg);
    color: var(--c-text);
    border-color: var(--c-bg);
  }
  a.c-btn--invert:hover {
    background: transparent;
    color: var(--c-bg);
    border-color: var(--c-bg);
    opacity: 1;
  }

  /* 幅いっぱい */
  .c-btn--wide {
    width: 100%;
    justify-content: center;
  }

  /* 矢印付き */
  .c-btn--arrow::after {
    content: "";
    display: inline-block;
    width: 1.1em;
    height: 1.1em;
    background-color: currentColor;
    mask-image: var(--icon-arrow-right);
    -webkit-mask-image: var(--icon-arrow-right);
    mask-size: contain;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    transition: transform var(--dur) var(--ease);
  }
  .c-btn--arrow:hover::after {
    transform: translateX(4px);
  }

  /* ============================================================
     Card
     ============================================================ */

  .c-card {
    display: flex;
    flex-direction: column;
    background: var(--c-bg);
    transition: all var(--dur) var(--ease);
  }
  a.c-card {
    color: inherit;
    text-decoration: none;
  }
  a.c-card:hover {
    opacity: 1;
    transform: translateY(-2px);
  }

  /* バリエーション:罫線で枠 */
  .c-card--bordered {
    border: 1px solid var(--c-line);
    padding: var(--sp-5);
  }
  a.c-card--bordered:hover {
    border-color: var(--c-accent);
  }

  /* バリエーション:上罫線のみ */
  .c-card--top-line {
    border-top: 1px solid var(--c-line);
    padding-top: var(--sp-5);
  }

  .c-card__thumb {
    aspect-ratio: 16 / 10;
    background: var(--c-bg-alt);
    overflow: hidden;
    margin-bottom: var(--sp-4);
  }
  .c-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .c-card__title {
    font-family: var(--ff-sans);
    font-size: var(--fs-h4);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-heading);
    margin: 0;
    padding-left: 0;
    border-left: 0;
  }
  .c-card__desc {
    font-size: var(--fs-small);
    color: var(--c-text-muted);
    line-height: 1.8;
    margin-top: var(--sp-2);
  }
  .c-card__meta {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-2);
  }

  /* ============================================================
     Tag(カテゴリラベル)
     ============================================================ */
  .c-tag {
    display: inline-block;
    font-family: var(--ff-sans);
    font-size: var(--fs-eyebrow);
    font-weight: var(--fw-medium);
    letter-spacing: 0.15em;
    color: var(--c-accent);
    text-transform: uppercase;
  }
  .c-tag--filled {
    background: var(--c-accent);
    color: var(--c-action-on);
    padding: 0.3em 0.8em;
  }
  .c-tag--outlined {
    border: 1px solid var(--c-line);
    color: var(--c-text-muted);
    padding: 0.3em 0.8em;
  }

  /* ============================================================
     Table
     ============================================================ */
  .c-table {
    width: 100%;
    font-size: var(--fs-small);
  }
  .c-table th,
  .c-table td {
    padding: var(--sp-4) var(--sp-3);
    border-bottom: 1px solid var(--c-line);
    text-align: left;
    vertical-align: top;
  }
  .c-table th {
    width: 200px;
    font-weight: var(--fw-medium);
    color: var(--c-text-muted);
    background: var(--c-bg-alt);
  }
  @media (max-width: 768px) {
    .c-table th { width: 35%; font-size: var(--fs-caption); }
  }

  /* ============================================================
     Timeline
     ============================================================ */
  .c-timeline {
    border-left: 1px solid var(--c-line);
    padding-left: var(--sp-6);
  }
  .c-timeline__item {
    position: relative;
    padding-bottom: var(--sp-6);
  }
  .c-timeline__item:last-child {
    padding-bottom: 0;
  }
  .c-timeline__item::before {
    content: "";
    position: absolute;
    left: calc(-1 * var(--sp-6) - 5px);
    top: 0.4em;
    width: 9px;
    height: 9px;
    background: var(--c-bg);
    border: 1px solid var(--c-accent);
    border-radius: 50%;
  }
  .c-timeline__year {
    font-family: var(--ff-sans);
    font-size: var(--fs-caption);
    font-weight: var(--fw-medium);
    letter-spacing: 0.2em;
    color: var(--c-accent);
    margin-bottom: var(--sp-2);
  }
  .c-timeline__body {
    font-size: var(--fs-body);
    line-height: var(--lh-body);
  }

  /* ============================================================
     FAQ
     ============================================================ */
  .c-faq {
    display: flex;
    flex-direction: column;
  }
  .c-faq__item {
    border-bottom: 1px solid var(--c-line);
    padding: var(--sp-5) 0;
  }
  .c-faq__item:first-child {
    border-top: 1px solid var(--c-line);
  }
  .c-faq__q {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    font-size: var(--fs-body);
    font-weight: var(--fw-semibold);
    color: var(--c-text);
    margin-bottom: var(--sp-3);
  }
  .c-faq__q::before {
    content: "Q.";
    color: var(--c-accent);
    font-family: var(--ff-sans);
    font-weight: var(--fw-medium);
  }
  .c-faq__a {
    display: flex;
    align-items: baseline;
    gap: 0.6em;
    font-size: var(--fs-small);
    color: var(--c-text-muted);
    line-height: var(--lh-body);
  }
  .c-faq__a::before {
    content: "A.";
    color: var(--c-text-subtle);
    font-family: var(--ff-sans);
    font-weight: var(--fw-medium);
    flex-shrink: 0;
  }

  /* ============================================================
     Breadcrumb
     ============================================================ */
  .c-breadcrumb {
    font-size: var(--fs-caption);
    color: var(--c-text-muted);
    padding: var(--sp-4) 0;
  }
  .c-breadcrumb a {
    color: var(--c-text-muted);
    text-decoration: none;
  }
  .c-breadcrumb a:hover { color: var(--c-accent); }
  .c-breadcrumb__sep {
    margin: 0 0.6em;
    color: var(--c-text-subtle);
  }

  /* ============================================================
     Page header
     ============================================================ */
  .c-page-header {
    padding-block: var(--sp-8) var(--sp-6);
  }
  .c-page-header .t-eyebrow {
    margin-bottom: var(--sp-4);
  }
  .c-page-header__title {
    font-family: var(--ff-display);
    font-size: var(--fs-h1);
    font-weight: var(--fw-medium);
    line-height: var(--lh-heading);
    letter-spacing: var(--tr-heading);
    margin: 0 0 var(--sp-5);
    padding-left: 0;
  }
  .c-page-header__title::before { display: none; }
  .c-page-header__lead {
    font-size: var(--fs-lead);
    line-height: var(--lh-loose);
    color: var(--c-text-muted);
    max-width: 60ch;
  }

  /* ============================================================
     CTA block
     ============================================================ */
  .c-cta {
    position: relative;
    padding: clamp(5rem, 12vw, 9rem) var(--container-pad);
    text-align: center;
    background: var(--c-bg-dark);
    color: var(--c-text-on-dark);
    overflow: hidden;
  }
  .c-cta__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
  }
  .c-cta__bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
  .c-cta__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
  }
  .c-cta > *:not(.c-cta__bg) {
    position: relative;
    z-index: 1;
  }
  .c-cta__title {
    font-family: var(--ff-display);
    font-size: clamp(1.5rem, 2vw + 1rem, 2.25rem);
    font-weight: var(--fw-medium);
    line-height: var(--lh-heading);
    letter-spacing: var(--tr-heading);
    color: var(--c-text-on-dark);
    margin: 0 0 var(--sp-4);
    padding-left: 0;
  }
  .c-cta__title::before { display: none; }
  .c-cta__sub {
    font-size: var(--fs-small);
    color: var(--c-text-on-dark-muted);
    line-height: var(--lh-body);
    margin: 0 auto var(--sp-6);
    max-width: 50ch;
  }
  /* CTAボタンはオレンジ(暗背景上でもブランド色を主役に) */
  .c-cta .c-btn--invert {
    background: var(--c-action-primary);
    border-color: var(--c-action-primary);
    color: #fff;
  }
  .c-cta .c-btn--invert:hover {
    background: var(--c-action-primary-hover);
    border-color: var(--c-action-primary-hover);
    color: #fff;
  }

  /* ============================================================
     Icon
     ============================================================ */
  .c-icon {
    width: var(--icon-md);
    height: var(--icon-md);
    stroke: currentColor;
    fill: none;
    stroke-width: var(--icon-stroke);
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    vertical-align: middle;
  }
  .c-icon--sm { width: var(--icon-sm); height: var(--icon-sm); }
  .c-icon--lg { width: var(--icon-lg); height: var(--icon-lg); }
  .c-icon--xl { width: var(--icon-xl); height: var(--icon-xl); }

  /* ============================================================
     ヘッダーCTA: SPではハンバーガー内に集約するため非表示
     (components レイヤーで定義し、レイヤー順による打ち消しを回避)
     ============================================================ */
  @media (max-width: 768px) {
    .l-header__cta.c-btn { display: none; }
  }

  /* ============================================================
     プレースホルダー(ワイヤー段階用、本番では非使用)
     ============================================================ */
  .c-placeholder {
    background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 8px, #ebebeb 8px, #ebebeb 16px);
    border: 1px solid var(--c-line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-subtle);
    font-size: var(--fs-caption);
    text-align: center;
    padding: var(--sp-4);
    min-height: 120px;
  }
  .c-placeholder--16-9 { aspect-ratio: 16 / 9; }
  .c-placeholder--4-3  { aspect-ratio: 4 / 3; }
  .c-placeholder--1-1  { aspect-ratio: 1 / 1; }
}

@layer components {
  /* ページの先頭へ戻るボタン（全ページ共通・include.jsで生成） */
  .c-pagetop {
    position: fixed;
    right: var(--sp-4);
    bottom: var(--sp-4);
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-bg);
    border: 1px solid var(--c-line);
    color: var(--c-text-muted);
    font-family: var(--ff-num);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
    z-index: 40;
  }
  .c-pagetop.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .c-pagetop:hover {
    color: var(--c-accent);
    border-color: var(--c-accent);
  }
}

@layer components {
  .c-card { padding-bottom: var(--sp-4); }
}
