/* ------------------------------------------------------------------
   danylo fedkiv — site styles
   Layout idea: a strip of flowing marble on the left, true black
   everywhere else. The marble is the only loud thing on the page.
------------------------------------------------------------------- */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --black: #000;
  --white: #fff;
  --soft: #c9c9c9;      /* body text on black */
  --quiet: #8a8a8a;     /* dates, secondary facts */
  --rule: #2b2b2b;

  /* pulled from the marble */
  --pink: #ff3d8b;
  --cyan: #2fd6e8;
  --orange: #ff9a3d;
  --green: #2fd67f;

  --strip: clamp(96px, 38vw, 640px);       /* marble width on the cover */
  --strip-inner: clamp(72px, 25vw, 420px);  /* marble width on inner pages */
  --pad: clamp(24px, 5vw, 80px);

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
}

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

html { background: var(--black); color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--black);
  color: var(--soft);
  font-family: var(--text);
  font-size: 1.1875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- marble strip ---------- */

.marble {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--strip-inner);
  /* shown until the canvas paints, and if WebGL is unavailable */
  background:
    radial-gradient(120% 60% at 20% 10%, #ff2d7a 0%, transparent 60%),
    radial-gradient(90% 50% at 90% 30%, #18c7d8 0%, transparent 65%),
    radial-gradient(110% 50% at 10% 55%, #ff8f1f 0%, transparent 60%),
    radial-gradient(100% 45% at 85% 75%, #19b96a 0%, transparent 60%),
    radial-gradient(120% 50% at 30% 100%, #7a2bd6 0%, transparent 65%),
    #1a0b3d;
  overflow: hidden;
}
.cover .marble { width: var(--strip); }
.marble canvas { display: block; width: 100%; height: 100%; }

/* ---------- page frame ---------- */

.page {
  margin-left: var(--strip-inner);
  padding: 0 var(--pad) 96px;
  min-height: 100vh;
  min-height: 100dvh;
}
.cover .page {
  margin-left: var(--strip);
  display: flex;
  flex-direction: column;
  padding-bottom: 48px;
}

/* ---------- navigation ---------- */

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  padding: 24px 0;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 400;
}
.nav a {
  color: var(--quiet);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--white); }
.nav a[aria-current="page"] {
  color: var(--white);
  border-bottom-color: var(--pink);
}

/* ---------- cover ---------- */

.cover main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(28px, 5vh, 52px);
  padding: 8px 0 32px;
  max-width: 40rem;
}

.hello {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--white);
}

.about {
  margin: 0;
  max-width: 34rem;
  font-size: clamp(1.125rem, 1.4vw, 1.3125rem);
  line-height: 1.5;
  color: var(--soft);
}
.about + .about { margin-top: 0.85em; }

.tagline {
  margin: 16px 0 0;
  max-width: 30rem;
  font-family: var(--display);
  font-size: clamp(1.125rem, 1.5vw, 1.375rem);
  line-height: 1.35;
  color: var(--white);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--display);
  font-size: 1.125rem;
}
.links li + li::before {
  content: "–";
  margin-right: 14px;
  color: var(--quiet);
}

/* ---------- links ---------- */

a { color: var(--white); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--cyan); }
.links li:nth-child(1) a:hover { color: var(--pink); }
.links li:nth-child(2) a:hover { color: var(--cyan); }
.links li:nth-child(3) a:hover { color: var(--orange); }
.links li:nth-child(4) a:hover { color: var(--green); }

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

/* ---------- inner pages ---------- */

.inner main { max-width: 43rem; padding-top: clamp(24px, 6vh, 72px); }

h1, h2, h3 {
  font-family: var(--display);
  color: var(--white);
  margin: 0;
}
h1 {
  font-weight: 300;
  font-size: clamp(2.25rem, 4.6vw, 3.75rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}
.lede {
  margin: 20px 0 0;
  font-size: clamp(1.25rem, 1.7vw, 1.4375rem);
  line-height: 1.5;
  color: var(--soft);
  max-width: 36rem;
}

section { margin-top: clamp(56px, 9vh, 88px); }
h2 {
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
}
h3 {
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
strong { color: var(--white); font-weight: 600; }

/* an entry: a lab, a project, a role */
.entry { padding: 24px 0; border-top: 1px solid var(--rule); }
.entry:last-child { border-bottom: 1px solid var(--rule); }
.entry header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  margin-bottom: 10px;
}
.when {
  font-family: var(--display);
  font-size: 0.9375rem;
  color: var(--quiet);
  white-space: nowrap;
}
.where {
  font-family: var(--display);
  font-size: 1rem;
  color: var(--soft);
  margin: -4px 0 10px;
}

.plain { margin: 0; padding: 0; list-style: none; }
.plain li { padding: 10px 0; border-top: 1px solid var(--rule); }
.plain li:last-child { border-bottom: 1px solid var(--rule); }

.entry .plain li:last-child { border-bottom: 0; }

.tags {
  margin: 14px 0 0;
  font-family: var(--display);
  font-size: 0.9375rem;
  color: var(--quiet);
}

/* results table (Science Olympiad) */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--display);
  font-size: 1rem;
  line-height: 1.4;
}
th, td {
  text-align: left;
  padding: 12px 20px 12px 0;
  border-top: 1px solid var(--rule);
  vertical-align: top;
}
tr:last-child td { border-bottom: 1px solid var(--rule); }
th { color: var(--quiet); font-weight: 400; border-top: 0; padding-top: 0; }
td:first-child { color: var(--white); }
td:last-child, th:last-child { padding-right: 0; }

/* exam archive (Science Olympiad) */
#exam-archive { margin-top: 24px; font-family: var(--display); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1;
  color: var(--soft);
  background: transparent;
  border: 1px solid #4a4a4a;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
}
.chip .n { color: var(--quiet); }
.chip:hover { border-color: var(--white); color: var(--white); }
.chip[aria-pressed="true"] { background: var(--white); border-color: var(--white); color: var(--black); }
.chip[aria-pressed="true"] .n { color: #555; }
.filters-small .chip { font-size: 0.875rem; padding: 7px 12px; }
.dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; }

.count { margin: 14px 0 0; font-size: 0.9375rem; color: var(--quiet); }

.exam-group { margin-top: 28px; }
.exam-season {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #4a4a4a;
  font-size: 1.0625rem;
}
.exam-season span { font-weight: 400; font-size: 0.875rem; color: var(--quiet); }

.exams { margin: 0; padding: 0; list-style: none; }
.exam {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10.5rem 3.25rem 8.5rem;
  align-items: baseline;
  column-gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
  line-height: 1.35;
}
.exam-title { color: var(--white); font-weight: 500; }
.exam-note { margin-left: 10px; font-size: 0.875rem; color: var(--quiet); }
.exam-event { display: flex; align-items: center; gap: 8px; color: var(--soft); font-size: 0.9375rem; }
.exam-div { color: var(--quiet); font-size: 0.9375rem; }
.exam-files { display: flex; justify-content: flex-end; gap: 16px; font-size: 0.9375rem; white-space: nowrap; }
.exam-files span { color: var(--quiet); }
.exam.is-example .exam-title { color: var(--quiet); font-weight: 400; }
#exam-archive .empty { margin-top: 24px; font-family: var(--text); }

@media (max-width: 900px) {
  .exam { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .exam-name { grid-column: 1 / -1; }
  .exam-event { grid-column: 1; }
  .exam-div { display: none; }
  .exam-files { grid-column: 2; }
  .exam-event::after { content: attr(data-div); color: var(--quiet); margin-left: 4px; }
}

/* friends */
.friend .links-row { display: flex; gap: 20px; margin-top: 10px; font-family: var(--display); font-size: 1rem; }

/* blog */
.posts { margin: 0; padding: 0; list-style: none; }
.posts li { padding: 20px 0; border-top: 1px solid var(--rule); }
.posts li:last-child { border-bottom: 1px solid var(--rule); }
.posts a { font-family: var(--display); font-size: 1.375rem; font-weight: 600; letter-spacing: -0.015em; text-decoration: none; }
.posts a:hover { text-decoration: underline; }
.posts p { margin: 6px 0 0; }
.empty { padding: 28px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }

.post h1 { font-size: clamp(2rem, 4vw, 3.25rem); }
.post .when { display: block; margin-top: 16px; }
.post .body { margin-top: 40px; }
.post .body h2 { margin-top: 48px; }
.post .body blockquote {
  margin: 1.5em 0;
  padding-left: 20px;
  border-left: 2px solid var(--pink);
  color: var(--white);
  font-style: italic;
}
.post .body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: #161616;
  padding: 2px 6px;
  border-radius: 3px;
}
.post .body ul { margin: 0 0 1em; padding-left: 1.25em; }
.post .body li { margin: 0.35em 0; }
.post .body li::marker { color: var(--quiet); }
.post .attachment {
  margin-top: 32px;
  padding: 18px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--display);
  font-size: 1.0625rem;
}
.back { display: inline-block; margin-top: 56px; font-family: var(--display); font-size: 1rem; }

footer {
  margin-top: 96px;
  font-family: var(--display);
  font-size: 0.9375rem;
  color: var(--quiet);
}
.cover footer { margin-top: 0; }

/* ---------- small screens: the strip becomes a band across the top ---------- */

@media (max-width: 760px) {
  .marble, .cover .marble {
    position: relative;
    inset: auto;
    width: 100%;
    height: 96px;
  }
  .cover .marble { height: 28vh; min-height: 150px; }
  .page, .cover .page { margin-left: 0; min-height: 0; }
  .nav { padding: 20px 0; gap: 2px 20px; }
  .cover main { justify-content: flex-start; padding-top: 16px; }
  body { font-size: 1.125rem; }
}

/* ---------- page-to-page motion ----------
   enter.js adds .from-cover or .from-inner to <html>, naming the kind of page
   the visitor just left, and then .go once the marble has drawn. Before .go
   the strip sits at its old width; adding .go lets it slide to the new one,
   with the content riding along. */

.from-cover .inner .marble, .from-inner .cover .marble {
  transition: width 0.7s cubic-bezier(0.22, 0.9, 0.24, 1), height 0.7s cubic-bezier(0.22, 0.9, 0.24, 1);
}
.from-cover .inner .page, .from-inner .cover .page {
  transition: transform 0.7s cubic-bezier(0.22, 0.9, 0.24, 1);
}
.from-cover:not(.go) .inner .marble { width: var(--strip); }
.from-inner:not(.go) .cover .marble { width: var(--strip-inner); }
.from-cover:not(.go) .inner .page { transform: translateX(calc(var(--strip) - var(--strip-inner))); }
.from-inner:not(.go) .cover .page { transform: translateX(calc(var(--strip-inner) - var(--strip))); }

/* every page: the text fades up quickly */
.js .page main, .js .cover footer { transition: opacity 0.4s ease-out, transform 0.4s ease-out; }
.js:not(.go) .page main, .js:not(.go) .cover footer { opacity: 0; transform: translateY(8px); }

@media (max-width: 760px) {
  .from-cover:not(.go) .inner .marble { width: 100%; height: max(28vh, 150px); }
  .from-inner:not(.go) .cover .marble { width: 100%; height: 96px; }
  .from-cover:not(.go) .inner .page, .from-inner:not(.go) .cover .page { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .marble, .page, .page main, .cover footer { transition: none !important; }
}
