:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --text: #15202b;
  --muted: #607080;
  --line: #dce3ea;
  --accent: #2457d6;
  --accent-dark: #173d9a;
  --shadow: 0 18px 50px rgba(24, 39, 75, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.7;
}

a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-width,
.header-inner,
.hero-inner {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(220, 227, 234, 0.85);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 5px 14px rgba(24, 39, 75, 0.08);
}

.brand-mark:focus-visible,
.search input:focus-visible,
.search button:focus-visible,
a:focus-visible,
.dialog-close:focus-visible,
.secondary-button:focus-visible {
  outline: 3px solid rgba(36, 87, 214, 0.3);
  outline-offset: 3px;
}

.brand-mark svg { width: 100%; height: 100%; padding: 9px; }
.brand-mark .screen { fill: none; stroke: currentColor; stroke-width: 2.4; rx: 3; }
.brand-mark .code { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-size: 1.08rem; letter-spacing: .01em; }
.brand small { display: block; margin-top: -4px; color: var(--muted); font-size: .72rem; }

nav { display: flex; gap: 28px; }
nav a { color: var(--muted); font-size: .92rem; font-weight: 650; text-decoration: none; }
nav a:hover { color: var(--accent); }

.hero {
  position: relative;
  overflow: hidden;
  padding: 104px 0 88px;
  background:
    radial-gradient(circle at 82% 18%, rgba(36, 87, 214, 0.16), transparent 31%),
    linear-gradient(145deg, #f9fbff 0%, #eef3f9 100%);
  border-bottom: 1px solid var(--line);
}

.hero::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -240px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(36, 87, 214, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(36, 87, 214, .035), 0 0 0 110px rgba(36, 87, 214, .025);
}

.hero-inner { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: .74rem; font-weight: 800; letter-spacing: .16em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 800px; margin-bottom: 22px; font-size: clamp(2.45rem, 6vw, 4.8rem); line-height: 1.12; letter-spacing: -.055em; }
h2 { margin-bottom: 0; font-size: clamp(1.7rem, 3vw, 2.45rem); letter-spacing: -.035em; }
.hero-copy { max-width: 720px; margin-bottom: 34px; color: var(--muted); font-size: 1.05rem; }

.search {
  display: flex;
  width: min(690px, 100%);
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.search input { min-width: 0; flex: 1; padding: 12px 14px; border: 0; color: var(--text); background: transparent; outline: none; }
.search button,
.primary-button {
  border: 0;
  border-radius: 11px;
  padding: 12px 22px;
  color: white;
  background: var(--accent);
  font-weight: 750;
  text-decoration: none;
}
.search button:hover,
.primary-button:hover { background: var(--accent-dark); }
.search-status { min-height: 1.7em; margin: 9px 0 0; color: var(--muted); font-size: .88rem; }

.section { padding-block: 78px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.result-count { color: var(--muted); font-size: .88rem; }
.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.article-card {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(24, 39, 75, .045);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.article-card:hover { transform: translateY(-4px); border-color: #c7d3df; box-shadow: var(--shadow); }
.card-meta { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 25px; color: var(--muted); font-size: .76rem; }
.card-meta span { color: var(--accent); font-weight: 750; }
.article-card h3 { margin-bottom: 13px; font-size: 1.18rem; line-height: 1.45; letter-spacing: -.018em; }
.article-card p { color: var(--muted); font-size: .92rem; }
.article-card a { margin-top: auto; color: var(--accent); font-size: .88rem; font-weight: 750; text-decoration: none; }
.article-card[hidden] { display: none; }

.empty-state { padding: 54px; border: 1px dashed #c7d3df; border-radius: var(--radius); text-align: center; background: var(--surface); }
.empty-state p { margin-bottom: 0; color: var(--muted); }
.alt-section { border-block: 1px solid var(--line); background: var(--surface); }
.category-layout { display: grid; grid-template-columns: .85fr 1.15fr; align-items: center; gap: 80px; }
.category-layout > div:first-child > p:last-child { margin-top: 18px; margin-bottom: 0; color: var(--muted); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.tag-cloud span { padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: .88rem; font-weight: 650; }
.about { display: grid; grid-template-columns: .7fr 1.3fr; gap: 80px; }
.about > p { margin-bottom: 0; color: var(--muted); }

footer { border-top: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.footer-inner { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: .8rem; }

.lab-dialog {
  width: min(520px, calc(100% - 34px));
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(15, 25, 45, .28);
}
.lab-dialog::backdrop { background: rgba(8, 16, 28, .58); backdrop-filter: blur(5px); }
.lab-dialog h2 { margin-bottom: 12px; }
.lab-dialog > p:not(.eyebrow) { color: var(--muted); }
.dialog-close { position: absolute; top: 14px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: var(--surface-2); font-size: 1.25rem; }
.dialog-actions { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.secondary-button { padding: 11px 19px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: var(--surface); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translateX(-50%); padding: 11px 17px; border-radius: 999px; color: white; background: #172235; box-shadow: var(--shadow); font-size: .85rem; }

@media (max-width: 850px) {
  nav { display: none; }
  .hero { padding: 78px 0 65px; }
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-layout, .about { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 560px) {
  .page-width, .header-inner, .hero-inner { width: min(100% - 28px, 1120px); }
  .header-inner { min-height: 68px; }
  .brand-mark { width: 40px; height: 40px; }
  .hero { padding-top: 62px; }
  h1 { font-size: 2.45rem; }
  .search { display: grid; grid-template-columns: 1fr; }
  .search button { width: 100%; }
  .section { padding-block: 58px; }
  .article-grid { grid-template-columns: 1fr; }
  .article-card { min-height: 270px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
  .primary-button, .secondary-button { text-align: center; }
}

html.lab-open,
html.lab-open body { overflow: hidden; }

.lab-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  background: #0d1420;
}

.lab-overlay[hidden] { display: none; }

.lab-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 18px;
  color: #eaf0f8;
  background: #111c2c;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.lab-toolbar > div,
.lab-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lab-toolbar small { color: #8fa1b8; }
.lab-status-dot { width: 9px; height: 9px; border-radius: 50%; background: #43d17d; box-shadow: 0 0 0 5px rgba(67, 209, 125, .12); }
.lab-toolbar-actions button { padding: 7px 13px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px; color: #eaf0f8; background: rgba(255, 255, 255, .06); }
.lab-toolbar-actions button:hover { background: rgba(255, 255, 255, .12); }
.lab-overlay iframe { width: 100%; height: 100%; border: 0; background: white; }

@media (max-width: 560px) {
  .lab-toolbar { padding-inline: 10px; }
  .lab-toolbar small { display: none; }
  .lab-toolbar-actions { gap: 6px; }
  .lab-toolbar-actions button { padding-inline: 9px; }
}
.brand-copy { text-decoration: none; }
