/*
 * Office Tagmaru TOPページ専用CSS
 * is_front_page() のときだけ読み込まれる（functions.php参照）。
 * すべてのセレクタは .tm- プレフィックス、または .tm-front スコープ下に
 * 限定しており、Cocoon本体・通常のブログ記事レイアウトには影響しません。
 */

:root {
  --tm-bg: #F8FCFF;
  --tm-soft: #EEF8FD;
  --tm-main: #71B7E6;
  --tm-main-hover: #5AA7D9;
  --tm-dark: #24435F;
  --tm-text: #24323D;
  --tm-border: #D9EAF4;
  --tm-white: #FFFFFF;
  --tm-shadow: 0 12px 30px rgba(44, 92, 120, .08);
  --tm-radius: 16px;
  --tm-radius-btn: 999px;
  --tm-max: 1200px;
}

/* ------------------------------------------------------------ */
/* TOPページ本文の余白リセット（Cocoon既定の記事用余白を打ち消す） */
/* ------------------------------------------------------------ */
.tm-front .entry-content {
  margin: 0;
  padding: 0;
  font-size: 16px;
}

.tm-front .entry-content > .wp-block-group {
  margin-top: 0;
  margin-bottom: 0;
}

/* Cocoon側の設定漏れ対策（保険）。TOP以外には一切影響しない */
.tm-front #secondary,
.tm-front .sidebar,
.tm-front .breadcrumb,
.tm-front .article-share,
.tm-front .entry-date,
.tm-front .entry-header .page-title {
  display: none !important;
}

body, html {
  background: var(--tm-bg);
}

/* ------------------------------------------------------------ */
/* 共通パーツ */
/* ------------------------------------------------------------ */
.tm-container {
  width: min(calc(100% - 40px), var(--tm-max));
  margin-inline: auto;
}

.tm-section {
  padding: clamp(64px, 8vw, 112px) 0;
}

.tm-section--soft {
  background: var(--tm-soft);
}

.tm-kicker {
  margin: 0 0 12px;
  color: var(--tm-main);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.tm-section-title {
  margin: 0 0 22px;
  color: var(--tm-dark);
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.35;
}

.tm-lead {
  color: var(--tm-text);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 2;
}

.tm-front a.tm-button,
.tm-front .tm-button-wrap .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 30px;
  border-radius: var(--tm-radius-btn);
  background: var(--tm-main);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 700;
  transition: transform .2s ease, background .2s ease;
}

.tm-front a.tm-button:hover,
.tm-front .tm-button-wrap .wp-block-button__link:hover {
  background: var(--tm-main-hover);
  transform: translateY(-1px);
}

.tm-front a.tm-button:focus-visible,
.tm-front .wp-block-button__link:focus-visible,
.tm-front a:focus-visible {
  outline: 3px solid rgba(36, 67, 95, .35);
  outline-offset: 3px;
}

/* ------------------------------------------------------------ */
/* 画像プレースホルダー（画像が無い/読み込み失敗時にCSSで成立させる） */
/* ------------------------------------------------------------ */
.tm-hero__media,
.tm-card__image,
.tm-work__thumb,
.tm-about__image,
.tm-blog__thumb {
  background: linear-gradient(135deg, var(--tm-soft), var(--tm-white));
  border-radius: var(--tm-radius);
  overflow: hidden;
}

.tm-hero__media,
.tm-card__image,
.tm-work__thumb,
.tm-about__image,
.tm-blog__thumb {
  position: relative;
}

/*
 * WordPressは画像を「置き換え」ると、そのimgタグに新しい画像の実寸に
 * 合わせた width/height/style を書き込み直すことがある。
 * ここでのサイズ指定はそれより必ず優先させる（!important）ことで、
 * 何度差し替えても角丸ボックスからはみ出さないようにする。
 */
.tm-hero__media img,
.tm-card__image img,
.tm-work__thumb img,
.tm-about__image img,
.tm-blog__thumb img {
  display: block !important;
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  object-fit: cover !important;
}

.tm-img-broken img {
  display: none;
}

/* ------------------------------------------------------------ */
/* HERO */
/* ------------------------------------------------------------ */
.tm-hero {
  background: linear-gradient(90deg, rgba(248, 252, 255, .98) 0%, rgba(248, 252, 255, .93) 42%, rgba(238, 248, 253, .7) 100%);
  padding: clamp(56px, 8vw, 104px) 0;
}

.tm-hero__grid {
  width: min(calc(100% - 40px), var(--tm-max));
  margin-inline: auto;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(36px, 6vw, 84px);
  align-items: center;
}

.tm-hero__title {
  margin: 0 0 22px;
  color: var(--tm-dark);
  font-size: clamp(36px, 5.2vw, 68px);
  line-height: 1.32;
  letter-spacing: -.025em;
}

.tm-hero__media {
  aspect-ratio: 4 / 3;
  box-shadow: var(--tm-shadow);
}

/* ------------------------------------------------------------ */
/* ISSUES */
/* ------------------------------------------------------------ */
.tm-issues__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 36px 0;
}

.tm-issue {
  margin: 0;
  padding: 24px 18px;
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius);
  background: var(--tm-white);
  text-align: center;
  font-size: 15px;
  line-height: 1.7;
}

.tm-issues__lead {
  text-align: center;
}

/* ------------------------------------------------------------ */
/* SERVICES */
/* ------------------------------------------------------------ */
.tm-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.tm-card {
  overflow: hidden;
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius);
  background: var(--tm-white);
  box-shadow: var(--tm-shadow);
}

.tm-card__image {
  aspect-ratio: 16 / 9;
  border-radius: 0;
}

.tm-card__body {
  padding: 24px;
}

.tm-card__title {
  margin: 0 0 12px;
  color: var(--tm-dark);
  font-size: 22px;
}

/* ------------------------------------------------------------ */
/* WORKS */
/* ------------------------------------------------------------ */
.tm-works-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.tm-work {
  border-radius: var(--tm-radius);
  overflow: hidden;
  background: var(--tm-white);
  border: 1px solid var(--tm-border);
}

.tm-work__thumb {
  aspect-ratio: 4 / 3;
  border-radius: 0;
}

.tm-work__body {
  padding: 18px;
}

.tm-work__body h3 {
  margin: 0;
  font-size: 17px;
  color: var(--tm-dark);
}

.tm-label {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: var(--tm-radius-btn);
  background: var(--tm-soft);
  color: var(--tm-dark);
  font-size: 12px;
}

/* ------------------------------------------------------------ */
/* ABOUT */
/* ------------------------------------------------------------ */
.tm-about__grid {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: clamp(32px, 6vw, 76px);
  align-items: center;
}

.tm-about__image {
  aspect-ratio: 4 / 5;
}

/* ------------------------------------------------------------ */
/* BLOG */
/* ------------------------------------------------------------ */
.tm-blog__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  list-style: none;
  margin: 36px 0;
  padding: 0;
}

.tm-blog__grid > li {
  overflow: hidden;
  border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius);
  background: var(--tm-white);
  box-shadow: var(--tm-shadow);
}

.tm-blog__thumb {
  aspect-ratio: 16 / 9;
  border-radius: 0;
  margin: 0;
}

.tm-blog__title,
.tm-blog__date,
.tm-blog__excerpt {
  padding-inline: 20px;
}

.tm-blog__title {
  margin: 16px 0 8px;
  font-size: 18px;
}

.tm-blog__title a {
  color: var(--tm-dark);
  text-decoration: none;
}

.tm-blog__date {
  display: block;
  margin: 0 0 8px;
  color: var(--tm-main);
  font-size: 13px;
}

.tm-blog__excerpt {
  margin: 0 0 20px;
  color: var(--tm-text);
  font-size: 14px;
  line-height: 1.8;
}

/* ------------------------------------------------------------ */
/* CTA */
/* ------------------------------------------------------------ */
.tm-cta {
  padding: clamp(64px, 8vw, 100px) 0;
  background-color: var(--tm-soft);
  background-image:
    linear-gradient(135deg, rgba(238, 248, 253, .92), rgba(248, 252, 255, .96)),
    url("../images/cta-kumamoto.webp");
  background-size: cover;
  background-position: center;
  text-align: center;
}

.tm-cta__inner {
  width: min(calc(100% - 40px), 860px);
  margin-inline: auto;
}

/* ------------------------------------------------------------ */
/* Responsive */
/* ------------------------------------------------------------ */
@media (max-width: 1200px) {
  .tm-works-grid,
  .tm-blog__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 960px) {
  .tm-hero__grid,
  .tm-about__grid {
    grid-template-columns: 1fr;
  }

  .tm-issues__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tm-card-grid {
    grid-template-columns: 1fr;
  }

  .tm-works-grid,
  .tm-blog__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .tm-container,
  .tm-hero__grid,
  .tm-cta__inner {
    width: min(calc(100% - 32px), var(--tm-max));
  }

  .tm-section {
    padding: 56px 0;
  }

  .tm-issues__grid,
  .tm-works-grid,
  .tm-blog__grid {
    grid-template-columns: 1fr;
  }

  .tm-hero__title {
    font-size: clamp(34px, 11vw, 46px);
  }

  .tm-front a.tm-button,
  .tm-front .tm-button-wrap .wp-block-button__link {
    width: 100%;
    max-width: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tm-front *,
  .tm-front *::before,
  .tm-front *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
