/* ==========================================================================
   Koki Madono — personal site
   Theme v3: "Akishima Whale" — light blue, wide & dense
   ========================================================================== */

:root {
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #253746;
  --muted: #64798a;
  --line: #d9e9f6;
  --accent: #65b5ff;         /* light blue — year headings, tints */
  --accent-strong: #2e7fd0;  /* readable link blue */
  --chip-bg: #e8f3ff;

  --hero-a: #e7f4fe;         /* hero gradient top — pale blue sky */
  --hero-b: #c4e4f9;         /* hero gradient bottom — shallow water */
  --hero-ink: #14324a;
  --hero-sub: #47708c;
  --whale: #a4d2f0;          /* whales swimming in the hero */
  --bubble: rgba(255, 255, 255, 0.8);

  --foot-a: #2c7fc2;         /* footer band — the deeper water */
  --foot-b: #1a5c94;
  --foot-ink: #d5eafc;

  --gold: #a3711d;
  --gold-bg: #f8f0dd;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 62px; }

body {
  margin: 0;
  font: 14.5px/1.55 var(--sans);
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* ==========================================================================
   Navigation — frosted, light
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-nav .bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  max-width: 1140px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 21px; line-height: 1; }
.site-nav ul {
  display: flex;
  gap: 5px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}
.site-nav ul a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4.5px 12px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--chip-bg) 60%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.site-nav ul a svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.site-nav ul a:hover,
.site-nav ul a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--chip-bg);
  text-decoration: none;
}

/* ==========================================================================
   Hero — shallow blue water, whales passing by
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--hero-a) 0%, var(--hero-b) 100%);
  color: var(--hero-ink);
  padding: 48px 0 104px;
}

.hero .wrap { position: relative; z-index: 3; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 224px;
  gap: 44px;
  align-items: center;
}

.hero .kicker {
  font: 600 10.5px/1 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--hero-sub);
  margin: 0 0 12px;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin: 0;
}
.hero h1 .kanji {
  display: inline-block;
  margin-left: 13px;
  font-size: 0.52em;
  font-weight: 500;
  color: var(--hero-sub);
  letter-spacing: 0.06em;
  vertical-align: 0.16em;
}
.hero .role { margin: 13px 0 3px; font-size: 15px; font-weight: 500; }
.hero .role a { color: var(--accent-strong); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-strong) 40%, transparent); text-underline-offset: 3px; }
.hero .tagline { margin: 1px 0 0; color: var(--hero-sub); font-size: 13.5px; }

.avatar-box { text-align: center; }
.avatar {
  width: 100%;
  max-width: 224px;
  aspect-ratio: 936 / 1024;
  object-fit: cover;
  border-radius: 18px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 34px rgba(23, 75, 115, 0.2);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6.5px 13px;
  border: 1.5px solid color-mix(in srgb, var(--accent-strong) 32%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--accent-strong);
  font-size: 12.5px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease,
              border-color 0.18s ease, box-shadow 0.18s ease;
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--accent)) 18%, transparent);
}
.chip::after { content: "↗"; font-size: 0.8em; opacity: 0.55; }
.chip:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent-strong) 35%, transparent);
  text-decoration: none;
}
.chip:hover::before { background: #ffffff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3); }
.chip.solid {
  border: none;
  padding: 8px 16px 8px 12px;
  background: linear-gradient(135deg, #4aa3f2 0%, #2e7fd0 100%);
  color: #ffffff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent-strong) 38%, transparent);
}
.chip.solid::before { display: none; }
.chip.solid::after { content: "→"; opacity: 0.85; }
.chip.solid span { font-size: 15px; line-height: 1; }
.chip.solid:hover { filter: brightness(1.08); transform: translateY(-2px); }

/* — bubbles — */
.bubbles { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.bubbles span {
  position: absolute;
  bottom: 16%;
  border-radius: 50%;
  border: 1.5px solid var(--bubble);
  animation: bubble-rise 8s ease-in infinite;
}
.bubbles span:nth-child(1) { left: 10%; width: 7px;  height: 7px;  animation-duration: 9s; }
.bubbles span:nth-child(2) { left: 26%; width: 11px; height: 11px; animation-delay: 2.2s; }
.bubbles span:nth-child(3) { left: 55%; width: 6px;  height: 6px;  animation-delay: 4.5s; animation-duration: 7s; }
.bubbles span:nth-child(4) { left: 71%; width: 9px;  height: 9px;  animation-delay: 1.2s; animation-duration: 11s; }
.bubbles span:nth-child(5) { left: 88%; width: 6px;  height: 6px;  animation-delay: 3.4s; }

@keyframes bubble-rise {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  12%  { opacity: 0.7; }
  85%  { opacity: 0.3; }
  100% { transform: translateY(-44vh) translateX(12px); opacity: 0; }
}

/* — waves at the bottom edge of the hero — */
.hero-waves {
  position: absolute;
  z-index: 2;
  left: 0; right: 0; bottom: -1px;
  width: 100%;
  height: 74px;
  display: block;
}
.hero-waves .wave-back { fill: rgba(255, 255, 255, 0.5); }
.hero-waves .wave-front { fill: var(--bg); }

/* ==========================================================================
   Sections — wide & dense
   ========================================================================== */

main.wrap { padding-top: 4px; padding-bottom: 30px; }

.section { margin: 34px 0; }
.section > h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
.section > h2::after {
  content: "";
  display: block;
  height: 6px;
  margin-top: 7px;
  background: color-mix(in srgb, var(--accent) 60%, transparent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 6'%3E%3Cpath d='M0 3 Q 5.5 0 11 3 T 22 3' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 22px 6px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 6'%3E%3Cpath d='M0 3 Q 5.5 0 11 3 T 22 3' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 22px 6px;
}
.section-note { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

/* — About — */
.about-facts { margin: 12px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.about-facts li { margin: 3px 0; padding-left: 19px; position: relative; }
.about-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6.5px;
  width: 8px; height: 8px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--accent);
  opacity: 0.6;
}

/* — News — */
.news { margin: 10px 0 0; padding: 0; list-style: none; }
.news li {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  padding: 4.5px 0;
  border-bottom: 1px dashed var(--line);
}
.news li:last-child { border-bottom: none; }
.news .date {
  font: 600 11px/1 var(--mono);
  color: var(--accent-strong);
  background: var(--chip-bg);
  border-radius: 999px;
  padding: 4.5px 0;
  text-align: center;
  height: fit-content;
  margin-top: 2px;
}
.news .what { font-size: 13.5px; }

/* — Publications — selected entries get a teaser image, the rest are text-only — */
.pub-year {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin: 18px 0 9px;
}
.pub-year::after {
  content: "";
  display: block;
  width: 44px;
  height: 6px;
  margin-top: 3px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 6'%3E%3Cpath d='M0 3 Q 5.5 0 11 3 T 22 3' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 22px 6px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 6'%3E%3Cpath d='M0 3 Q 5.5 0 11 3 T 22 3' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 22px 6px;
}
.pub-list { display: flex; flex-direction: column; gap: 14px; }
.pub-title { margin: 0 0 1px; font-size: 14.5px; font-weight: 700; line-height: 1.4; letter-spacing: -0.005em; }
.pub-authors { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-venue { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; font-style: italic; }
.pub-award {
  display: inline-flex;
  align-items: center;
  gap: 4.5px;
  margin-left: 5px;
  padding: 1.5px 9px;
  border-radius: 999px;
  background: var(--gold-bg);
  border: 1px solid #ecd9ac;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  font-style: normal;
  vertical-align: 1px;
}
.pub-award svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pub-links { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border: none;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--muted);
  font: 500 11.5px/1.4 var(--sans);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.badge svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.badge:hover {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent-strong);
  transform: translateY(-1px);
  text-decoration: none;
}

/* — entry layout: text left, teaser image right — */
.pub-entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
}
.pub-entry .pub-content { flex: 1; min-width: 0; }
.pub-media { flex-shrink: 0; }
.pub-media img {
  display: block;
  width: 180px;
  height: 112px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 3px;
}

/* — dated detail rows (grants / awards / service) — */
.rows { margin: 10px 0 0; padding: 0; list-style: none; }
.rows li {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 14px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}
.rows li:last-child { border-bottom: none; }
.rows .when { font: 600 11.5px/1.7 var(--mono); color: var(--muted); white-space: nowrap; }
.rows .sub { color: var(--muted); font-size: 12.5px; }

/* — season switcher (nav) — */
.season-btn {
  border: none;
  padding: 3.5px 10px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--chip-bg) 60%, transparent);
  font-size: 14.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.season-btn:hover { background: var(--chip-bg); transform: translateY(-1px); }

/* ==========================================================================
   Seasons — the sea changes with the calendar (auto by month, manual toggle)
   ========================================================================== */

html[data-season="spring"] {
  --hero-a: #fdf1f6;
  --hero-b: #f6d3e0;
  --hero-sub: #8a6478;
  --whale: #eeb6ca;
  --bubble: rgba(255, 255, 255, 0.9);
}
html[data-season="autumn"] {
  --hero-a: #fdf5ea;
  --hero-b: #f6ddb9;
  --hero-sub: #8a7050;
  --whale: #e7bc84;
  --bubble: rgba(255, 255, 255, 0.9);
}
html[data-season="winter"] {
  --hero-a: #f3f8fd;
  --hero-b: #dcE9f5;
  --hero-sub: #5d7891;
  --whale: #b7d0e4;
  --bubble: rgba(255, 255, 255, 0.95);
}

/* falling petals / leaves / snow replace the rising bubbles */
@keyframes drift-fall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.9; }
  85%  { opacity: 0.6; }
  100% { transform: translateY(46vh) translateX(-46px) rotate(300deg); opacity: 0; }
}
html[data-season="spring"] .bubbles span,
html[data-season="autumn"] .bubbles span,
html[data-season="winter"] .bubbles span {
  top: -6%;
  bottom: auto;
  border: none;
  animation-name: drift-fall;
  animation-timing-function: linear;
}
html[data-season="spring"] .bubbles span {
  background: #f6b8cd;
  border-radius: 68% 32% 66% 34%;
}
html[data-season="autumn"] .bubbles span {
  background: #e59a4b;
  border-radius: 62% 6% 60% 8%;
}
html[data-season="winter"] .bubbles span {
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Dialogs (Abstract / BibTeX)
   ========================================================================== */

.pub-dialog {
  max-width: 660px;
  width: calc(100vw - 48px);
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(20, 60, 95, 0.3);
}
.pub-dialog::backdrop { background: rgba(16, 50, 80, 0.5); backdrop-filter: blur(2px); }
.pub-dialog h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; }
.pub-dialog p { font-size: 13.5px; }
.pub-dialog pre {
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.5 var(--mono);
  background: var(--chip-bg);
  border: 1px solid var(--line);
  padding: 11px;
  border-radius: 8px;
  overflow-x: auto;
}
.pub-dialog form { margin: 12px 0 0; text-align: right; }
.pub-dialog form button {
  padding: 6px 18px;
  border: none;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

/* ==========================================================================
   Footer — deeper water, everyone swims home
   ========================================================================== */

.sea-floor { margin-top: 44px; }
.footer-wave { display: block; width: 100%; height: 56px; margin-bottom: -1px; }
.footer-wave path { fill: var(--foot-a); }
.sea-footer {
  background: linear-gradient(180deg, var(--foot-a) 0%, var(--foot-b) 100%);
  color: var(--foot-ink);
  padding: 6px 0 34px;
  font-size: 12.5px;
}
.creatures {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px clamp(18px, 4.5vw, 52px);
  padding: 10px 16px 18px;
}
.creatures svg { fill: rgba(255, 255, 255, 0.55); animation: bob 6s ease-in-out infinite; }
.creatures .spikes { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 3.4; stroke-linecap: round; }
.creatures .lure { fill: rgba(230, 248, 255, 0.92); animation: lure-glow 3.2s ease-in-out infinite; }
.creatures .lure-stem { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 2.6; stroke-linecap: round; }
.creatures .tentacles { fill: none; stroke: rgba(255, 255, 255, 0.55); stroke-width: 3; stroke-linecap: round; }
.creatures svg:nth-child(1) { width: 76px; }                        /* whale */
.creatures svg:nth-child(2) { width: 50px; animation-delay: 0.9s; } /* dolphin */
.creatures svg:nth-child(3) { width: 56px; animation-delay: 1.8s; } /* shark */
.creatures svg:nth-child(4) { width: 60px; animation-delay: 2.7s; } /* anglerfish */
.creatures svg:nth-child(5) { width: 54px; animation-delay: 3.6s; } /* kappa */
.creatures svg:nth-child(6) { width: 36px; animation-delay: 4.5s; } /* pufferfish */
.creatures svg:nth-child(7) { width: 32px; animation-delay: 5.4s; } /* jellyfish */
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}
@keyframes lure-glow {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}
.sea-footer .colophon { text-align: center; margin: 0; }
.sea-footer .colophon .whale-note {
  display: block;
  margin: 6px auto 0;
  max-width: 640px;
  font-size: 11.5px;
  color: color-mix(in srgb, var(--foot-ink) 75%, transparent);
}
.sea-footer a { color: #eaf6ff; }

/* ==========================================================================
   Responsive & motion
   ========================================================================== */

@media (max-width: 760px) {
  .hero { padding: 38px 0 96px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .avatar-box { order: -1; }
  .avatar { max-width: 156px; border-radius: 15px; }
  .news li { grid-template-columns: 78px 1fr; gap: 10px; }
  .pub-entry { flex-direction: column; gap: 10px; }
  .pub-media img { width: 100%; max-width: 320px; height: auto; aspect-ratio: 180 / 112; }
  .site-nav ul { overflow-x: auto; scrollbar-width: none; }
  .site-nav ul::-webkit-scrollbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bubbles span, .creatures svg, .creatures .lure { animation: none; }
  .bubbles { display: none; }
}
