/* ============================================
   Uravation Base — Core Styles
   Shared layout, typography, and components.
   Colors come from :root variables (set by child theme tokens.css).
   ============================================ */

/* ---- Design Tokens (defaults, overridden by child) ---- */
:root {
  /* Base palette */
  --ink: #0B1220;
  --ink-2: #1C2A3A;
  --ink-3: #2D3E50;
  --color-bg: #F6F8FB;
  --color-surface: #FFFFFF;

  /* Accent (child theme overrides these) */
  --accent: #6366f1;
  --accent-soft: #a5b4fc;
  --accent-dark: #4f46e5;
  --accent-deep: #3730a3;
  --accent-light: #e0e7ff;
  --accent-bg: rgba(99, 102, 241, 0.05);

  /* Gradients (child theme overrides) */
  --gradient-hero: linear-gradient(135deg, #0B1220 0%, #1e1b4b 50%, #312e81 100%);
  --gradient-card: linear-gradient(135deg, #312e81 0%, #4f46e5 40%, #6366f1 100%);
  --gradient-accent: linear-gradient(135deg, #6366f1, #8b5cf6);

  /* UI colors */
  --color-border: rgba(15, 23, 42, 0.08);
  --color-bg-alt: #EDF1F7;
  --color-bg-dark: #0B1220;
  --color-text: #0B1220;
  --color-text-2: #2D3E50;
  --color-text-light: #475569;
  --color-text-muted: #94a3b8;
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(11, 18, 32, 0.08);
  --shadow-card-hover: 0 20px 60px rgba(99, 102, 241, 0.15), 0 8px 24px rgba(11, 18, 32, 0.12);
  --shadow-1: 0 6px 20px rgba(11, 18, 32, 0.10), 0 1px 0 rgba(255, 255, 255, 0.7) inset;

  /* Typography */
  --font-en: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-ja: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Meiryo, sans-serif;
  --font-heading: 'Montserrat', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Meiryo, sans-serif;
  --fs-body: clamp(1.55rem, 0.35vw + 1.45rem, 1.75rem);
  --lh-body: 1.75;
  --lh-content: 1.95;

  /* Spacing (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Transitions */
  --transition-base: 0.3s cubic-bezier(0.2, 0.6, 0, 1);
  --transition-slow: 0.5s cubic-bezier(0.2, 0.6, 0, 1);
  --transition-fast: 0.15s cubic-bezier(0.2, 0.6, 0, 1);

  /* Radius */
  --radius-card: 16px;
  --radius-sm: 10px;
  --radius-btn: 50px;

  --hairline: 1px solid rgba(15, 23, 42, 0.08);
  --header-height: 80px;
  --max-width: 1200px;

  /* Article typography/layout */
  --article-max-width: 760px;
  --article-pad-y: clamp(24px, 4vw, 48px);
  --article-pad-x: clamp(16px, 5vw, 56px);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 62.5%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ja);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-body);
  letter-spacing: 0.02em;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; vertical-align: bottom; }
ul, ol { list-style: none; }
button { background: none; border: none; cursor: pointer; font-family: inherit; }

/* ---- Layout ---- */
.l-container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-8); }
.l-main { padding: calc(var(--header-height) + var(--space-10)) 0 100px; }

/* ---- Header ---- */
.l-header {
  position: fixed; top: 0; left: 0; width: 100%; height: var(--header-height);
  display: flex; align-items: center; justify-content: center; z-index: 1100;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: var(--hairline);
}
.l-header__inner {
  max-width: var(--max-width); width: 100%; margin: 0 auto; padding: 0 var(--space-10);
  display: flex; align-items: center; justify-content: space-between; height: 100%;
}
.l-header__logo a {
  display: flex; align-items: center; gap: var(--space-3);
  font-family: var(--font-en); font-size: 2rem; font-weight: 800; color: var(--color-text);
}
.l-header__nav { display: flex; align-items: center; gap: var(--space-8); }
.l-header__nav a {
  font-family: var(--font-en); font-size: 1.3rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-light); padding: var(--space-2) 0;
  transition: color var(--transition-fast);
}
.l-header__nav a:hover, .l-header__nav a.is-current { color: var(--accent); }

/* Menu button */
.c-menu-btn { display: none; width: 30px; height: 24px; position: relative; z-index: 1100; }
.c-menu-btn span, .c-menu-btn span::before, .c-menu-btn span::after {
  display: block; width: 30px; height: 2px; background: var(--color-text); position: absolute;
  transition: transform var(--transition-base);
}
.c-menu-btn span { top: 50%; transform: translateY(-50%); }
.c-menu-btn span::before { content: ''; top: -8px; }
.c-menu-btn span::after { content: ''; top: 8px; }

/* ---- Section Headers ---- */
.p-section-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-8); }
.p-section-header__title {
  font-size: 2.4rem; font-weight: 800; letter-spacing: 0.06em; position: relative;
}
.p-section-header__title::before {
  content: ''; position: absolute; left: 0; bottom: -8px;
  width: 40px; height: 3px; background: var(--gradient-accent); border-radius: 2px;
}
.p-section-header__link {
  font-family: var(--font-en); font-size: 1.3rem; font-weight: 600; color: var(--accent);
}

/* ---- Hero ---- */
.p-hero {
  text-align: center; padding: 88px var(--space-8) 80px; background: var(--gradient-hero);
  border-radius: var(--radius-card); margin-bottom: var(--space-20); position: relative; overflow: hidden;
}
.p-hero::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background-image: linear-gradient(rgba(99,102,241,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(99,102,241,0.06) 1px, transparent 1px);
  background-size: 40px 40px; pointer-events: none; opacity: 0.7;
}
.p-hero::after {
  content: ''; position: absolute; top: -20%; right: -10%; width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 60%); border-radius: 50%; pointer-events: none;
}
.p-hero__eyebrow {
  display: inline-block; font-family: var(--font-en); font-size: 1.1rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-soft);
  border: 1px solid rgba(165, 180, 252, 0.3); padding: 6px 18px; border-radius: 100px;
  margin-bottom: 28px; position: relative; background: rgba(99, 102, 241, 0.1);
}
.p-hero__title {
  font-family: var(--font-ja); font-size: clamp(2.6rem, 4.5vw, 4rem); font-weight: 800;
  line-height: 1.4; margin-bottom: var(--space-6); letter-spacing: 0.06em; position: relative; color: #fff;
}
.p-hero__title span { background: var(--gradient-accent); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.p-hero__desc { font-size: 1.6rem; color: rgba(255, 255, 255, 0.7); max-width: 600px; margin: 0 auto 36px; line-height: 1.9; position: relative; }
.p-hero__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-3); position: relative; }

/* ---- Buttons ---- */
.c-btn {
  display: inline-flex; align-items: center; gap: var(--space-2); padding: 14px var(--space-8);
  border-radius: var(--radius-btn); font-size: 1.5rem; font-weight: 700; border: none;
  font-family: var(--font-ja); transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.c-btn:hover { transform: translateY(-2px); }
.c-btn--primary { background: var(--gradient-accent); color: #fff; box-shadow: 0 8px 30px rgba(99, 102, 241, 0.35); }
.c-btn--outline { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.25); color: #fff; }

/* ---- Article Cards Grid ---- */
.p-articles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-6); }

.p-article-card {
  display: flex; flex-direction: column; background: var(--color-surface);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card); border: var(--hairline);
  overflow: hidden; transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.p-article-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }
.p-article-card__link { display: flex; flex-direction: column; flex: 1; color: inherit; }
.p-article-card__img { aspect-ratio: 16 / 9; overflow: hidden; position: relative; }
.p-article-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.p-article-card:hover .p-article-card__img img { transform: scale(1.05); }
.p-article-card__body { padding: var(--space-5) var(--space-6) var(--space-6); display: flex; flex-direction: column; flex: 1; }
.p-article-card__category {
  display: inline-block; width: fit-content; font-size: 1.1rem; font-weight: 700; color: var(--accent);
  background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.15);
  padding: 3px 12px; border-radius: 6px; margin-bottom: var(--space-3);
}
.p-article-card__title { font-size: 1.7rem; font-weight: 800; line-height: 1.5; margin-bottom: var(--space-2); }
.p-article-card__excerpt { font-size: 1.35rem; color: var(--color-text-light); margin-bottom: var(--space-4); line-height: 1.7; }
.p-article-card__meta {
  margin-top: auto; display: flex; align-items: center; gap: var(--space-3);
  padding-top: 14px; border-top: var(--hairline); font-size: 1.2rem; color: var(--color-text-muted);
}

/* ---- Badges ---- */
.p-badge { display: inline-block; padding: 2px 10px; font-size: 1.1rem; font-weight: 700; border-radius: 6px; }
.p-badge--beginner { background: #dcfce7; color: #166534; }
.p-badge--intermediate { background: var(--accent-light); color: var(--accent-deep); }
.p-badge--advanced { background: #f3e8ff; color: #6b21a8; }

/* ---- Category Cards ---- */
.p-categories__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.p-category-card {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  background: var(--color-surface); border: var(--hairline); border-radius: 14px;
  color: var(--color-text); position: relative; overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.p-category-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.p-category-card__icon {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border-radius: 12px; background: var(--accent-light); color: var(--accent); flex-shrink: 0;
}
.p-category-card__icon svg { width: 22px; height: 22px; }
.p-category-card__info { display: flex; flex-direction: column; min-width: 0; }
.p-category-card__name { font-size: 1.3rem; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-category-card__count { font-size: 1.1rem; color: var(--color-text-muted); }

/* ---- Featured Card ---- */
.p-featured-card {
  display: grid; grid-template-columns: 1.2fr 1fr; background: var(--color-surface);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card); border: var(--hairline); overflow: hidden;
}
.p-featured-card__img { aspect-ratio: 16 / 10; overflow: hidden; }
.p-featured-card__img img { width: 100%; height: 100%; object-fit: cover; }
.p-featured-card__body { padding: 36px; display: flex; flex-direction: column; justify-content: center; }
.p-featured-card__title { font-size: 2.2rem; font-weight: 800; line-height: 1.4; margin-bottom: var(--space-3); }
.p-featured-card__excerpt { font-size: 1.4rem; color: var(--color-text-light); line-height: 1.8; margin-bottom: var(--space-4); }

/* ---- Article Content (single page) ---- */
.p-article { margin-bottom: var(--space-12); }
.p-article__header { margin-bottom: var(--space-8); }
.p-article__title { font-size: clamp(2.4rem, 4vw, 3.2rem); font-weight: 800; line-height: 1.3; letter-spacing: 0.04em; margin-bottom: var(--space-4); font-family: var(--font-heading); }
.p-article-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
  font-size: 1.3rem; color: var(--color-text-muted); margin-bottom: var(--space-6);
}
.p-article-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.p-article-tags__item { font-size: 1.3rem; color: var(--accent); background: var(--accent-light); padding: 4px 12px; border-radius: 20px; }

.p-article__eyecatch { border-radius: var(--radius-card); overflow: hidden; margin-bottom: var(--space-8); box-shadow: var(--shadow-card); }
.p-article__eyecatch img { width: 100%; height: auto; display: block; }

.p-article-summary {
  background: linear-gradient(135deg, var(--accent-light) 0%, #f0f0ff 100%);
  border-left: 4px solid var(--accent); border-radius: 8px;
  padding: var(--space-6) 28px; margin-bottom: var(--space-8);
}
.p-article-summary__heading { font-weight: 800; font-size: 1.3rem; color: var(--accent-dark); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); }
.p-article-summary__text { font-size: 1.5rem; line-height: 1.8; color: var(--ink); }

.p-article-content {
  background: var(--color-surface); border: var(--hairline); border-radius: var(--radius-card);
  padding: var(--article-pad-y) var(--article-pad-x); box-shadow: var(--shadow-1); margin-bottom: var(--space-10);
  max-width: var(--article-max-width); margin-inline: auto;
  overflow-wrap: anywhere; word-break: break-word;
}
.p-article-content h2 {
  font-size: clamp(1.95rem, 0.8vw + 1.6rem, 2.2rem); font-weight: 800;
  margin: 2.4em 0 0.9em; padding: 0 0 14px 0;
  border-bottom: 2px solid var(--accent); line-height: 1.35;
  font-family: var(--font-heading); letter-spacing: 0.02em;
  scroll-margin-top: calc(var(--header-height) + 20px);
}
.p-article-content h2:first-child { margin-top: 0; }
.p-article-content h3 {
  font-size: clamp(1.65rem, 0.6vw + 1.4rem, 1.85rem); font-weight: 700;
  margin: 1.8em 0 0.6em;
  padding-left: 14px; border-left: 3px solid var(--accent-soft); line-height: 1.45;
  font-family: var(--font-heading); letter-spacing: 0.02em;
  scroll-margin-top: calc(var(--header-height) + 20px);
}
.p-article-content p { margin-bottom: 1.1em; color: var(--color-text-2); line-height: var(--lh-content); font-feature-settings: "palt"; }
.p-article-content ul, .p-article-content ol { margin-bottom: var(--space-6); padding-left: 1.5em; }
.p-article-content li { margin-bottom: 0.5em; line-height: var(--lh-content); color: var(--color-text-2); }
.p-article-content ul li { list-style: disc; }
.p-article-content ol li { list-style: decimal; }

.p-article-content table {
  width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: var(--space-8);
  font-size: 1.4rem; border-radius: 12px; overflow: hidden; border: var(--hairline);
}
.p-article-content th {
  background: var(--accent-light); border-bottom: var(--hairline); padding: 14px var(--space-5);
  text-align: left; font-weight: 700; font-size: 1.3rem; color: var(--accent-deep);
}
.p-article-content td { border-bottom: var(--hairline); padding: 14px var(--space-5); }
.p-article-content tr:last-child td { border-bottom: none; }
.p-article-content tr:hover td { background: var(--accent-bg); }

.p-article-content blockquote {
  border-left: 4px solid var(--accent-soft); background: var(--accent-bg);
  padding: var(--space-5) var(--space-6); margin: var(--space-6) 0; border-radius: 0 8px 8px 0;
  font-style: italic; color: var(--color-text-2);
}

.p-article-content a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); transition: border-color var(--transition-fast); }
.p-article-content a:hover { border-color: var(--accent); }

.p-article-content img { border-radius: var(--radius-sm); margin: var(--space-6) 0; box-shadow: var(--shadow-card); }

/* ---- Breadcrumb ---- */
.p-breadcrumb { font-size: 1.3rem; color: var(--color-text-muted); margin-bottom: var(--space-6); }
.p-breadcrumb__list { display: flex; flex-wrap: wrap; align-items: center; list-style: none; }
.p-breadcrumb__list li { display: flex; align-items: center; }
.p-breadcrumb__list li + li::before { content: '\203A'; margin: 0 var(--space-2); color: var(--color-text-muted); }
.p-breadcrumb a { color: var(--color-text-muted); transition: color var(--transition-fast); }
.p-breadcrumb a:hover { color: var(--accent); }

/* ---- TOC ---- */
.p-toc {
  background: var(--color-surface); border: var(--hairline); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-card) var(--radius-card) 0; padding: var(--space-6) 28px; margin-bottom: var(--space-8);
  max-width: var(--article-max-width); margin-inline: auto;
}
.p-toc__summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  cursor: pointer; list-style: none;
  font-family: var(--font-heading); font-weight: 800; font-size: 1.4rem; letter-spacing: 0.04em;
}
.p-toc__summary::-webkit-details-marker { display: none; }
.p-toc__summary::after {
  content: '';
  width: 10px; height: 10px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform var(--transition-fast);
}
.p-toc[open] .p-toc__summary::after { transform: rotate(-135deg); }
.p-toc__list { margin-top: var(--space-4); padding-left: 1.2em; }
.p-toc__item { margin: 0.35em 0; }
.p-toc__item--sub { margin-left: 1.0em; font-size: 1.35rem; }
.p-toc__link { color: var(--color-text-light); border-bottom: 1px solid transparent; transition: color var(--transition-fast), border-color var(--transition-fast); }
.p-toc__link:hover { color: var(--accent); border-color: var(--accent-soft); }
.p-toc__link.is-active { color: var(--accent); border-color: var(--accent); font-weight: 700; }
.p-article-content :is(h2, h3):target { box-shadow: 0 0 0 3px var(--accent-bg); border-radius: 8px; padding: 4px 0 4px 0; }

/* ---- Footer ---- */
.l-footer {
  background: var(--color-bg-dark); color: rgba(255, 255, 255, 0.7); padding: var(--space-16) 0 var(--space-8);
  border-top: 3px solid var(--accent);
}
.l-footer__inner { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space-8); }
.l-footer__top { display: flex; justify-content: space-between; gap: var(--space-10); margin-bottom: var(--space-10); }
.l-footer__logo { font-family: var(--font-en); font-size: 2rem; font-weight: 800; color: #fff; }
.l-footer__desc { font-size: 1.4rem; margin-top: var(--space-2); max-width: 400px; line-height: 1.8; }
.l-footer__nav a { font-size: 1.4rem; color: rgba(255, 255, 255, 0.6); transition: color var(--transition-fast); }
.l-footer__nav a:hover { color: #fff; }
.l-footer__bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: var(--space-6); }
.l-footer__copy { font-size: 1.2rem; color: rgba(255, 255, 255, 0.4); }

/* ---- Reading Progress Bar ---- */
.p-progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 3px; z-index: 1200;
  background: var(--gradient-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.1s linear;
}

/* ---- Pagination ---- */
.nav-links { display: flex; justify-content: center; gap: var(--space-2); margin-top: var(--space-10); }
.nav-links a, .nav-links span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 var(--space-3);
  border-radius: var(--radius-sm); font-size: 1.4rem; font-weight: 600;
  border: var(--hairline); color: var(--color-text-light);
  transition: all var(--transition-fast);
}
.nav-links a:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent-soft); }
.nav-links .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Utility ---- */
.u-mb-64 { margin-bottom: var(--space-16); }
.u-sp-only { display: none; }
.u-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  :root { --header-height: 64px; }
  .l-header__inner { padding: 0 var(--space-5); }
  .c-menu-btn { display: block; }
  .l-header__nav { display: none; }
  .l-container { padding: 0 var(--space-5); }
  .l-main { padding-top: calc(64px + var(--space-6)); }
  .p-featured-card { grid-template-columns: 1fr; }
  .p-featured-card__body { padding: var(--space-5) var(--space-6) var(--space-6); }
  .p-featured-card__title { font-size: 1.8rem; }
  .l-footer__top { flex-direction: column; gap: var(--space-8); }
}

@media (max-width: 640px) {
  .p-hero { padding: 56px var(--space-5) var(--space-12); margin-bottom: var(--space-12); }
  .p-hero__title { font-size: 2.4rem; }
  .p-articles-grid { grid-template-columns: 1fr; }
  .p-section-header__title { font-size: 2rem; }
  .p-article-content { --lh-content: 1.85; }
  .p-article__title { font-size: 2.2rem; }
  .p-article-summary { padding: var(--space-5); }
  .u-sp-only { display: inline; }
}

@media (max-width: 480px) {
  .p-categories__grid { grid-template-columns: 1fr 1fr; }
}
