/* ========================================================================
   Sakaguchi Lab — Kobe University
   Design System v1.0 — 2026-04-25
   Style: minimal academic + modern translational
   Inspired by: Janelia/HHMI labs, Boyden lab (synthetic neurobiology),
                JFLab (memory/engram), with Japanese academic gravitas
   ======================================================================== */

/* -- Reset & base ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; }

/* -- Design tokens ----------------------------------------------------- */
:root {
  /* palette: Sleep × Memory × Translation
     - midnight = deep sleep / NREM / scientific gravitas
     - amber    = dawn / awakening / clinical warmth
     - teal     = REM / dream / analytical precision
     - parchment = paper / Japanese gentle background
     v1.1: contrast-corrected for WCAG 2.2 AA on white background.
     -*-soft variants retain original lighter hues for decorative use only.
  */
  --midnight: #0b1d3a;
  --midnight-soft: #15294b;
  --amber: #b37722;       /* contrast vs #fff: 4.5:1 (AA) */
  --amber-soft: #d99a3c;  /* legacy decorative only */
  --teal: #1d5c5c;        /* contrast vs #fff: 6.3:1 (AA) */
  --teal-soft: #5fb1b0;
  --parchment: #f8f6f0;
  --parchment-warm: #faf7ef;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-mute: #6a6a6a;
  --rule: #e2ddd2;
  --bg: #ffffff;

  --link: var(--teal);
  --link-hover: var(--midnight);

  --font-sans: "Inter", "Helvetica Neue", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  --font-serif: "Source Serif Pro", "Crimson Pro", "Hiragino Mincho Pro", "Yu Mincho", serif;
  --font-mono: "JetBrains Mono", "Menlo", monospace;

  --max-w: 1200px;
  --max-w-text: 720px;
  --pad-x: clamp(1rem, 4vw, 2.5rem);
  --pad-y: clamp(2rem, 6vh, 4.5rem);

  --radius: 6px;
  --shadow: 0 1px 3px rgba(11, 29, 58, 0.06), 0 4px 16px rgba(11, 29, 58, 0.04);
  --shadow-hover: 0 2px 8px rgba(11, 29, 58, 0.10), 0 8px 28px rgba(11, 29, 58, 0.08);
}

/* -- Typography -------------------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--midnight); line-height: 1.25; margin: 0 0 0.6em; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); margin-top: 2em; }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); margin-top: 1.6em; }
p { margin: 0 0 1.2em; max-width: var(--max-w-text); }
.lead { font-size: 1.15rem; color: var(--ink-soft); }
small, .small { font-size: 0.875rem; color: var(--ink-mute); }

/* -- Layout primitives ------------------------------------------------- */
.container { max-width: var(--max-w); margin: 0 auto; padding-left: var(--pad-x); padding-right: var(--pad-x); }
.section { padding-top: var(--pad-y); padding-bottom: var(--pad-y); }
.section-tight { padding-top: clamp(1.5rem, 3vh, 2.5rem); padding-bottom: clamp(1.5rem, 3vh, 2.5rem); }
.section-alt { background: var(--parchment-warm); }
.section-dark { background: var(--midnight); color: rgba(255,255,255,0.92); }
.section-dark h1, .section-dark h2, .section-dark h3 { color: #fff; }
.section-dark a { color: var(--amber-soft); }
.divider { width: 60px; height: 3px; background: var(--amber); margin: 1.5em 0 2em; border: 0; }

/* -- Header & nav ------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.95);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem var(--pad-x); max-width: var(--max-w); margin: 0 auto; }
.brand { font-family: var(--font-serif); font-weight: 600; font-size: 1.05rem; color: var(--midnight); letter-spacing: -0.005em; line-height: 1.3; }
.brand small { display: block; font-family: var(--font-sans); font-weight: 400; font-size: 0.72rem; color: var(--ink-mute); letter-spacing: 0.04em; text-transform: uppercase; margin-top: 0.15rem; }
.brand a { color: inherit; text-decoration: none; }

.nav { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--ink); font-size: 0.92rem; padding: 0.4rem 0; border-bottom: 2px solid transparent; transition: border-color 0.15s, color 0.15s; }
.nav a:hover, .nav a.is-active { color: var(--midnight); border-bottom-color: var(--amber); text-decoration: none; }
.nav__lang { margin-left: 1rem; padding-left: 1rem; border-left: 1px solid var(--rule); font-size: 0.85rem; }

@media (max-width: 800px) {
  .nav { gap: 0.9rem; font-size: 0.85rem; }
  .site-header__inner { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0.7rem var(--pad-x); }
  .nav__lang { margin-left: 0; padding-left: 0; border-left: 0; }
}

/* -- Hero -------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: clamp(320px, 60vh, 540px);
  background: linear-gradient(135deg, var(--midnight) 0%, var(--midnight-soft) 100%);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.hero__video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0.32; z-index: -1;
}
.hero__inner {
  max-width: var(--max-w); margin: 0 auto;
  padding: clamp(3rem, 8vh, 5rem) var(--pad-x);
  display: flex; flex-direction: column; justify-content: center;
  min-height: clamp(320px, 60vh, 540px);
}
.hero h1 { color: #fff; font-size: clamp(1.9rem, 4.2vw, 3.4rem); max-width: 18ch; }
.hero__statement { font-family: var(--font-serif); font-size: clamp(1.05rem, 2vw, 1.4rem); font-style: italic; color: rgba(255,255,255,0.86); max-width: 46ch; margin: 0.8em 0 0; }
.hero__meta { margin-top: 2rem; font-size: 0.85rem; letter-spacing: 0.05em; color: rgba(255,255,255,0.7); text-transform: uppercase; }
.hero__meta strong { color: var(--amber-soft); font-weight: 500; }

/* -- Cards (research / clinical / etc.) ------------------------------- */
.cards { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 2rem; }
.card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.6rem 1.6rem 1.4rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--amber); }
.card__tag { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal); font-weight: 600; }
.card h3 { margin: 0.5em 0 0.4em; font-size: 1.2rem; }
.card p { font-size: 0.95rem; color: var(--ink-soft); margin-bottom: 1em; }
.card__more { margin-top: auto; font-size: 0.88rem; color: var(--midnight); font-weight: 500; }
.card__more::after { content: " →"; color: var(--amber); }

/* -- Research themes details ------------------------------------------ */
.theme {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 2.5rem;
  padding: 2.2rem 0;
  border-top: 1px solid var(--rule);
}
.theme:first-of-type { border-top: 0; }
.theme h3 { margin-top: 0; }
.theme__meta { font-size: 0.85rem; color: var(--ink-mute); margin-top: 1em; }
.theme__meta a { display: block; margin: 0.2em 0; }
@media (max-width: 720px) { .theme { grid-template-columns: 1fr; gap: 1.2rem; } }

/* -- Members grid ----------------------------------------------------- */
.members { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-top: 1.5rem; }
.member { text-align: left; }
.member__portrait {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--parchment), var(--rule));
  margin-bottom: 0.7rem;
  overflow: hidden;
  border: 2px solid var(--parchment-warm);
}
.member__portrait img { width: 100%; height: 100%; object-fit: cover; }
.member__name { font-family: var(--font-serif); font-weight: 600; font-size: 1.02rem; color: var(--midnight); }
.member__role { font-size: 0.82rem; color: var(--teal); margin-top: 0.15em; letter-spacing: 0.02em; }
.member__role.is-future { color: var(--ink-mute); font-style: italic; }
.member__links { font-size: 0.78rem; margin-top: 0.4em; }
.member__links a { margin-right: 0.6em; color: var(--ink-mute); }

.alumni-list { columns: 2; column-gap: 2rem; font-size: 0.92rem; color: var(--ink-soft); margin-top: 1rem; }
.alumni-list li { break-inside: avoid; padding: 0.2rem 0; }
@media (max-width: 600px) { .alumni-list { columns: 1; } }

/* -- Publications ----------------------------------------------------- */
.pub-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1.5rem 0 2rem; align-items: center; }
.pub-filters__label { font-size: 0.85rem; color: var(--ink-mute); letter-spacing: 0.05em; text-transform: uppercase; margin-right: 0.4rem; }
.pub-filter {
  border: 1px solid var(--rule); background: transparent;
  padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.85rem;
  color: var(--ink-soft); transition: all 0.15s;
}
.pub-filter:hover { border-color: var(--amber); color: var(--midnight); }
.pub-filter.is-active { background: var(--midnight); color: #fff; border-color: var(--midnight); }

.pub-list { list-style: none; padding: 0; margin: 0; }
.pub {
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}
.pub:first-child { border-top: 0; }
.pub__year { display: inline-block; font-family: var(--font-mono); font-size: 0.78rem; color: var(--teal); margin-right: 0.6rem; vertical-align: top; padding-top: 0.15em; }
.pub__authors { color: var(--ink); }
.pub__authors strong { color: var(--midnight); font-weight: 600; }
.pub__title { display: block; margin: 0.35em 0; font-family: var(--font-serif); font-size: 1.05rem; color: var(--midnight); }
.pub__journal { color: var(--ink-soft); font-style: italic; }
.pub__tag {
  display: inline-block;
  font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.1rem 0.5rem; border-radius: 3px;
  margin-left: 0.6rem; vertical-align: middle;
}
.pub__tag--preprint { background: var(--amber-soft); color: var(--midnight); }
.pub__tag--peer { background: var(--teal-soft); color: #fff; }

/* -- News timeline ---------------------------------------------------- */
.news-list { list-style: none; padding: 0; margin: 0; }
.news-item {
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.5rem;
  align-items: baseline;
}
.news-item:first-child { border-top: 0; }
.news-item__date { font-family: var(--font-mono); font-size: 0.82rem; color: var(--teal); letter-spacing: 0.02em; }
.news-item h3 { margin: 0 0 0.3em; font-size: 1.1rem; }
.news-item p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
@media (max-width: 600px) { .news-item { grid-template-columns: 1fr; gap: 0.4rem; } }

/* -- Footer ----------------------------------------------------------- */
.site-footer {
  background: var(--midnight);
  color: rgba(255,255,255,0.78);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  font-size: 0.9rem;
}
.site-footer h4 { color: #fff; font-size: 0.95rem; letter-spacing: 0.05em; text-transform: uppercase; margin: 0 0 0.6rem; font-family: var(--font-sans); font-weight: 500; }
.site-footer a { color: var(--amber-soft); }
.site-footer__inner { display: grid; gap: 2rem; grid-template-columns: 1.4fr 1fr 1fr; }
.site-footer__bottom { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.12); font-size: 0.82rem; color: rgba(255,255,255,0.6); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.site-footer__brand-en { font-family: var(--font-serif); font-size: 1.05rem; color: #fff; }
.site-footer__brand-ja { font-size: 0.85rem; color: rgba(255,255,255,0.7); margin-top: 0.3rem; }
@media (max-width: 700px) { .site-footer__inner { grid-template-columns: 1fr; } }

/* -- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.92rem; font-weight: 500;
  background: var(--midnight); color: #fff;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  border: 0;
}
.btn:hover { background: var(--midnight-soft); color: #fff; text-decoration: none; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--midnight); border: 1px solid var(--midnight); }
.btn--ghost:hover { background: var(--midnight); color: #fff; }
.btn--accent { background: var(--amber); color: var(--midnight); }
.btn--accent:hover { background: var(--amber-soft); color: var(--midnight); }

/* -- Notice / disclaimer (used on /clinical/) ------------------------- */
.notice {
  background: var(--parchment);
  border-left: 4px solid var(--amber);
  padding: 1.2rem 1.4rem;
  margin: 1.5rem 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notice strong { color: var(--midnight); }

/* -- Utility ---------------------------------------------------------- */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: #fff; padding: 0.5rem 1rem; z-index: 100; border: 2px solid var(--midnight); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* -- Print ------------------------------------------------------------ */
@media print {
  .site-header, .site-footer, .nav, .hero__video { display: none; }
  body { color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}
