@charset "UTF-8";

/* =========================================
   1. Design Tokens & Variables
   ========================================= */
:root {
  /* Colors - Modern Tech Palette */
  --primary: #2563eb;          /* Trustworthy Blue */
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;    /* Very light blue for backgrounds */
  --accent: #0ea5e9;           /* Sky blue for gradients */
  
  --text-main: #1f2937;        /* Almost black, softer */
  --text-sub: #6b7280;         /* Neutral gray */
  --text-light: #9ca3af;
  
  --bg-body: #f9fafb;          /* Cool gray background */
  --bg-card: #ffffff;
  
  --border: #e5e7eb;
  
  /* Shadows - Diffuse & Soft */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  
  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  /* Transition */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. Reset & Base Styles
   ========================================= */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  line-height: 1.75;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-hover); }

/* Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 60px; /* Bottom padding for mobile scroll */
}

/* =========================================
   3. Header & Navigation (Glassmorphism)
   ========================================= */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85); /* Semi-transparent */
  backdrop-filter: blur(12px);           /* Frosted glass effect */
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
  margin-bottom: 32px;
  padding-top: 16px;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.logo a { color: var(--text-main); }
.logo span { color: var(--primary); }

/* Mobile-First Scrollable Nav */
.nav-scroller {
  overflow-x: auto;
  white-space: nowrap;
  padding: 0 20px 12px; /* Bottom padding for scrollbar hiding space */
  margin: 0 -20px;      /* Negative margin to span full width */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.nav-scroller::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.nav-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 0 20px; /* Inner padding for snap alignment */
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-sub);
  border-radius: 999px; /* Pill shape */
  background: transparent;
  transition: all 0.2s var(--ease);
}
.nav-link:hover {
  background: var(--bg-body);
  color: var(--primary);
}
.nav-link.active {
  background: var(--text-main);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* =========================================
   4. Cards & Content
   ========================================= */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 32px;
  margin-bottom: 32px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

/* Article Typography (Delicate & Readable) */
.article-content h1 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.3;
  color: var(--text-main);
}
.article-content .lead {
  font-size: 1.05rem;
  color: var(--text-sub);
  margin-bottom: 32px;
  font-weight: 400;
}

/* Beautiful Headings */
.article-content h2 {
  font-size: 1.4rem;
  margin-top: 48px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  position: relative;
}
.article-content h2::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--primary);
}
.article-content h3 {
  font-size: 1.2rem;
  margin-top: 32px;
  margin-bottom: 16px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.article-content h3::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 24px;
  background: var(--primary);
  border-radius: 4px;
}

.article-content p {
  margin-bottom: 24px;
  text-align: justify;
  text-justify: inter-ideograph;
}

/* Table of Contents (TOC) */
.toc {
  background: var(--primary-light);
  border: 1px solid #dbeafe;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 40px;
}
.toc p { margin: 0 0 12px; font-weight: 700; color: #1e40af; display: flex; align-items: center; gap: 8px; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin-bottom: 10px; padding-left: 20px; position: relative; }
.toc li::before {
  content: ""; position: absolute; left: 0; top: 10px; width: 6px; height: 6px; 
  background: #93c5fd; border-radius: 50%;
}
.toc a { color: #1e3a8a; font-weight: 500; text-decoration: none; border-bottom: 1px solid transparent; }
.toc a:hover { border-color: #1e3a8a; }

/* =========================================
   5. Components (Inputs, Buttons)
   ========================================= */
/* Tool Inputs - Clean & Large */
.inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.input-card { position: relative; }
.input-card input {
  width: 100%;
  padding: 26px 16px 10px;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  font-family: 'Inter', sans-serif;
}
.input-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.input-card label {
  position: absolute; top: 10px; left: 16px;
  font-size: 0.75rem; font-weight: 700; color: var(--text-sub);
  text-transform: uppercase; letter-spacing: 0.05em; pointer-events: none;
}
.input-card .unit {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 0.9rem; color: var(--text-light); font-weight: 500;
}

/* KPI Result Cards */
.kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }

.kpi-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
/* Delicate colored top border */
.kpi-card::before {
  content:""; position: absolute; top:0; left:0; right:0; height:4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0.8;
}
.kpi-title { font-size: 0.85rem; color: var(--text-sub); font-weight: 600; margin-bottom: 6px; }
.kpi-value { font-size: 1.8rem; font-weight: 700; color: var(--text-main); letter-spacing: -0.03em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px;
  font-weight: 600; font-size: 0.95rem;
  border-radius: 99px;
  transition: all 0.2s var(--ease);
  cursor: pointer; border: 1px solid var(--border); background: #fff;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--text-main); /* Trendy black button */
  color: #fff; border-color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn-primary:hover {
  background: var(--primary); border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
}

/* =========================================
   6. Other Sections (Glossary, Footer, Ad)
   ========================================= */
/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.85rem; color: var(--text-light); margin-bottom: 24px;
}
.breadcrumbs a { color: var(--text-sub); font-weight: 500; }
.breadcrumbs a:hover { color: var(--primary); }

/* Formula Box */
.formula-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.9rem;
  color: #334155;
  margin: 24px 0;
}

/* AdSense Slot (Styled) */
.ad-slot {
  background: #f1f5f9;
  border-radius: var(--radius-md);
  margin: 32px 0;
  min-height: 120px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  position: relative; overflow: hidden;
}
.ad-label {
  font-size: 10px; color: #94a3b8; letter-spacing: 0.05em;
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
}

/* Glossary List */
.glossary-list li {
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.glossary-list a {
  display: block; font-size: 1.1rem; font-weight: 700; color: var(--text-main);
  margin-bottom: 4px;
}
.glossary-list .small { font-size: 0.9rem; color: var(--text-sub); }

/* Footer */
footer {
  margin-top: 60px; padding-top: 40px; border-top: 1px solid var(--border);
  text-align: center; color: var(--text-light); font-size: 0.85rem;
}
.footer-links {
  display: flex; gap: 24px; justify-content: center; margin-bottom: 20px;
}
.footer-links a { color: var(--text-sub); font-weight: 500; }

/* Mobile Tweaks */
@media (max-width: 480px) {
  .card { padding: 24px 20px; border-radius: 20px; }
  .article-content h1 { font-size: 1.5rem; }
  .article-content h2 { font-size: 1.25rem; }
  .kpi-value { font-size: 1.5rem; }
  .header-inner { padding: 0 16px; }
}