/* naokiwake.com: one reading column, ink-blue links, serif text. */

:root {
  --paper: #fdfdfb;
  --ink: #1b1e23;
  --graphite: #5e636b;
  --rule: #e3e5e8;
  --accent: #2b4c7e;
  --accent-soft: #e8eef7;
  --code-bg: #f3f4f6;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181c;
    --ink: #e6e8eb;
    --graphite: #9aa1aa;
    --rule: #2a2f36;
    --accent: #8fb0e0;
    --accent-soft: #1f2a3a;
    --code-bg: #1d2127;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: var(--accent-soft); }

/* Header on post pages: just the way home. */
.site-header {
  padding: 1.75rem 0 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
}
.site-header a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.site-header a:hover { color: var(--accent); }

/* Home: introduction */
.intro { padding: 5rem 0 3rem; }

.trace {
  display: block;
  width: 15rem;
  max-width: 60%;
  height: auto;
  margin: 0 0 1.75rem;
  color: var(--accent);
}
.trace path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}
.trace circle {
  fill: var(--paper);
  stroke: currentColor;
  stroke-width: 1.5;
}

.intro h1 {
  font-size: clamp(2.5rem, 7vw, 3.5rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}
.intro p {
  margin: 0 0 1rem;
  max-width: 34em;
}

.links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.75rem 0 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

/* Home: sections */
.section {
  border-top: 1px solid var(--rule);
  padding: 2rem 0 1.5rem;
}
.section h2 {
  font-size: 1.375rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
}
.more {
  margin: 0.75rem 0 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

/* Papers: title, then authors and venue */
.papers {
  list-style: none;
  margin: 0;
  padding: 0;
}
.papers li { padding: 0.75rem 0; }
.papers a,
.papers .title {
  color: var(--ink);
  text-decoration: none;
  line-height: 1.45;
}
.papers a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.papers .meta {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--graphite);
}

/* Experience: years beside role */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0 1.5rem;
  padding: 0.75rem 0;
}
.timeline .years {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--graphite);
  font-variant-numeric: tabular-nums;
  padding-top: 0.25rem;
}
.timeline .role { display: block; }
.timeline p {
  margin: 0.25rem 0 0;
  color: var(--graphite);
  font-size: 1rem;
  line-height: 1.55;
}
.section .earlier {
  margin: 1rem 0 0;
  color: var(--graphite);
  font-size: 1rem;
  line-height: 1.55;
}

@media (max-width: 34rem) {
  .timeline li { grid-template-columns: 1fr; }
  .timeline .years { padding-top: 0; }
}

/* Papers page: groups */
.paper-group h2 {
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 2.5rem 0 0.25rem;
}
.paper-group:first-of-type h2 { margin-top: 0; }

/* Home: list of posts */

.posts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.posts li {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0 1.5rem;
  padding: 0.875rem 0;
}
.posts time {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--graphite);
  font-variant-numeric: tabular-nums;
  padding-top: 0.25rem;
}
.posts a {
  color: var(--ink);
  text-decoration: none;
}
.posts a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.posts p {
  margin: 0.25rem 0 0;
  color: var(--graphite);
  font-size: 1rem;
  line-height: 1.55;
}

@media (max-width: 34rem) {
  .posts li { grid-template-columns: 1fr; }
  .posts time { padding-top: 0; }
}

/* Post pages */
.post-head { padding: 3.5rem 0 2rem; }
.post-head h1 {
  font-size: clamp(2rem, 5.5vw, 2.75rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.005em;
  margin: 0 0 0.75rem;
}
.post-head time {
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--graphite);
}

.prose h2 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
  margin: 2.75rem 0 0.75rem;
}
.prose h3 {
  font-size: 1.1875rem;
  font-weight: 500;
  margin: 2rem 0 0.5rem;
}
.prose p,
.prose ul,
.prose ol { margin: 0 0 1.25rem; }
.prose li + li { margin-top: 0.35rem; }

.prose blockquote {
  margin: 1.75rem 0;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--accent);
  color: var(--graphite);
  font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
.prose pre {
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.6;
  background: var(--code-bg);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  border-radius: 4px;
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.prose figure { margin: 2rem 0; }
.prose img { display: block; max-width: 100%; height: auto; }
.prose figcaption {
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--graphite);
  margin-top: 0.5rem;
}
.figure-placeholder {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--code-bg);
  border: 1px dashed var(--rule);
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--graphite);
}

/* Footer */
.site-footer {
  margin-top: 5rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--graphite);
}
.site-footer p { margin: 0; }

/* The one moment of motion: the trajectory draws itself once. */
@media (prefers-reduced-motion: no-preference) {
  .trace path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: trace-draw 1.4s cubic-bezier(0.33, 0, 0.2, 1) 0.15s forwards;
  }
  .trace circle {
    opacity: 0;
    animation: trace-dot 0.3s ease-out forwards;
    animation-delay: var(--d, 0s);
  }
}
@keyframes trace-draw { to { stroke-dashoffset: 0; } }
@keyframes trace-dot { to { opacity: 1; } }
