/*
Theme Name: F-Mignon AI Consultation
Theme URI: https://f-mignon.jp/
Author: F-Mignon
Author URI: https://f-mignon.net/
Description: A lightweight original WordPress theme for AI consultation, practical AI articles, and downloadable beginner resources.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
Text Domain: fm-ai
*/

:root {
  --fm-bg: #fbfaf7;
  --fm-surface: #ffffff;
  --fm-surface-soft: #f1f6f3;
  --fm-ink: #1d2522;
  --fm-muted: #5f6f68;
  --fm-line: #dbe5df;
  --fm-primary: #0f766e;
  --fm-primary-dark: #12312b;
  --fm-accent: #d15d4f;
  --fm-gold: #b7832f;
  --fm-shadow: 0 18px 48px rgba(18, 49, 43, 0.12);
  --fm-radius: 8px;
  --fm-content: min(1120px, calc(100vw - 32px));
  --fm-narrow: min(760px, calc(100vw - 32px));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--fm-bg);
  color: var(--fm-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
}

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

a {
  color: var(--fm-primary);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--fm-accent);
}

.screen-reader-text,
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

.skip-link:focus {
  top: 10px;
  left: 10px;
  z-index: 1000;
  width: auto;
  height: auto;
  padding: 10px 14px;
  clip: auto;
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
}

.fm-site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, 0.94);
  border-bottom: 1px solid var(--fm-line);
  backdrop-filter: blur(16px);
}

.fm-header-inner {
  display: flex;
  width: var(--fm-content);
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.fm-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--fm-ink);
  font-weight: 700;
  text-decoration: none;
}

.fm-brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--fm-primary-dark);
  color: #ffffff;
  font-size: 18px;
  letter-spacing: 0;
}

.fm-brand-logo {
  width: auto;
  max-width: 180px;
  max-height: 44px;
}

.fm-brand-text {
  display: grid;
  gap: 0;
}

.fm-site-title {
  font-size: 16px;
  line-height: 1.25;
}

.fm-site-description {
  color: var(--fm-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.fm-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--fm-line);
  border-radius: 8px;
  background: var(--fm-surface);
  color: var(--fm-ink);
  cursor: pointer;
}

.fm-menu-icon,
.fm-menu-icon::before,
.fm-menu-icon::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  content: "";
}

.fm-menu-icon {
  position: relative;
}

.fm-menu-icon::before,
.fm-menu-icon::after {
  position: absolute;
  left: 0;
}

.fm-menu-icon::before {
  top: -6px;
}

.fm-menu-icon::after {
  top: 6px;
}

.fm-primary-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.fm-primary-nav ul {
  display: flex;
  margin: 0;
  padding: 0;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.fm-primary-nav a {
  display: inline-flex;
  min-height: 40px;
  padding: 8px 12px;
  align-items: center;
  border-radius: 8px;
  color: var(--fm-ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.fm-primary-nav a:hover,
.fm-primary-nav .current-menu-item > a,
.fm-primary-nav .current_page_item > a {
  background: var(--fm-surface-soft);
  color: var(--fm-primary-dark);
}

.fm-header-cta,
.fm-button,
.wp-block-button__link {
  display: inline-flex;
  min-height: 44px;
  padding: 10px 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--fm-primary);
  color: #ffffff;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.fm-header-cta:hover,
.fm-button:hover,
.wp-block-button__link:hover {
  background: var(--fm-primary-dark);
  color: #ffffff;
}

.fm-button-secondary,
.is-style-outline > .wp-block-button__link {
  border-color: var(--fm-line);
  background: var(--fm-surface);
  color: var(--fm-primary-dark);
}

.fm-button-secondary:hover,
.is-style-outline > .wp-block-button__link:hover {
  border-color: var(--fm-primary);
  background: var(--fm-surface-soft);
  color: var(--fm-primary-dark);
}

.fm-main {
  min-height: 68vh;
}

.fm-section {
  width: var(--fm-content);
  margin: 0 auto;
  padding: 56px 0;
}

.fm-section-tight {
  padding: 36px 0;
}

.fm-page-header {
  width: var(--fm-content);
  margin: 0 auto;
  padding: 64px 0 24px;
}

.fm-page-kicker,
.fm-kicker {
  margin: 0 0 10px;
  color: var(--fm-primary);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fm-page-title,
.fm-section-title,
.fm-entry-title {
  margin: 0;
  color: var(--fm-primary-dark);
  font-weight: 800;
  line-height: 1.18;
}

.fm-page-title {
  max-width: 820px;
  font-size: clamp(34px, 6vw, 64px);
}

.fm-section-title {
  font-size: clamp(28px, 4vw, 42px);
}

.fm-section-lead,
.fm-page-lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--fm-muted);
  font-size: 18px;
}

.fm-front-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--fm-line);
  background: var(--fm-primary-dark);
  color: #ffffff;
}

.fm-front-hero::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(18, 49, 43, 0.94) 0%, rgba(18, 49, 43, 0.78) 44%, rgba(18, 49, 43, 0.18) 100%);
  content: "";
}

.fm-front-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fm-front-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  width: var(--fm-content);
  min-height: 520px;
  margin: 0 auto;
  padding: 76px 0 88px;
  align-content: center;
}

.fm-front-hero-content {
  max-width: 720px;
}

.fm-front-hero h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  font-weight: 850;
  line-height: 1.16;
}

.fm-front-hero .entry-content {
  margin-top: 22px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
}

.fm-front-hero .entry-content a {
  color: #ffffff;
}

.fm-content {
  width: var(--fm-content);
  margin: 0 auto;
}

.fm-content-narrow {
  width: var(--fm-narrow);
  margin: 0 auto;
}

.entry-content > * {
  margin-top: 0;
  margin-bottom: 1.4em;
}

.entry-content > :last-child {
  margin-bottom: 0;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  color: var(--fm-primary-dark);
  line-height: 1.28;
}

.entry-content h2 {
  margin-top: 2.4em;
  font-size: clamp(26px, 3vw, 36px);
}

.entry-content h3 {
  margin-top: 2em;
  font-size: 23px;
}

.entry-content p,
.entry-content li {
  color: var(--fm-ink);
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  background: var(--fm-surface);
  border: 1px solid var(--fm-line);
}

.entry-content th,
.entry-content td {
  padding: 12px;
  border: 1px solid var(--fm-line);
  text-align: left;
  vertical-align: top;
}

.entry-content th {
  background: var(--fm-surface-soft);
  color: var(--fm-primary-dark);
}

.fm-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 28px;
}

.fm-card {
  overflow: hidden;
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-radius);
  background: var(--fm-surface);
  box-shadow: 0 8px 24px rgba(18, 49, 43, 0.06);
}

.fm-card-image {
  aspect-ratio: 16 / 9;
  background: var(--fm-surface-soft);
}

.fm-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fm-card-body {
  padding: 20px;
}

.fm-card-meta {
  display: flex;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--fm-muted);
  font-size: 13px;
}

.fm-card-title {
  margin: 0;
  color: var(--fm-primary-dark);
  font-size: 20px;
  line-height: 1.35;
}

.fm-card-title a {
  color: inherit;
  text-decoration: none;
}

.fm-card-title a:hover {
  color: var(--fm-primary);
}

.fm-card-excerpt {
  margin: 10px 0 0;
  color: var(--fm-muted);
}

.fm-card-link {
  display: inline-flex;
  margin-top: 16px;
  color: var(--fm-primary);
  font-weight: 800;
  text-decoration: none;
}

.fm-downloads {
  background: var(--fm-surface-soft);
  border-top: 1px solid var(--fm-line);
  border-bottom: 1px solid var(--fm-line);
}

.fm-download-card {
  border-left: 4px solid var(--fm-accent);
}

.fm-empty-state {
  margin-top: 24px;
  padding: 24px;
  border: 1px dashed var(--fm-line);
  border-radius: var(--fm-radius);
  background: var(--fm-surface);
  color: var(--fm-muted);
}

.fm-post-layout {
  display: grid;
  width: var(--fm-content);
  margin: 0 auto;
  padding: 52px 0 72px;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
}

.fm-entry {
  min-width: 0;
}

.fm-entry-header {
  margin-bottom: 28px;
}

.fm-entry-title {
  font-size: clamp(32px, 5vw, 52px);
}

.fm-entry-meta {
  display: flex;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--fm-muted);
  font-size: 14px;
}

.fm-featured {
  overflow: hidden;
  margin: 28px 0;
  border-radius: var(--fm-radius);
}

.fm-featured img {
  width: 100%;
}

.fm-sidebar {
  align-self: start;
  position: sticky;
  top: 96px;
  padding: 22px;
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-radius);
  background: var(--fm-surface);
}

.fm-sidebar h2,
.fm-sidebar h3 {
  margin-top: 0;
  color: var(--fm-primary-dark);
  font-size: 18px;
}

.fm-sidebar ul {
  margin: 0;
  padding-left: 1.2em;
}

.fm-pagination,
.nav-links {
  display: flex;
  width: var(--fm-content);
  margin: 24px auto 72px;
  justify-content: center;
  gap: 8px;
}

.page-numbers,
.nav-links a,
.nav-links span {
  display: inline-flex;
  min-width: 42px;
  min-height: 42px;
  padding: 8px 12px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--fm-line);
  border-radius: 8px;
  background: var(--fm-surface);
  color: var(--fm-ink);
  text-decoration: none;
}

.page-numbers.current,
.nav-links .current {
  background: var(--fm-primary-dark);
  color: #ffffff;
}

.fm-site-footer {
  border-top: 1px solid var(--fm-line);
  background: var(--fm-primary-dark);
  color: rgba(255, 255, 255, 0.78);
}

.fm-footer-inner {
  display: grid;
  width: var(--fm-content);
  margin: 0 auto;
  padding: 42px 0;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
}

.fm-site-footer a {
  color: #ffffff;
}

.fm-footer-title {
  margin: 0 0 8px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
}

.fm-footer-nav ul {
  display: flex;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
}

.fm-copyright {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.wp-block-columns {
  gap: 22px;
}

.wp-block-group.is-style-fm-panel,
.fm-panel {
  padding: 24px;
  border: 1px solid var(--fm-line);
  border-radius: var(--fm-radius);
  background: var(--fm-surface);
  box-shadow: 0 8px 24px rgba(18, 49, 43, 0.06);
}

.wp-block-group.is-style-fm-accent-panel {
  padding: 24px;
  border: 1px solid rgba(209, 93, 79, 0.25);
  border-radius: var(--fm-radius);
  background: #fff6f4;
}

.wp-block-quote {
  margin-left: 0;
  padding: 16px 18px;
  border-left: 4px solid var(--fm-gold);
  background: var(--fm-surface);
}

@media (max-width: 900px) {
  .fm-menu-toggle {
    display: grid;
  }

  .fm-primary-nav {
    position: absolute;
    top: 72px;
    right: 16px;
    left: 16px;
    display: none;
    padding: 16px;
    border: 1px solid var(--fm-line);
    border-radius: 8px;
    background: var(--fm-surface);
    box-shadow: var(--fm-shadow);
  }

  .fm-primary-nav.is-open {
    display: block;
  }

  .fm-primary-nav ul {
    display: grid;
    gap: 6px;
  }

  .fm-header-cta {
    display: none;
  }

  .fm-front-hero-inner {
    min-height: 460px;
    padding: 60px 0 68px;
  }

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

  .fm-post-layout {
    grid-template-columns: 1fr;
  }

  .fm-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .fm-brand-mark {
    width: 36px;
    height: 36px;
  }

  .fm-site-description {
    display: none;
  }

  .fm-front-hero::after {
    background: rgba(18, 49, 43, 0.84);
  }

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

  .fm-footer-inner {
    grid-template-columns: 1fr;
  }

  .fm-page-header {
    padding-top: 44px;
  }
}
