/* =========================================================
   AIトレーダー研究所 — site stylesheet
   Quant research-lab aesthetic. Dark ink + cyan/magenta data accents.
   ========================================================= */

:root {
  --ink:      #080b16;
  --ink-2:    #0c1124;
  --panel:    #111831;
  --panel-2:  #161f3d;
  --line:     rgba(146, 167, 214, 0.16);
  --line-2:   rgba(146, 167, 214, 0.28);
  --fg:       #e8ecf8;
  --fg-soft:  #c3cbe2;
  --muted:    #8b96b4;
  --muted-2:  #6b769a;
  --cyan:     #45d4ff;
  --cyan-dim: #2aa7d6;
  --blue:     #5b8cff;
  --magenta:  #ff5d8f;
  --green:    #34e5a8;
  --red:      #ff6175;
  --gold:     #ffce5c;
  --maxw:     1120px;
  --radius:   14px;
  --serif:    "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Shippori Mincho", serif;
  --sans:     "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:     "SFMono-Regular", "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--ink);
  color: var(--fg);
  line-height: 1.85;
  font-size: 16.5px;
  letter-spacing: .01em;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ambient background grid + glow */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(69,212,255,.14), transparent 60%),
    radial-gradient(760px 480px at 8% 8%, rgba(91,140,255,.10), transparent 60%),
    radial-gradient(680px 520px at 92% 88%, rgba(255,93,143,.07), transparent 60%),
    var(--ink);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(146,167,214,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(146,167,214,.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.6), transparent 70%);
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #8be6ff; }

img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8, 11, 22, .72);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--maxw); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 13px 22px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand__mark {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: linear-gradient(150deg, var(--cyan), var(--blue) 60%, var(--magenta));
  position: relative; box-shadow: 0 0 22px rgba(69,212,255,.35);
}
.brand__mark::after {
  content: ""; position: absolute; inset: 6px;
  border-radius: 4px;
  background:
    linear-gradient(transparent 60%, rgba(8,11,22,.85) 60%) 0 0/100% 100%,
    repeating-linear-gradient(90deg, rgba(8,11,22,.9) 0 2px, transparent 2px 5px);
  -webkit-mask: linear-gradient(#000,#000); mask: linear-gradient(#000,#000);
}
.brand__name { font-weight: 700; letter-spacing: .04em; font-size: 15.5px; }
.brand__name small { display: block; font-size: 10px; letter-spacing: .34em; color: var(--cyan-dim); font-weight: 600; }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { color: var(--fg-soft); font-size: 13.5px; font-weight: 600; letter-spacing: .02em; }
.nav a:hover { color: var(--cyan); }
.nav__burger { display: none; }
@media (max-width: 760px) {
  .nav { display: none; }
}

/* ---------- Persistent disclaimer bar ---------- */
.disclaimer-bar { border-bottom: 1px solid var(--line); background: rgba(255,206,92,.045); }
.disclaimer-bar .container { padding-block: 11px; }
.disclaimer-bar p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.disclaimer-bar strong { color: var(--gold); }
.sim-note { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin: 12px 2px 0; letter-spacing: .02em; }

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero__bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center;
  opacity: .55;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(8,11,22,.45) 0%, rgba(8,11,22,.78) 55%, var(--ink) 100%);
}
.hero__inner { max-width: var(--maxw); margin-inline: auto; padding: 92px 22px 84px; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .18em;
  color: var(--cyan); text-transform: uppercase;
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 6px 14px; background: rgba(69,212,255,.06);
}
.hero__eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 5.4vw, 56px);
  line-height: 1.28; margin: 26px 0 0; font-weight: 700;
  letter-spacing: .01em;
}
.hero h1 .hl { color: transparent; background: linear-gradient(100deg, var(--cyan), var(--blue) 55%, var(--magenta)); -webkit-background-clip: text; background-clip: text; }
.hero__lead {
  margin: 22px 0 0; max-width: 660px;
  font-size: clamp(15px, 2vw, 18px); color: var(--fg-soft); line-height: 1.95;
}
.hero__cta { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 14.5px; letter-spacing: .02em;
  padding: 13px 24px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn--primary { background: linear-gradient(100deg, var(--cyan), var(--blue)); color: #04111e; box-shadow: 0 10px 30px rgba(69,212,255,.28); }
.btn--primary:hover { transform: translateY(-2px); color: #04111e; box-shadow: 0 14px 38px rgba(69,212,255,.42); }
.btn--ghost { border-color: var(--line-2); color: var(--fg); background: rgba(255,255,255,.02); }
.btn--ghost:hover { border-color: var(--cyan); color: var(--cyan); }

/* hero metric strip */
.hero__stats {
  margin-top: 52px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.hero__stats .stat { background: rgba(12,17,36,.78); padding: 20px 18px; }
.stat__num { font-family: var(--mono); font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; color: var(--fg); letter-spacing: -.01em; }
.stat__num.pos { color: var(--green); }
.stat__num.neg { color: var(--red); }
.stat__num.cy { color: var(--cyan); }
.stat__label { margin-top: 6px; font-size: 12px; color: var(--muted); letter-spacing: .04em; }
@media (max-width: 680px) { .hero__stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Section scaffolding ---------- */
.section { padding: 78px 0; }
.section--tight { padding: 54px 0; }
.section-head { max-width: 720px; margin-bottom: 40px; }
.section-tag {
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--cyan); display: inline-block; margin-bottom: 14px;
}
.section-head h2 {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(24px, 3.6vw, 34px); line-height: 1.4; margin: 0;
}
.section-head p { color: var(--fg-soft); margin: 16px 0 0; font-size: 15.5px; }

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Thesis / callout ---------- */
.thesis {
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(69,212,255,.06), rgba(69,212,255,0) 40%),
    var(--panel);
  padding: 30px 30px 28px; position: relative;
}
.thesis::before {
  content: ""; position: absolute; left: 0; top: 22px; bottom: 22px; width: 3px; border-radius: 3px;
  background: linear-gradient(var(--cyan), var(--magenta));
}
.thesis__kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; color: var(--cyan); text-transform: uppercase; }
.thesis p { font-family: var(--serif); font-size: clamp(18px, 2.6vw, 23px); line-height: 1.7; margin: 12px 0 0; color: #f3f6ff; }
.thesis .src { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ---------- Timeline (journey) ---------- */
.timeline { display: grid; gap: 0; position: relative; }
.tl {
  display: grid; grid-template-columns: 132px 1fr; gap: 26px;
  padding: 26px 0; border-top: 1px solid var(--line);
}
.tl:last-child { border-bottom: 1px solid var(--line); }
.tl__phase { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: var(--cyan); padding-top: 4px; }
.tl__phase .big { display: block; font-family: var(--serif); font-size: 30px; color: var(--fg); letter-spacing: 0; margin-top: 4px; }
.tl__body h3 { margin: 0 0 8px; font-size: 19px; font-family: var(--serif); }
.tl__body p { margin: 0; color: var(--fg-soft); font-size: 15px; }
.tl__body .verdict { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 12px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line-2); }
.verdict.no { color: var(--red); border-color: rgba(255,97,117,.4); background: rgba(255,97,117,.08); }
.verdict.ok { color: var(--green); border-color: rgba(52,229,168,.4); background: rgba(52,229,168,.08); }
.verdict.mid { color: var(--gold); border-color: rgba(255,206,92,.4); background: rgba(255,206,92,.08); }
@media (max-width: 620px) { .tl { grid-template-columns: 1fr; gap: 10px; } .tl__phase .big { display: inline; margin-left: 8px; } }

/* ---------- Article cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  padding: 26px 24px; position: relative; overflow: hidden;
  transition: transform .18s ease, border-color .2s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: 0 18px 44px rgba(0,0,0,.45); }
.card::after {
  content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent); opacity: .0; transition: opacity .2s;
}
.card:hover::after { opacity: 1; }
.card__no { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: var(--cyan); }
.card__tag { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }
.card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card h3 { font-family: var(--serif); font-size: 19.5px; line-height: 1.5; margin: 0 0 10px; color: var(--fg); }
.card p { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }
.card__more { margin-top: 18px; font-family: var(--mono); font-size: 12.5px; color: var(--cyan); display: inline-flex; align-items: center; gap: 7px; }
.card:hover .card__more { gap: 11px; }

/* ---------- Data tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 460px; }
table.data th, table.data td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
table.data thead th { background: rgba(12,17,36,.9); color: var(--cyan); font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
table.data tbody tr:hover { background: rgba(69,212,255,.04); }
table.data td.num, table.data th.num { font-family: var(--mono); text-align: right; }
table.data tr.is-pick td { background: rgba(52,229,168,.07); }
table.data tr.is-pick td:first-child { box-shadow: inset 3px 0 0 var(--green); font-weight: 700; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.t-cap { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 10px 2px 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 40px; margin-top: 40px; background: var(--ink-2); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; }
.site-footer h4 { font-size: 13px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin: 0 0 16px; font-family: var(--mono); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.site-footer ul a { color: var(--fg-soft); font-size: 14px; }
.site-footer ul a:hover { color: var(--cyan); }
.footer-about p { color: var(--muted); font-size: 13.5px; margin: 14px 0 0; max-width: 360px; line-height: 1.8; }
.footer-bottom { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Author card ---------- */
.author { display: grid; grid-template-columns: 132px 1fr; gap: 28px; align-items: start;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; background: var(--panel); }
.author__img { width: 132px; height: 132px; border-radius: 16px; object-fit: cover; border: 1px solid var(--line-2); }
.author__name { font-family: var(--serif); font-size: 22px; margin: 0; }
.author__role { font-family: var(--mono); font-size: 12px; color: var(--cyan); letter-spacing: .08em; margin: 6px 0 14px; }
.author__bio { color: var(--fg-soft); font-size: 14px; line-height: 1.9; margin: 0; }
@media (max-width: 560px) { .author { grid-template-columns: 1fr; } }

/* ---------- Disclaimer ---------- */
.disclaimer { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 22px 24px; background: rgba(255,206,92,.04); }
.disclaimer h4, .disclaimer h2 { margin: 0 0 8px; color: var(--gold); font-size: 14px; font-family: var(--mono); letter-spacing: .06em; font-weight: 700; }
.disclaimer p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.85; }

/* =========================================================
   Article pages
   ========================================================= */
.article-hero { border-bottom: 1px solid var(--line); padding: 64px 0 44px; position: relative; }
.breadcrumb { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; margin-bottom: 22px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--cyan); }
.article-hero .kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; color: var(--cyan); text-transform: uppercase; }
.article-hero h1 { font-family: var(--serif); font-size: clamp(26px, 4.4vw, 42px); line-height: 1.42; margin: 16px 0 0; max-width: 880px; }
.article-meta { display: flex; gap: 18px; align-items: center; margin-top: 22px; font-size: 13px; color: var(--muted); font-family: var(--mono); flex-wrap: wrap; }
.article-meta img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.article-meta span { display: inline-flex; align-items: center; gap: 8px; }

.article-body { max-width: 760px; margin-inline: auto; padding: 50px 22px 30px; }
.article-body > * { margin-inline: auto; }
.article-body h2 { font-family: var(--serif); font-size: clamp(22px, 3.2vw, 28px); margin: 52px 0 18px; line-height: 1.5; padding-top: 10px; border-top: 1px solid var(--line); }
.article-body h2:first-of-type { border-top: 0; padding-top: 0; }
.article-body h3 { font-family: var(--serif); font-size: 19px; margin: 34px 0 12px; color: var(--cyan); }
.article-body p { color: var(--fg-soft); margin: 0 0 20px; }
.article-body strong { color: #fff; font-weight: 700; }
.article-body ul, .article-body ol { color: var(--fg-soft); padding-left: 1.3em; margin: 0 0 22px; }
.article-body li { margin-bottom: 10px; }
.article-body em { color: var(--cyan); font-style: normal; border-bottom: 1px dashed var(--cyan-dim); }
.article-body .table-wrap, .article-body .tldr, .article-body .note, .article-body figure { margin-block: 28px; }
.article-body figure { margin-inline: 0; }
.article-body figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 10px; }

/* TL;DR box — AI-overview friendly summary */
.tldr {
  border: 1px solid var(--line-2); border-left: 3px solid var(--cyan);
  border-radius: 12px; background: var(--panel); padding: 22px 24px;
}
.tldr h2, .tldr h3 { border: 0; margin: 0 0 12px; padding: 0; font-size: 14px; font-family: var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--cyan); }
.tldr ul { margin: 0; padding-left: 1.2em; }
.tldr li { color: var(--fg); font-size: 15px; margin-bottom: 9px; }

.note { border: 1px solid var(--line); border-radius: 12px; background: rgba(255,93,143,.05); border-left: 3px solid var(--magenta); padding: 18px 22px; }
.note p { margin: 0; font-size: 14px; color: var(--fg-soft); }
.note strong { color: var(--magenta); }

.keyfig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.keyfig .kf { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 18px; text-align: center; }
.keyfig .kf b { display: block; font-family: var(--mono); font-size: 26px; color: var(--fg); }
.keyfig .kf b.pos { color: var(--green); } .keyfig .kf b.neg { color: var(--red); } .keyfig .kf b.cy { color: var(--cyan); }
.keyfig .kf span { font-size: 12px; color: var(--muted); }
@media (max-width: 540px) { .keyfig { grid-template-columns: 1fr 1fr; } }

/* FAQ */
.faq { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; padding: 18px 22px; font-weight: 700; font-size: 15.5px; list-style: none; display: flex; justify-content: space-between; gap: 14px; color: var(--fg); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--cyan); font-family: var(--mono); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq .faq-a { padding: 0 22px 20px; color: var(--fg-soft); font-size: 14.5px; }
.faq .faq-a p { margin: 0; }

/* prev/next + related */
.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 50px; }
.article-nav a { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; background: var(--panel); transition: border-color .2s; }
.article-nav a:hover { border-color: var(--cyan); }
.article-nav .dir { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.article-nav .ttl { display: block; color: var(--fg); font-size: 14.5px; margin-top: 8px; line-height: 1.5; }
.article-nav a.next { text-align: right; }
@media (max-width: 560px) { .article-nav { grid-template-columns: 1fr; } .article-nav a.next { text-align: left; } }

/* architecture flow (for the AWS article) */
.arch { display: grid; gap: 12px; margin: 26px 0; }
.arch__row { display: flex; align-items: flex-start; gap: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 16px 18px; }
.arch__row .n { font-family: var(--mono); color: var(--cyan); font-size: 13px; flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 9px; }
.arch__row .b { display: block; font-size: 15.5px; color: var(--fg); font-weight: 700; margin-bottom: 3px; }
.arch__row .b small { font-family: var(--mono); font-weight: 400; color: var(--cyan-dim); font-size: 12px; margin-left: 8px; letter-spacing: .02em; }
.arch__row p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.75; }
.arch__flow { text-align: center; color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; margin: -4px 0; }

/* misc utilities */
.center { text-align: center; }
.mt0 { margin-top: 0; }
.lede { font-size: 18px; color: var(--fg-soft); font-family: var(--serif); line-height: 1.9; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.pill { font-family: var(--mono); font-size: 11.5px; color: var(--fg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.toc { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 20px 24px; }
.toc h4 { margin: 0 0 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.toc ol { margin: 0; padding-left: 1.3em; color: var(--fg-soft); }
.toc li { margin-bottom: 8px; }
