/*
Theme Name:  AppFast
Theme URI:   https://example.com/appfast
Description: 飾らない美しさと圧倒的なパフォーマンス。アプリ販売に特化した超軽量テーマ。
Version:     2.0.0
Author:      Your Name
Author URI:  https://example.com
License:     GPL-2.0-or-later
Text Domain: appfast
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Color – Base */
  --clr-bg:        #f5f5f7;
  --clr-surface:   rgba(255, 255, 255, 0.78);
  --clr-surface-solid: #ffffff;
  --clr-border:    rgba(220, 220, 216, 0.6);
  --clr-border-solid: #e2e2de;
  --clr-text:      #1d1d1f;
  --clr-muted:     #6e6e73;
  --clr-success:   #00a86b;

  /* Accent – Gradient system (Stripe-inspired, Apple-refined) */
  --clr-accent:        #0066ff;
  --clr-accent-hv:     #0052cc;
  --clr-accent-2:      #6e40c9;   /* purple node */
  --clr-accent-3:      #00c2d4;   /* cyan highlight */

  /* Gradients */
  --grad-accent:        linear-gradient(135deg, #0066ff 0%, #6e40c9 60%, #c0368c 100%);
  --grad-accent-soft:   linear-gradient(135deg, rgba(0,102,255,.12) 0%, rgba(110,64,201,.10) 100%);
  --grad-accent-hover:  linear-gradient(135deg, #1a7aff 0%, #7f52d9 60%, #cc4d9e 100%);
  --grad-surface:       linear-gradient(160deg, rgba(255,255,255,.85) 0%, rgba(245,245,250,.65) 100%);
  --grad-mesh:          radial-gradient(ellipse at 20% 50%, rgba(0,102,255,.07) 0%, transparent 60%),
                        radial-gradient(ellipse at 80% 20%, rgba(110,64,201,.06) 0%, transparent 55%),
                        radial-gradient(ellipse at 60% 85%, rgba(0,194,212,.05) 0%, transparent 50%);
  --grad-card-shine:    linear-gradient(135deg, rgba(255,255,255,.5) 0%, rgba(255,255,255,0) 60%);

  /* Typography */
  --font-sans: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI",
               "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans CJK JP", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;

  /* Scale */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2.25rem;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Layout */
  --max-w-content: 680px;
  --max-w-wide:    960px;

  /* Effects */
  --radius-sm:  8px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --radius-xl:  32px;

  /* Shadows – layered for realism */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 8px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:  0 20px 48px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);
  --shadow-xl:  0 32px 64px rgba(0,0,0,.12), 0 8px 20px rgba(0,0,0,.06);
  --shadow-accent: 0 8px 24px rgba(0,102,255,.25), 0 2px 8px rgba(0,102,255,.12);
  --shadow-glass: 0 8px 32px rgba(0,0,0,.08), 0 1px 1px rgba(255,255,255,.6) inset;

  /* Glassmorphism */
  --glass-bg:     rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-blur:   saturate(180%) blur(16px);

  /* Transition */
  --ease:      cubic-bezier(.4, 0, .2, 1);
  --ease-out:  cubic-bezier(0, 0, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur:       200ms;
  --dur-lg:    360ms;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
/*
 * margin: 0 / padding: 0 をユニバーサルリセットから除去。
 * ブラウザのデフォルト余白（見出し・段落など）と
 * WordPress ブロックエディタの gap/spacing を尊重するため。
 */
*, *::before, *::after { box-sizing: border-box; }

/*
 * サイト固有 UI（ナビ・カード等）に限定したゼロリセット。
 * .wp-block-* クラスは対象外とし、ブロック間余白を保護する。
 */
.site-header, .site-footer, .site-nav,
.app-card, .app-hero, .app-cta,
.btn, .tag, .spec-table caption,
.faq-list, .faq-list__item,
.tag-list, .page-header,
.screenshot-gallery, .widget {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--clr-text);
  background: var(--clr-bg);
  background-image: var(--grad-mesh);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--clr-accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

ul, ol { list-style: none; }

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--max-w-content);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--wide {
  max-width: var(--max-w-wide);
}

/* ============================================================
   SITE HEADER – Glassmorphism bar
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset,
              0 4px 20px rgba(0,0,0,.05);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 58px;
}

.site-header__logo {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -.03em;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.site-header__logo:hover { text-decoration: none; opacity: .85; }

/* カスタムロゴ画像 */
.custom-logo-link {
  display: flex;
  align-items: center;
  line-height: 1;
}

.custom-logo-link:hover { opacity: .82; transition: opacity var(--dur) var(--ease); }

.custom-logo {
  height: 32px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.site-nav { display: flex; gap: var(--space-6); }

.site-nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--clr-muted);
  transition: color var(--dur) var(--ease);
  position: relative;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--grad-accent);
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--dur) var(--ease-spring);
}

.site-nav a:hover {
  color: var(--clr-text);
  text-decoration: none;
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
  margin-top: var(--space-16);
  border-top: 1px solid var(--clr-border);
  padding-block: var(--space-8);
  font-size: var(--text-sm);
  color: var(--clr-muted);
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.site-main {
  padding-block: var(--space-12);
}

/* ============================================================
   APP INDEX (index.php / archive)
   ============================================================ */
.app-grid {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .app-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ──────────────────────────────────────────────
   App card – Glassmorphism + depth + shine
   ──────────────────────────────────────────────*/
.app-card {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  overflow: hidden;
  box-shadow: var(--shadow-sm), 0 1px 0 rgba(255,255,255,.8) inset;
  transition:
    box-shadow   var(--dur-lg) var(--ease-out),
    transform    var(--dur-lg) var(--ease-spring),
    border-color var(--dur)    var(--ease);
  will-change: transform, box-shadow;
}

/* 光沢ハイライト擬似要素 */
.app-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad-card-shine);
  opacity: 0;
  transition: opacity var(--dur-lg) var(--ease);
  pointer-events: none;
  border-radius: inherit;
}

/* アクセントグラデーションの淡い境界光 */
.app-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-lg) + 1px);
  background: var(--grad-accent);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--dur) var(--ease);
}

.app-card:hover {
  box-shadow: var(--shadow-lg), 0 1px 0 rgba(255,255,255,.9) inset;
  transform: translateY(-6px) scale(1.01);
  border-color: transparent;
}

.app-card:hover::before { opacity: 1; }
.app-card:hover::after  { opacity: .35; }

.app-card__icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-md);
  transition: transform var(--dur-lg) var(--ease-spring),
              box-shadow var(--dur-lg) var(--ease);
}

.app-card:hover .app-card__icon {
  transform: scale(1.06) rotate(-1deg);
  box-shadow: var(--shadow-lg);
}

.app-card__title {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -.025em;
  margin-bottom: var(--space-2);
}

.app-card__title a { color: inherit; }
.app-card__title a:hover { text-decoration: none; }

.app-card__excerpt {
  font-size: var(--text-sm);
  color: var(--clr-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card__price {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  font-weight: 700;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

/* ============================================================
   SINGLE APP PAGE (single-app.php)
   ============================================================ */

/* Hero */
.app-hero {
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.app-hero__icon {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0,0,0,.06);
}

.app-hero__body { min-width: 0; }

.app-hero__title {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.2;
}

.app-hero__tagline {
  margin-top: var(--space-2);
  font-size: var(--text-base);
  color: var(--clr-muted);
}

/* ──────────────────────────────────────────────
   CTA Buttons – Gradient + glow
   ──────────────────────────────────────────────*/
.app-cta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-10);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.62em 1.5em;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition:
    transform   var(--dur)    var(--ease-spring),
    box-shadow  var(--dur)    var(--ease),
    opacity     var(--dur)    var(--ease);
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.96); }

/* 光沢レイヤー */
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: rgba(255,255,255,.18);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  pointer-events: none;
}

.btn--primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.btn--primary:hover {
  background: var(--grad-accent-hover);
  box-shadow: 0 12px 32px rgba(0,102,255,.35), 0 4px 12px rgba(0,102,255,.18);
  transform: translateY(-2px);
}

.btn--ghost {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--clr-muted);
  border: 1px solid var(--clr-border);
  box-shadow: var(--shadow-xs);
}

.btn--ghost::before { display: none; }

.btn--ghost:hover {
  background: rgba(255,255,255,.9);
  color: var(--clr-text);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn--lg {
  font-size: var(--text-lg);
  padding: 0.72em 2em;
  border-radius: var(--radius-lg);
}

.app-cta__price {
  font-size: var(--text-xl);
  font-weight: 700;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-cta__price--free { color: var(--clr-success); -webkit-text-fill-color: var(--clr-success); }

/* ──────────────────────────────────────────────
   Spec table – Glass card
   ──────────────────────────────────────────────*/
.spec-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
  margin-bottom: var(--space-10);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.spec-table caption {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--clr-muted);
  margin-bottom: var(--space-3);
  caption-side: top;
  padding: var(--space-4) var(--space-4) 0;
}

.spec-table th,
.spec-table td {
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--clr-border);
  vertical-align: middle;
}

.spec-table th {
  width: 40%;
  font-weight: 600;
  color: var(--clr-muted);
  text-align: left;
}

.spec-table td { font-weight: 500; }

.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: none; }

.spec-table tr:hover th,
.spec-table tr:hover td {
  background: rgba(0,102,255,.04);
}

/* ──────────────────────────────────────────────
   App description body
   ──────────────────────────────────────────────*/
.app-body {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--clr-text);
}

.app-body h2 {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -.025em;
  margin-block: 2em 0.6em;
}

.app-body h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-block: 1.75em 0.5em;
}

.app-body p { margin-bottom: 1.5em; }

.app-body ul, .app-body ol {
  list-style: revert;
  padding-left: var(--space-6);
  margin-bottom: 1.5em;
}

.app-body li { margin-bottom: var(--space-1); }

/* ============================================================
   SCREENSHOT GALLERY
   ============================================================ */
.app-screenshots-section {
  margin-bottom: var(--space-8);
}

.screenshot-gallery {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-padding-inline: var(--space-6);
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border-solid) transparent;
  padding-block: var(--space-3);
  padding-inline: var(--space-2);
  margin-inline: calc(-1 * var(--space-2));
  overscroll-behavior-x: contain;
}

.screenshot-gallery::-webkit-scrollbar { height: 4px; }
.screenshot-gallery::-webkit-scrollbar-track { background: transparent; }
.screenshot-gallery::-webkit-scrollbar-thumb {
  background: var(--clr-border-solid);
  border-radius: 999px;
}

.screenshot-gallery__item {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: clamp(220px, 60vw, 300px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  background: var(--clr-surface-solid);
  transition:
    box-shadow  var(--dur-lg) var(--ease-out),
    transform   var(--dur-lg) var(--ease-spring);
}

.screenshot-gallery__item:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px) scale(1.015);
}

.screenshot-gallery__item img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

@media (min-width: 640px) {
  .screenshot-gallery__item {
    width: clamp(260px, 40vw, 360px);
  }
}

/* ============================================================
   FAQ SECTION – Glass accordion
   ============================================================ */
.app-faq {
  margin-top: var(--space-4);
}

.app-faq__heading {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -.025em;
  margin-bottom: var(--space-6);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.faq-list__item {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  box-shadow: var(--shadow-xs);
  transition:
    box-shadow  var(--dur) var(--ease),
    transform   var(--dur) var(--ease-spring);
}

.faq-list__item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.faq-list__question {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--clr-text);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--clr-border);
  padding-left: calc(var(--space-6) + 4px);
  border-left: 4px solid transparent;
  border-image: var(--grad-accent) 1;
  position: relative;
}

.faq-list__answer {
  font-size: var(--text-sm);
  color: var(--clr-muted);
  line-height: 1.7;
  padding: var(--space-4) var(--space-6);
  padding-left: calc(var(--space-6) + 4px);
  background: rgba(0,102,255,.025);
}

/* ============================================================
   TAG LIST
   ============================================================ */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.tag {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: .04em;
  padding: .28em .85em;
  border-radius: 999px;
  background: var(--grad-accent-soft);
  border: 1px solid rgba(0,102,255,.15);
  color: var(--clr-accent);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.tag:hover {
  background: linear-gradient(135deg, rgba(0,102,255,.2) 0%, rgba(110,64,201,.15) 100%);
  transform: translateY(-1px);
}

/* ============================================================
   SECTION LABEL
   ============================================================ */
.section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--clr-muted);
  margin-bottom: var(--space-4);
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin-block: var(--space-8);
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 2px;
  background: var(--grad-accent);
  border-radius: 999px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  margin-bottom: var(--space-8);
}

.page-header__title {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.12;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header__desc {
  margin-top: var(--space-3);
  font-size: var(--text-base);
  color: var(--clr-muted);
}

/* ============================================================
   EMPTY / NO POSTS
   ============================================================ */
.no-posts {
  text-align: center;
  padding-block: var(--space-12);
  color: var(--clr-muted);
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.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;
}

/* ============================================================
   MEDIA – DARK MODE
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --clr-bg:           #09090b;
    --clr-surface:      rgba(28, 28, 32, 0.82);
    --clr-surface-solid: #1c1c20;
    --clr-border:       rgba(50, 50, 58, 0.55);
    --clr-border-solid: #2e2e36;
    --clr-text:         #f0f0ef;
    --clr-muted:        #8a8a94;
    --clr-success:      #00c27a;

    --clr-accent:       #4d94ff;
    --clr-accent-hv:    #6aabff;
    --clr-accent-2:     #9b72f5;
    --clr-accent-3:     #22d9ee;

    --grad-accent:       linear-gradient(135deg, #4d94ff 0%, #9b72f5 60%, #f06ad4 100%);
    --grad-accent-soft:  linear-gradient(135deg, rgba(77,148,255,.14) 0%, rgba(155,114,245,.10) 100%);
    --grad-accent-hover: linear-gradient(135deg, #66a3ff 0%, #ac85f7 60%, #f280da 100%);
    --grad-mesh:         radial-gradient(ellipse at 20% 50%, rgba(77,148,255,.08) 0%, transparent 60%),
                         radial-gradient(ellipse at 80% 20%, rgba(155,114,245,.07) 0%, transparent 55%),
                         radial-gradient(ellipse at 60% 85%, rgba(34,217,238,.06) 0%, transparent 50%);
    --grad-card-shine:   linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,0) 60%);

    --glass-bg:     rgba(28, 28, 34, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur:   saturate(180%) blur(16px);

    --shadow-accent: 0 8px 24px rgba(77,148,255,.30), 0 2px 8px rgba(77,148,255,.15);
  }

  .site-header {
    background: rgba(9, 9, 11, .78);
    border-bottom-color: rgba(255,255,255,.06);
    box-shadow: 0 1px 0 rgba(255,255,255,.04) inset,
                0 4px 20px rgba(0,0,0,.25);
  }

  .screenshot-gallery::-webkit-scrollbar-thumb {
    background: var(--clr-border-solid);
  }

  .app-card {
    box-shadow: var(--shadow-sm), 0 1px 0 rgba(255,255,255,.05) inset;
  }

  .app-card:hover {
    box-shadow: var(--shadow-lg), 0 1px 0 rgba(255,255,255,.08) inset;
  }

  .btn--primary {
    box-shadow: var(--shadow-accent);
  }

  .spec-table {
    background: rgba(28, 28, 34, 0.75);
    border-color: rgba(255,255,255,.07);
  }

  .faq-list__answer {
    background: rgba(77,148,255,.04);
  }
}

/* ============================================================
   CUSTOMIZER INTEGRATION
   CSS custom properties for color, logo, and sticky header are
   injected via <style id="appfast-custom-props"> in wp_head
   (functions.php, priority 5). The rules below consume those
   variables and add layout-variant styles.
   ============================================================ */

/* ── Header: sticky / static toggle ── */
.site-header {
  position: var(--header-position, sticky); /* Customizer-driven */
}

/* Ensure .header--static is truly non-sticky */
.header--static {
  position: relative !important;
  top: unset !important;
}

/* ── Header: Logo height (Customizer-driven) ── */
.appfast-logo,
.custom-logo {
  height: var(--logo-height, 32px);
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

/* ── Header: Desktop / Mobile logo switching ── */
.appfast-logo--mobile {
  display: none;
}

@media (max-width: 767px) {
  .appfast-logo--desktop {
    display: none;
  }
  .appfast-logo--mobile {
    display: block;
  }
}

/* ── Header: Logo anchor shared styles ── */
.appfast-logo-link {
  display: flex;
  align-items: center;
  line-height: 1;
  text-decoration: none;
}

.appfast-logo-link:hover {
  opacity: 0.82;
  transition: opacity var(--dur) var(--ease);
  text-decoration: none;
}

/* ── Header: Logo Left / Menu Right (default) ── */
.header--logo-left .site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 58px;
}

/* ── Header: Logo Center / Menu Below ── */
.header--logo-center .site-header__inner--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-3);
}

.header--logo-center .site-header__logo-wrap {
  display: flex;
  justify-content: center;
}

.header--logo-center .site-nav--center {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
}

/* ── Buttons: use --clr-accent from Customizer ── */
.btn--primary {
  background: var(--clr-accent);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.15), 0 2px 8px rgba(0,0,0,.08);
}

.btn--primary:hover {
  background: var(--clr-accent-hv);
  box-shadow: var(--shadow-accent);
}

/* ── Focus ring: use --clr-accent ── */
:focus-visible {
  outline-color: var(--clr-accent);
}

/* ── Links: use --clr-accent ── */
a {
  color: var(--clr-accent);
}

/* ── Body: use Customizer bg & text colors ── */
body {
  background-color: var(--clr-bg);
  color: var(--clr-text);
}

/* ============================================================
   CUSTOMIZER INTEGRATION v2
   All Customizer-driven values are injected via wp_add_inline_style()
   in functions.php (appfast_build_inline_css). The rules below
   consume those CSS custom properties and add layout variants.
   ============================================================ */

/* ── Header: position controlled by --header-position ── */
.site-header {
  position: var(--header-position, sticky);
}
.header--static {
  position: relative !important;
  top: unset !important;
}

/* ── Logo: height from --logo-height ── */
.appfast-logo,
.custom-logo {
  height: var(--logo-height, 32px);
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

/* ── Logo: desktop/mobile switching ── */
.appfast-logo--mobile { display: none; }

@media (max-width: 767px) {
  .appfast-logo--desktop { display: none; }
  .appfast-logo--mobile  { display: block; }
}

.appfast-logo-link {
  display: flex;
  align-items: center;
  line-height: 1;
  text-decoration: none;
}
.appfast-logo-link:hover {
  opacity: .82;
  transition: opacity var(--dur) var(--ease);
  text-decoration: none;
}

/* ── Header layouts ── */
.header--logo-left .site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 58px;
}

.header--logo-center .site-header__inner--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-3);
}
.header--logo-center .site-header__logo-wrap {
  display: flex;
  justify-content: center;
}
.header--logo-center .site-nav--center {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
}

/* ── Button shape via --btn-radius-custom ── */
.btn {
  border-radius: var(--btn-radius-custom, 16px) !important;
}

/* ── Font: cascade via --font-sans ── */
body {
  font-family: var(--font-sans);
  font-size:   var(--text-base);
  color:       var(--clr-text);
  background-color: var(--clr-bg);
}

/* ── Focus ring: accent color ── */
:focus-visible {
  outline-color: var(--clr-accent);
}

/* ── Links ── */
a { color: var(--clr-accent); }

/* ── Buttons: accent color ── */
.btn--primary {
  background: var(--clr-accent);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.15), 0 2px 8px rgba(0,0,0,.08);
}
.btn--primary:hover {
  background: var(--clr-accent-hv);
  box-shadow: var(--shadow-accent);
}

/* ============================================================
   LAYOUT: 1-column vs 2-column (sidebar)
   ============================================================ */
.site-layout {
  display: block;
}

.site-layout--sidebar-right {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-8);
  align-items: start;
  max-width: var(--max-w-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
  padding-block: var(--space-12);
}

/* When sidebar is active, the inner .container--wide should remove its own centering */
.site-layout--sidebar-right .site-main {
  padding-block: 0;
  min-width: 0; /* prevent grid blowout */
}
.site-layout--sidebar-right .site-main .container--wide {
  max-width: 100%;
  padding-inline: 0;
}

/* Full width: keep existing layout */
.site-layout--full .site-main {
  padding-block: var(--space-12);
}

/* ── Responsive: stack on small screens ── */
@media (max-width: 768px) {
  .site-layout--sidebar-right {
    grid-template-columns: 1fr;
    padding-inline: var(--space-4);
  }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.site-sidebar {
  padding-top: var(--space-4);
}

/* Widget: base card */
.widget {
  background: var(--glass-bg);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-4);
}

.widget:last-child {
  margin-bottom: 0;
}

.widget-title {
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--clr-text);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--clr-accent);
}

.widget ul {
  list-style: disc;
  padding-left: var(--space-4);
}

.widget ul li {
  font-size: var(--text-sm);
  color: var(--clr-muted);
  margin-bottom: var(--space-2);
}

.widget ul li a {
  color: var(--clr-text);
  transition: color var(--dur) var(--ease);
}
.widget ul li a:hover {
  color: var(--clr-accent);
  text-decoration: none;
}

/* Sidebar placeholder (no widgets added yet) */
.sidebar-placeholder {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  border: 2px dashed var(--clr-border-solid);
  border-radius: var(--radius-md);
  color: var(--clr-muted);
  font-size: var(--text-sm);
}

/* ============================================================
   HEADING STYLES (body class variants)
   Default: inherited from appfast_build_inline_css() output.
   The inline CSS uses specific selectors for each heading style
   setting value, so no extra body-class rules are needed here.
   This section provides safe resets for the plain (default) style.
   ============================================================ */
.app-body h1, .app-body h2, .app-body h3, .app-body h4,
.app-faq__heading {
  border-left:   none;
  border-bottom: none;
  background:    none;
  padding-left:  0;
  padding-bottom:0;
}

/* ============================================================
   WORDPRESS BLOCK EDITOR – 余白競合回避
   ユニバーサルリセットを限定化したことで wp-block-* のデフォルト
   spacing はそのまま機能するが、念のため基本要素の余白を保証する。
   ============================================================ */

/*
 * .entry-content / .wp-block-post-content 内の標準要素に
 * ブラウザデフォルト相当の余白を明示付与。
 * .app-body との二重定義にならないよう、
 * .app-body を含まないコンテキストのみに適用する。
 */
.entry-content:not(.app-body) p,
.wp-block-post-content:not(.app-body) p {
  margin-bottom: 1.5em;
}

.entry-content:not(.app-body) h2,
.wp-block-post-content:not(.app-body) h2 {
  margin-block: 2em 0.6em;
}

.entry-content:not(.app-body) h3,
.wp-block-post-content:not(.app-body) h3 {
  margin-block: 1.75em 0.5em;
}

.entry-content:not(.app-body) ul,
.entry-content:not(.app-body) ol,
.wp-block-post-content:not(.app-body) ul,
.wp-block-post-content:not(.app-body) ol {
  list-style: revert;
  padding-left: var(--space-6);
  margin-bottom: 1.5em;
}

/*
 * wp-block-group / wp-block-columns の内部 gap は
 * theme.json の spacing 設定に委ねる。
 * ここでは上書きしない（競合回避）。
 */
.wp-block-group,
.wp-block-columns,
.wp-block-column {
  /* intentionally empty – theme.json controls spacing */
}

/* ============================================================
   404 PAGE
   ============================================================ */
.error-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-block: var(--space-16);
  gap: var(--space-6);
}

/* 背景の光彩オーブ */
.error-404__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 160px;
}

.error-404__orb {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--grad-accent-soft);
  filter: blur(28px);
  opacity: 0.7;
  animation: orb-pulse 4s ease-in-out infinite;
}

@keyframes orb-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.7; }
  50%       { transform: scale(1.1); opacity: 1;   }
}

.error-404__code {
  position: relative;
  font-size: clamp(4rem, 16vw, 7rem);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: 1;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  user-select: none;
}

.error-404__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -.03em;
}

.error-404__desc {
  font-size: var(--text-base);
  color: var(--clr-muted);
  max-width: 400px;
  line-height: 1.7;
}

.error-404__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  max-width: 360px;
}

/* WordPress 標準の search フォームを統一スタイルに */
.error-404__actions .search-form,
.search-again .search-form {
  display: flex;
  gap: var(--space-2);
  width: 100%;
}

.error-404__actions .search-field,
.search-again .search-field,
.search-no-results .search-field {
  flex: 1;
  padding: 0.62em var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  color: var(--clr-text);
  outline: none;
  transition: border-color var(--dur) var(--ease),
              box-shadow   var(--dur) var(--ease);
}

.error-404__actions .search-field:focus,
.search-again .search-field:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, .15);
}

.error-404__actions .search-submit,
.search-again .search-submit {
  padding: 0.62em var(--space-6);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--grad-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease-spring);
  white-space: nowrap;
}

.error-404__actions .search-submit:hover,
.search-again .search-submit:hover {
  opacity: .88;
  transform: translateY(-1px);
}

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-again {
  margin-bottom: var(--space-8);
}

.search-again .search-form {
  max-width: 480px;
}

.search-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  padding-block: var(--space-12);
}

.search-no-results__tips {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 400px;
  text-align: left;
}

.search-no-results__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.search-no-results__list li {
  font-size: var(--text-sm);
  color: var(--clr-muted);
  padding-left: var(--space-4);
  position: relative;
}

.search-no-results__list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--clr-accent);
  font-weight: 700;
}

/* ============================================================
   ARCHIVE-APPS PAGE
   ============================================================ */
.archive-apps__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.archive-apps__count {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--clr-muted);
  background: var(--glass-bg);
  border: 1px solid var(--clr-border);
  border-radius: 999px;
  padding: .2em .9em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.archive-apps__terms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.archive-apps__terms .tag {
  text-decoration: none;
}

.archive-apps__desc {
  margin-top: var(--space-4);
  font-size: var(--text-base);
  color: var(--clr-muted);
  line-height: 1.7;
}
