/* The illustration carries the personality; the page itself stays plain.
   Colours are taken from the banner: ink, cobalt sky, sunset orange, cactus green. */
:root {
  color-scheme: light;
  --ink: #1c1f2b;          /* body text */
  --navy: #1b2a5e;         /* lines and borders */
  --red: #9e1b24;          /* section breaks, links */
  --muted: #5c606c;
  --line: #d9d9d4;
  --bg: #f3f3f0;           /* grey-white page */
  --soft: #ebebe6;
  --accent: var(--red);
  --cobalt: #2f4fb5;
  --sans: "Inter", "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  --serif: "Source Serif 4", Georgia, "Hiragino Mincho ProN", "Noto Serif JP", "Yu Mincho", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin:0; background:var(--bg); color:var(--ink); font:17px/1.7 var(--sans); }
html:lang(ja) body { line-height: 1.85; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
.wrap { max-width: 840px; margin: 0 auto; padding: 0 24px; }

/* Header */
.site-header { background: var(--bg); border-bottom: 3px solid var(--navy); }
.header-inner { display:flex; align-items:center; justify-content:space-between; gap:16px; min-height:62px; flex-wrap:wrap; }
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--navy); text-decoration: none; }
.nav { display:flex; gap: 22px; align-items:center; flex-wrap:wrap; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--navy); font-weight: 600; box-shadow: inset 0 -2px 0 var(--red); }
.nav .lang-switch { color: var(--ink); font-weight: 500; }

/* Banner */
.banner { position: relative; overflow: hidden; border-bottom: 3px solid var(--navy); background: #2f4fb5; }
.banner-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.banner-mobile { display: none; }
.banner-tall { height: clamp(260px, calc(100vw * 440 / 1440), 520px); }
.banner-slim { height: 120px; }
/* Very wide screens: keep the illustration's proportions and show it as a framed panel */
@media (min-width: 1700px) {
  .banner { max-width: 1700px; margin: 0 auto; border-left: 3px solid var(--navy); border-right: 3px solid var(--navy); }
}

/* Home: name block */
.hero { display:flex; gap: 32px; align-items:center; padding: 40px 0 8px; }
.hero h1 { font-size: 2.4rem; margin: 0 0 .2em; }
.hero .role { color: var(--muted); margin: 0 0 .5em; }
.hero .tagline { margin: 0 0 .8em; font-weight: 600; }
.photo { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--navy); }
.photo-initials { display:flex; align-items:center; justify-content:center; font: 700 2.6rem var(--serif); color: var(--ink); background: #ffd93b; }
.links { display:flex; gap: 18px; flex-wrap: wrap; padding:0; margin: 0; list-style:none; font-size: .95rem; }

/* The dog taps the phone screen */
.dog-tap { transform-box: fill-box; transform-origin: 0% 0%; animation: dog-tap 1.6s ease-in-out infinite; }
@keyframes dog-tap { 0%, 40%, 100% { transform: rotate(0deg); } 20% { transform: rotate(-12deg); } 60% { transform: rotate(-12deg); } 80% { transform: rotate(0deg); } }
@media (prefers-reduced-motion: reduce) { .dog-tap { animation: none; } }

.tower-light { animation: tower-blink 2.4s steps(1) infinite; }
@keyframes tower-blink { 0%, 70% { opacity: 1; } 71%, 100% { opacity: .25; } }
.rf-waves { animation: rf-pulse 2.4s ease-in-out infinite; }
@keyframes rf-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tower-light, .rf-waves { animation: none; } }

.saw-wave { animation: saw-travel .9s linear infinite; }
@keyframes saw-travel { from { transform: translateX(0); } to { transform: translateX(7px); } }
@media (prefers-reduced-motion: reduce) { .saw-wave { animation: none; } }

/* Content */
.related { font-size: .93rem; color: var(--muted); border-left: 3px solid var(--navy); padding: 4px 0 4px 12px; }
.related-label { display: inline-block; font-weight: 700; color: var(--navy); margin-right: 8px; text-transform: none; }
main.wrap { padding: 36px 24px 72px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.25; color: var(--navy); }
main h1 { font-size: 2.2rem; margin: .3em 0 .4em; }
h2 { font-size: 1.35rem; margin: 2.2em 0 .7em; padding-bottom: .35em; border-bottom: 2px solid var(--red); }
.pub-year { border-bottom: 0; padding-bottom: 0; }
p { margin: 0 0 1em; }
.lead { font-size: 1.1rem; color: var(--muted); }

.interests, .skills { padding-left: 1.2em; }
.interests li, .skills li { margin-bottom: .45em; }
.news { list-style: none; padding: 0; }
.news li { display:flex; gap: 16px; padding: 6px 0; }
.news .date { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 5.5em; }

.theme { margin-bottom: 2.2em; }
.theme::after { content:""; display:block; clear:both; }
figure { margin: 0 0 1em; }
.theme figure { float: right; width: 42%; margin: .3em 0 1em 24px; }
figure img { width: 100%; display:block; }
figcaption { font-size: .85rem; color: var(--muted); margin-top: .4em; }

.pub-year { font-size: 1.1rem; margin: 2em 0 .3em; color: var(--muted); }
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pub-title { font-weight: 600; display:block; }
.pub-authors { display:block; font-size: .95rem; }
.pub-venue { color: var(--muted); font-style: italic; font-size: .95rem; }
.pub-note { font-size: .8rem; color: var(--muted); margin-left: 6px; font-style: normal; }
.pub-note::before { content: "· "; }
.pub-links a { font-size: .88rem; margin-right: 12px; }

.timeline { display:grid; grid-template-columns: 9.5em 1fr; gap: 6px 20px; margin: 0; }
.timeline dt { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline dd { margin: 0 0 .7em; }
.timeline .sub { color: var(--muted); font-size: .93rem; }
.button { display:inline-block; border: 2px solid var(--navy); color: var(--navy); padding: 7px 16px; font-weight: 600; text-decoration: none; }
.button:hover { background: #ffd93b; color: #1b1320; }
.note { border-left: 3px solid var(--navy); padding: 4px 14px; color: var(--muted); }

.about-photo { float: right; width: 44%; margin: .3em 0 1em 24px; }
section::after { content: ""; display: block; clear: both; }
figure img { border: 3px solid var(--navy); }

.fig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 20px; margin: 1.4em 0 .6em; align-items: start; }
.fig-grid .wide { grid-column: 1 / -1; }
.theme figure.sci { float: none; width: auto; margin: 0; }
figure.sci img { width: 100%; display: block; background: #fff; border: 1px solid var(--line); padding: 6px; }
figure.sci figcaption { font-size: .86rem; line-height: 1.5; color: var(--muted); margin-top: .5em; }
figure.sci .credit { display: block; font-size: .8rem; margin-top: .2em; }
.theme figure.hero-fig { margin: 1.2em 0 1.4em; }
.theme figure.wide-fig img { padding: 8px; border: 1px solid var(--line); background: #fff; }
figure.hero-fig img { padding: 0; border: 3px solid var(--navy); }

.site-footer { border-top: 3px solid var(--navy); color: var(--muted); font-size: .85rem; padding: 22px 0; }
.site-footer p { margin: 0 0 .3em; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .banner-tall { height: 230px; }
  .banner-desktop { display: none; }
  .banner-mobile { display: block; }
  .banner-slim { height: 90px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 18px; padding-top: 28px; }
  .hero h1 { font-size: 2rem; }
  .photo { width: 110px; height: 110px; }
  .theme figure, .about-photo { float:none; width:100%; margin: 0 0 1em; }
  .fig-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
  .timeline dd { margin-bottom: 1em; }
}

/* Printing / PDF export of the CV page */
.print-only { display: none; }
@media print {
  @page { size: Letter; margin: 16mm 16mm 18mm; }
  body { background: #fff; font-size: 10.5pt; line-height: 1.45; }
  .site-header, .banner, .site-footer, .button, .lang-switch { display: none !important; }
  main.wrap { padding: 0; max-width: none; }
  .print-only { display: block; }
  .print-head { border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 6px; color: var(--muted); font-size: 9.5pt; }
  .print-name { font-family: var(--serif); font-size: 20pt; font-weight: 700; color: var(--navy); }
  main h1 { display: none; }
  h2 { font-size: 12.5pt; margin: 1.1em 0 .45em; break-after: avoid; }
  .timeline { grid-template-columns: 7.5em 1fr; gap: 2px 14px; }
  .timeline dt, .timeline dd { break-inside: avoid; }
  .timeline dd { margin-bottom: .35em; }
  .skills li { margin-bottom: .25em; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* Phones: show the whole scene in the home banner, panning slowly left and right */
@media (max-width: 640px) {
  .banner-tall .banner-desktop {
    display: block; right: auto; width: calc(230px * 1440 / 440); height: 230px;
    animation: banner-pan 26s ease-in-out infinite alternate;
  }
  .banner-tall .banner-mobile { display: none; }
}
@keyframes banner-pan {
  0%, 8%    { transform: translateX(0); }
  92%, 100% { transform: translateX(calc(100vw - 230px * 1440 / 440)); }
}
/* Reduced motion: no panning; a still crop with the cat, antenna and phone (see MOBILE_X0 in tools/banner.py) */
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .banner-tall { height: calc(100vw * 440 / 815); }
  .banner-tall .banner-desktop { display: none; animation: none; }
  .banner-tall .banner-mobile { display: block; }
}
