/* ===== ANOKOE UI v0.23 — Components & Layout (質感調整版) =====
 * ガラス効果ヘッダー、ボタン階層、カード、セクション見出し、空状態
 * 44×44 tap targets, AA contrast, Reduced Motion respect
 * 質感: blur(10px), padding 28px, gap 28px, 影 md+ (y+2px/α+0.02)
 */

/* ===== Header: Glass Effect with Scroll Detection ===== */
.ak-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 200ms ease-out, border-color 200ms ease-out, backdrop-filter 200ms ease-out;
}

.ak-header--scrolled {
  background: rgba(255, 255, 255, 0.5); /* 0.75 → 0.5 */
  backdrop-filter: blur(10px) saturate(180%); /* 12px → 10px */
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Dトーン背景用のガラス効果 */
.bg-dtone .ak-header--scrolled {
  background: rgba(10, 14, 26, 0.5); /* 0.75 → 0.5 */
  backdrop-filter: blur(10px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ak-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 72px;
  padding: 0 28px; /* 24px → 28px */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* ===== Brand Logo ===== */
.ak-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(17px, 3vw, 20px);
  font-weight: var(--fw-heading);
  color: var(--ink);
}

.ak-brand__link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 8px;
  margin: -8px;
  border-radius: 12px;
  transition: background 160ms ease-out;
}

.ak-brand__link:hover {
  background: rgba(0, 0, 0, 0.04);
}

.bg-dtone .ak-brand__link:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ak-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ak-logo__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===== Navigation ===== */
.ak-nav {
  display: none;
  flex: 1;
  gap: 8px;
  justify-content: center;
  max-width: 480px;
}

@media (min-width: 768px) {
  .ak-nav {
    display: flex;
  }
}

.ak-nav__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: color-mix(in oklab, var(--ink) 75%, transparent);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 160ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.ak-nav__item:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--ink);
  transform: translateY(-1px);
}

.bg-dtone .ak-nav__item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.ak-nav__icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ak-nav__label {
  white-space: nowrap;
}

/* ===== Header Actions ===== */
.ak-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ak-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.ak-action:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.bg-dtone .ak-action:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.ak-action__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent-1);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
}

/* CTA Button with Icon + Label */
.ak-action--cta {
  background: var(--cta-bg);
  color: var(--cta-fg);
  font-weight: 700;
  padding: 12px 16px;
  gap: 6px;
  border: none;
  box-shadow: var(--shadow-cta);
}

.ak-action--cta:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 87, 255, 0.3);
}

.ak-action__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ak-action__label {
  display: none;
  white-space: nowrap;
}

/* Expand label on hover/focus */
.ak-action--cta.ak-action--expanded .ak-action__label,
.ak-action--cta:hover .ak-action__label,
.ak-action--cta:focus .ak-action__label {
  display: inline;
}

/* ===== Button Hierarchy ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-min);
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2, 0.9, 0.25, 1);
  border: none;
}

/* Primary: Brand gradient */
.btn--primary {
  background: var(--cta-bg);
  color: var(--cta-fg);
  box-shadow: var(--shadow-cta);
}

.btn--primary:hover {
  transform: translateY(-1px) scale(1.02); /* 維持 */
  box-shadow: 0 12px 32px rgba(0, 87, 255, 0.3);
}

.btn--primary:active {
  transform: translateY(0) scale(0.98);
}

.btn--primary:focus-visible {
  outline: 3px solid var(--brand); /* var(--c-accent) → var(--brand) */
  outline-offset: 2px;
}

/* Secondary: Outline */
.btn--secondary {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--line);
}

.btn--secondary:hover {
  background: var(--surface);
  border-color: color-mix(in oklab, var(--ink) 30%, transparent);
  transform: translateY(-1px);
}

.btn--secondary:active {
  transform: translateY(0);
}

/* Text button: Minimal */
.btn--text {
  background: transparent;
  color: color-mix(in oklab, var(--ink) 65%, transparent);
  padding: 8px 12px;
  font-weight: 500;
}

.btn--text:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Hero-specific button (larger) */
.btn--hero {
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 700;
  min-height: 52px;
}

/* ===== Cards ===== */
.card,
.tone-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.14); /* Y: 3→5px, α: 0.12→0.14 */
  transition: transform 160ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.card:hover,
.tone-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

/* Card on Dトーン background */
.bg-dtone .card,
.bg-dtone .tone-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32); /* Y+2px, α+0.02 */
}

/* Card Grid */
.card-grid {
  display: grid;
  gap: 28px; /* 24px → 28px */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Card Variants */
.card--side {
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  border-color: color-mix(in oklab, var(--line) 70%, transparent);
}

.card--accent {
  background: linear-gradient(135deg, 
    color-mix(in oklab, var(--brand) 8%, var(--surface)), 
    var(--surface));
  border: none;
  box-shadow: 0 6px 18px rgba(0, 87, 255, 0.12);
}

.bg-dtone .card--accent {
  background: linear-gradient(135deg,
    rgba(0, 87, 255, 0.12),
    rgba(0, 215, 127, 0.08));
  border: 1px solid rgba(0, 87, 255, 0.2);
}

/* ===== Section Headers ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.section-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: var(--fw-heading);
  color: var(--ink);
  margin: 0;
}

.section-header__icon {
  font-size: 1.35rem;
}

.section-header__help {
  font-size: 0.85rem;
  color: color-mix(in oklab, var(--ink) 60%, transparent);
  font-weight: var(--fw-body);
}

/* ===== Empty State ===== */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  text-align: center;
}

.empty__icon {
  font-size: 3rem;
  opacity: 0.4;
}

.empty__message {
  font-size: 1rem;
  color: color-mix(in oklab, var(--ink) 60%, transparent);
  margin: 0;
}

.empty-hint {
  text-align: center;
  color: color-mix(in oklab, var(--ink) 60%, transparent);
  font-size: 14px;
  padding: 32px 16px;
  margin: 0;
}

/* ===== Breadcrumbs ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.breadcrumb a {
  color: color-mix(in srgb, var(--ink) 85%, var(--brand) 15%);
  text-decoration: none;
  transition: color 120ms ease-out;
}

.breadcrumb a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: color-mix(in oklab, var(--ink) 40%, transparent);
}

/* ===== Container ===== */
.container-mobile,
.ak-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px; /* 24px → 28px */
}

/* ===== Typography Tuning ===== */
h1, .h1 {
  letter-spacing: -0.01em;
  line-height: 1.15;
}

/* ===== Accessibility: Focus Visible ===== */
.ak-nav__item:focus-visible,
.ak-action:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--brand); /* 統一 */
  outline-offset: 2px;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .ak-header,
  .ak-nav__item,
  .ak-action,
  .btn,
  .card,
  .tone-card {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
}

/* ===== Remove Debug Bars ===== */
.compare-bar,
.tone-summary,
[data-debug-bar],
.summary-bar,
.ak-compare-bar,
#compare-bar,
#tone-summary,
.ak-preview-badge,
.ak-devbadge,
.ak-dev-only {
  display: none !important;
}

/* ===== Table Sticky Header (for admin pages) ===== */
.table-sticky thead th {
  position: sticky;
  top: 72px; /* Header height */
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  z-index: 10;
  border-bottom: 2px solid var(--line);
}

.bg-dtone .table-sticky thead th {
  background: rgba(10, 14, 26, 0.85);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 767px) {
  .ak-header__inner {
    height: 64px;
    padding: 0 16px;
  }
  
  .ak-brand {
    font-size: 17px;
  }
  
  .ak-logo {
    width: 28px;
    height: 28px;
  }
  
  .ak-actions {
    gap: 8px;
  }
  
  .ak-action {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .ak-header__inner {
    max-width: 960px;
  }
  
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
  }
}

@media (min-width: 1024px) {
  .ak-header__inner {
    height: 76px;
  }
  
  .ak-brand {
    font-size: 20px;
  }
  
  .ak-logo {
    width: 36px;
    height: 36px;
  }
  
  .card-grid {
    gap: 32px;
  }
}

