:root {
  color-scheme: dark;
  --bg: #11141c;
  --text: #f2f4f8;
  --muted: #a3a9b6;
  --underline: #8a91a0;
  --line: #2c3240;
  --card: #181c27;
  --focus: #4da3ff;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.sea {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Content hugs the left edge, leaving open water for the koi on the right. */
.wrap {
  --pad: clamp(1.25rem, 6vw, 5.5rem);
  max-width: calc(34rem + 2 * var(--pad));
  margin: 0;
  padding: 0 var(--pad);
}
.top { padding-top: clamp(2.5rem, 9vh, 6rem); }

/* Site navigation */
.nav {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding-top: 1.5rem;
  font-size: 0.9375rem;
}
.nav a {
  padding: 0.25rem 0;
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--underline);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.875rem, 6vw, 2.25rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.lede {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

h2 {
  margin: 3.5rem 0 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

p { margin: 0 0 1rem; }
.intro { margin-top: 2.5rem; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
li { margin: 0 0 1.5rem; }
li:last-child { margin-bottom: 0; }

.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.meta {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.desc {
  display: block;
  color: var(--muted);
}

/* Inline mentions that open a small card: hover or keyboard focus on a pointer, tap on touch. */
.cite { position: relative; display: inline; }
.cite-name {
  text-decoration: underline;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.cite-name:hover,
.cite-name[aria-expanded="true"] { text-decoration-color: currentColor; }
.cite-name:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
.card {
  display: none;
  position: absolute;
  z-index: 10;
  left: 0;
  bottom: 100%;
  width: 20rem;
  max-width: calc(100vw - 2.5rem);
  /* a transparent bridge, so the pointer can travel from the name onto the card */
  padding-bottom: 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
}
.card > * {
  display: block;
  padding: 0 0.875rem;
  background: var(--card);
  border-inline: 1px solid var(--line);
}
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  color: var(--muted);
}
.card-date { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.card-role { padding-top: 0.375rem; font-size: 0.875rem; color: var(--text); }
.card-text { padding-top: 0.25rem; padding-bottom: 0.625rem; color: var(--muted); }
.card .card-link {
  padding-top: 0.5rem;
  padding-bottom: 0.625rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--muted);
  text-decoration: none;
}
.card .card-link:hover { color: var(--text); }
.cite.open > .card,
.cite.kb > .card { display: block; animation: card-in 140ms ease-out; }
@media (hover: hover) and (pointer: fine) {
  .cite:hover > .card { display: block; animation: card-in 140ms ease-out; }
}
/* Escape hides a card until focus or the pointer leaves the mention */
.cite.hush > .card { display: none !important; }
/* not enough room above: open below the line instead */
.card.below { bottom: auto; top: 100%; padding-bottom: 0; padding-top: 0.625rem; }
@keyframes card-in { from { opacity: 0; translate: 0 4px; } }
@media (prefers-reduced-motion: reduce) {
  .card { animation: none !important; }
}
/* On phones the card spans the text column above the paragraph, so it never runs off-screen. */
@media (max-width: 640px) {
  .cite { position: static; }
  .intro p { position: relative; }
  .card { width: auto; right: 0; max-width: none; }
}

details { margin-top: 0.375rem; }
summary {
  width: fit-content;
  color: var(--muted);
  font-size: 0.9375rem;
  cursor: pointer;
}
summary:hover { color: var(--text); }
details p {
  margin: 0.375rem 0 0;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
}

footer .wrap { padding-bottom: 4rem; }
footer p {
  margin: 3.5rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Home fits one screen: open water above, the text anchored to the bottom-left.
   min-height (not a fixed height), so short screens still scroll instead of cutting text off. */
.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
.home > header { margin-top: auto; padding-top: 3rem; }
.home .intro { margin-top: 1.75rem; }
.home footer .wrap { padding-bottom: clamp(2rem, 7vh, 4.5rem); }
.home footer p { margin-top: 1.25rem; }

/* Contact links on one line: ragesh@duck.com / medium / github / … */
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin-top: 1.5rem;
}
.socials li { margin: 0; }
/* the slash ends the item before it, so a wrapped line never starts with one */
.socials li:not(:last-child)::after {
  content: "/";
  content: "/" / "";
  margin-left: 0.5rem;
  color: var(--muted);
}

::selection {
  background: var(--text);
  color: var(--bg);
}
