/* OlfaDrone project page — palette and type follow the FIP Lab site (fip.ics.saitama-u.ac.jp) */

:root {
  --green: #177245;
  --green-deep: #0e5532;
  --green-tint: #e6f0ea;
  --citrus: #e2b42a;
  --wind: #3d6a8c;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --band: #efede8;
  --ink: #161a17;
  --ink-2: #39403b;
  --muted: #5d655f;
  --line: #dedbd4;
  --code-bg: #1d2420;
  --code-ink: #e8efe9;
  --shadow: 0 1px 2px rgba(20, 30, 24, .06), 0 8px 24px rgba(20, 30, 24, .06);
  --footer-bg: #e8f1ec; /* 90% white, 10% lab green */

  --font-head: "Google Sans Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: Arimo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --wrap: 1040px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 14px;
  --nav-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #3fb27a;
    --green-deep: #0d3f27;
    --green-tint: #17271f;
    --citrus: #e9c04a;
    --wind: #78a6c9;
    --bg: #111513;
    --surface: #181d1a;
    --band: #151a17;
    --ink: #e9ede9;
    --ink-2: #c8cfc9;
    --muted: #97a19a;
    --line: #2a322d;
    --code-bg: #0b0e0c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --footer-bg: #18211c;
  }
}
:root[data-theme="dark"] {
  --green: #3fb27a; --green-deep: #0d3f27; --green-tint: #17271f; --citrus: #e9c04a; --wind: #78a6c9;
  --bg: #111513; --surface: #181d1a; --band: #151a17; --ink: #e9ede9; --ink-2: #c8cfc9; --muted: #97a19a;
  --line: #2a322d; --code-bg: #0b0e0c; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --footer-bg: #18211c;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 clamp(15.5px, .3vw + 14.5px, 17px)/1.7 var(--font-body);
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: var(--green); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
strong, b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding-block: clamp(48px, 7vw, 88px); }
.band { background: var(--band); border-block: 1px solid var(--line); }
.muted { color: var(--muted); }
.small { font-size: .9em; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter);
  min-height: var(--nav-h); display: flex; align-items: center; justify-content: flex-end;
}
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; padding: 6px 10px; border-radius: 999px; color: var(--ink-2);
  text-decoration: none; font: 500 13.5px/1.2 var(--font-head); transition: background .2s, color .2s;
}
.nav a:hover { background: var(--green-tint); color: var(--green); }
.nav a.is-active { background: var(--green); color: #fff; }

@media (max-width: 860px) {
  .topbar__inner { justify-content: flex-start; }
  .nav { margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  :root { --nav-h: 52px; }
}

/* ---------- Hero ---------- */
.hero { color: var(--ink); }
.hero__inner { padding-block: clamp(48px, 8vw, 96px) clamp(32px, 4vw, 48px); }
.eyebrow { margin: 0 0 18px; font: 700 12px/1.6 var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--green); }
.hero__title { margin: 0; font-family: var(--font-head); font-weight: 500; letter-spacing: -.01em; color: var(--green); }
.hero__name { display: inline; font-size: clamp(44px, 8vw, 84px); line-height: 1; letter-spacing: -.025em; }
.hero__colon { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hero__subtitle { display: block; max-width: 22em; margin-top: 18px; font-size: clamp(20px, 2.6vw, 30px); line-height: 1.3; font-weight: 400; color: var(--ink); }
.authors { list-style: none; padding: 0; margin: 32px 0 4px; display: flex; flex-wrap: wrap; gap: 4px 0; font: 500 clamp(16px, 1.6vw, 18px)/1.5 var(--font-head); }
.authors li:not(:last-child)::after { content: "·"; margin: 0 .6em; opacity: .6; }
.authors a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--green) 55%, transparent); }
.authors a:hover { color: var(--green); }
.affil { margin: 0; color: var(--muted); font-size: 15px; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 9px 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none; font: 500 15px/1 var(--font-head); cursor: pointer;
  transition: background .2s, transform .2s, border-color .2s;
}
.btn:hover { background: var(--green-tint); border-color: var(--green); transform: translateY(-1px); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn--solid { background: var(--green); color: #fff; border-color: var(--green); }
.btn--solid:hover { background: var(--green-deep); border-color: var(--green-deep); }
.btn--small { min-height: 34px; padding: 6px 14px; font-size: 14px; color: var(--green); border-color: var(--line); background: var(--surface); }
.btn--small:hover { background: var(--green-tint); }

/* ---------- Teaser / media ---------- */
.teaser { position: relative; }
.media { margin: 0; position: relative; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.media video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.media__toggle {
  position: absolute; right: 12px; bottom: 12px; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .5); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.media__toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.media__toggle .i-play { display: none; fill: currentColor; }
.media__toggle.is-paused .i-play { display: block; }
.media__toggle.is-paused .i-pause { display: none; }

.tldr {
  margin: 28px 0 0; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--green); border-radius: 10px; font-size: 1.05em; line-height: 1.65;
}
.tldr__tag { display: inline-block; margin-right: 8px; padding: 2px 8px; border-radius: 6px; background: var(--green); color: #fff; font: 700 12px/1.6 var(--font-head); letter-spacing: .06em; vertical-align: 2px; }

/* ---------- Type ---------- */
.h2 { margin: 0 0 20px; font: 500 clamp(26px, 3.2vw, 36px)/1.2 var(--font-head); color: var(--green); letter-spacing: -.01em; }
.h3 { margin: 32px 0 12px; font: 500 clamp(18px, 1.8vw, 21px)/1.3 var(--font-head); color: var(--ink); }
.kicker { margin: 0 0 8px; font: 700 12px/1.6 var(--font-head); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lead { margin: 0; color: var(--ink-2); }
.section > p { color: var(--ink-2); }
/* Body text runs the full column width, justified */
.section p, .section li, .fig figcaption, .tldr { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.note { color: var(--muted); font-size: .94em; }

/* ---------- Figures ---------- */
.fig { margin: 32px 0; }
.fig img { width: 100%; border-radius: 10px; background: #fff; border: 1px solid var(--line); padding: clamp(8px, 2vw, 20px); }
.fig figcaption { margin-top: 12px; color: var(--muted); font-size: .9em; line-height: 1.6; }
.fig figcaption b { color: var(--ink); }
.fig--flush { margin: 0; }

.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: start; margin-top: 16px; }
.split--reverse { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split .h3:first-child { margin-top: 0; }
@media (max-width: 800px) { .split, .split--reverse { grid-template-columns: 1fr; } }

.specs { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.specs div { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.specs dt { font: 700 11px/1.4 var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.specs dd { margin: 4px 0 0; font: 500 15px/1.4 var(--font-head); }
.specs .muted { font-weight: 400; font-size: 13px; }
@media (max-width: 380px) { .specs { grid-template-columns: 1fr; } }

/* ---------- Explorer (Table 1) ---------- */
.explorer {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px;
  padding: clamp(14px, 2.5vw, 24px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.heat__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font: 500 16px/1.3 var(--font-head); flex-wrap: wrap; }
.heat__hint { margin-left: auto; font: 400 12.5px/1.3 var(--font-body); color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot--odor { background: var(--green); }
.dot--wind { background: var(--wind); }
.heat__grid { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 6px; }
.heat__axis { display: grid; place-items: center; font: 500 12px/1.2 var(--font-head); color: var(--muted); padding: 2px 6px; text-align: center; }
.heat__corner { font-size: 10.5px; line-height: 1.25; text-align: left; place-items: end start; }
.cell {
  position: relative; aspect-ratio: 4 / 3; min-height: 54px; border: 0; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; font: 600 clamp(14px, 1.8vw, 18px)/1 var(--font-head);
  color: var(--ink); transition: transform .15s, box-shadow .15s;
  font-variant-numeric: tabular-nums;
}
.cell.is-dark { color: #fff; }
.cell.is-reco::after { content: ""; position: absolute; inset: 3px; border: 2px dashed var(--citrus); border-radius: 6px; pointer-events: none; }
.cell:hover, .cell.is-active { transform: scale(1.04); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); z-index: 1; }
.readout {
  grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr 1fr; gap: 6px 16px; align-items: center;
  padding: 12px 14px; border-radius: 10px; background: var(--band); font-size: 14px; min-height: 64px;
}
.readout__cond { font: 600 15px/1.3 var(--font-head); grid-row: span 2; padding-right: 8px; border-right: 1px solid var(--line); }
.readout__cond small { display: block; font: 400 12px/1.4 var(--font-body); color: var(--muted); }
.readout__m { display: flex; gap: 8px; align-items: baseline; }
.readout__m b { font: 600 18px/1 var(--font-head); font-variant-numeric: tabular-nums; }
.readout__ci { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 420px) {
  .cell { min-height: 0; }
  .heat__grid { gap: 4px; }
  .heat__axis { padding: 2px 3px; font-size: 11px; }
}
@media (max-width: 680px) {
  .explorer { grid-template-columns: minmax(0, 1fr); }
  .readout { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .readout__m { flex-wrap: wrap; row-gap: 2px; }
  .readout__cond { grid-column: 1 / -1; grid-row: auto; border-right: 0; padding: 0 0 6px; border-bottom: 1px solid var(--line); }
}

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
@media (max-width: 680px) { .stats { grid-template-columns: 1fr; } }
.stat { padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat__label { margin: 0; color: var(--muted); font: 500 14px/1.4 var(--font-head); }
.stat__label b { color: var(--green); }
.stat:nth-child(2) .stat__label b { color: var(--wind); }
.stat__big { margin: 8px 0 6px; font: 500 clamp(30px, 4vw, 40px)/1.1 var(--font-head); font-variant-numeric: tabular-nums; }
.stat__big span { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat__body { margin: 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }

.disclosure { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.disclosure summary { cursor: pointer; padding: 12px 16px; font: 500 14.5px/1.4 var(--font-head); color: var(--green); list-style-position: inside; }
.disclosure[open] summary { border-bottom: 1px solid var(--line); }
.disclosure .fig { padding: 16px; }
.disclosure + .disclosure { margin-top: 10px; }
.table-wrap { overflow-x: auto; padding: 4px 16px 16px; }
.data { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.data caption { caption-side: top; text-align: left; padding: 12px 0 10px; color: var(--muted); font-size: 13.5px; }
.data th { text-align: left; font: 600 12.5px/1.3 var(--font-head); color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data tr.is-reco td { background: color-mix(in srgb, var(--citrus) 14%, transparent); }
.disclosure .fig img { border: 0; padding: 0; }

/* ---------- Experiment 2 bars ---------- */
.bars { display: grid; gap: 14px; margin: 4px 0 18px; }
.bar__row { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; }
.bar__label { font: 500 14px/1.3 var(--font-head); }
.bar__label small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; font-variant-numeric: tabular-nums; }
.bar__label small b { color: var(--ink); font-weight: 600; }
.bar__track { position: relative; height: 34px; border-radius: 6px; background: var(--band); border: 1px solid var(--line); }
.bar__ci { position: absolute; top: 50%; height: 2px; background: var(--ink-2); transform: translateY(-50%); }
.bar__ci::before, .bar__ci::after { content: ""; position: absolute; top: -6px; width: 2px; height: 14px; background: var(--ink-2); }
.bar__ci::before { left: 0; } .bar__ci::after { right: 0; }
.bar__fill { position: absolute; inset: 4px auto 4px 0; border-radius: 4px; background: color-mix(in srgb, var(--green) 30%, transparent); border-right: 3px solid var(--green); transform-origin: left; transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.bar__scale { display: flex; justify-content: space-between; margin-left: 96px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars:not(.is-in) .bar__fill { transform: scaleX(0); }

/* ---------- Takeaways ---------- */
.principles { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .principles { grid-template-columns: 1fr; } }
.principles li { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--green); }
.principles span { font: 700 13px/1 var(--font-head); color: var(--green); letter-spacing: .08em; }
.principles h3 { margin: 10px 0 8px; font: 500 19px/1.3 var(--font-head); color: var(--ink); }
.principles p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.reco {
  display: grid; grid-template-columns: auto auto 1fr; gap: 16px 36px; align-items: center; margin-top: 24px;
  padding: 24px clamp(18px, 3vw, 32px); border-radius: var(--radius); background: var(--green-tint);
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); color: var(--ink);
}
.reco__label { margin: 0; font: 700 11.5px/1.4 var(--font-head); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.reco__val { margin: 2px 0 0; font: 500 clamp(30px, 4vw, 42px)/1.1 var(--font-head); color: var(--green); white-space: nowrap; }
.reco__why { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
@media (max-width: 760px) { .reco { grid-template-columns: 1fr 1fr; } .reco__why { grid-column: 1 / -1; } }

.plain { padding-left: 0; list-style-position: inside; color: var(--ink-2); }
.plain li { margin-bottom: 8px; }
.plain li::marker { color: var(--green); }

/* ---------- BibTeX ---------- */
.bib__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.bib__head .h2 { margin: 0; }
.bib { margin: 0 0 20px; padding: 20px 22px; border-radius: var(--radius); background: var(--code-bg); color: var(--code-ink); overflow-x: auto; font: 13.5px/1.65 var(--font-mono); }

/* ---------- Footer ---------- */
.footer { background: var(--footer-bg); color: var(--ink-2); border-top: 1px solid var(--line); padding-block: 40px 20px; font-size: 14.5px; }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px; }
.footer p { margin: 0; line-height: 1.7; opacity: .9; }
.footer__lab { font: 500 17px/1.4 var(--font-head); color: var(--green); opacity: 1 !important; margin-bottom: 6px !important; }
.footer__logo { display: block; transition: opacity .2s; }
.footer__logo:hover { opacity: .8; }
.footer__logo img { width: clamp(105px, 15.4vw, 140px); height: auto; }
.footer__fine { margin-top: 28px !important; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); opacity: 1 !important; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .bar__fill, .btn, .cell { transition: none; }
}

@media print {
  .topbar, .media__toggle, .btn { display: none; }
}
