:root {
  --paper: #ffffff;
  --ink: #000000;
  --quiet: #4a4a4a;
  --tile: #efefef;

  --pad: clamp(20px, 4vh, 56px);
  --gap: clamp(8px, 1.2vh, 14px);
  --s: min(
    calc((100dvh - 2 * var(--pad) - 2 * var(--gap)) / 3),
    calc((50vw - 1.5 * var(--pad) - var(--gap)) / 2)
  );
}

:root[data-theme="dark"] {
  --paper: #000000;
  --ink: #ffffff;
  --quiet: #9a9a9a;
  --tile: #1a1a1a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Times New Roman", Times, serif;
  font-size: 12px;
  line-height: 1.22;
  letter-spacing: -0.005em;
  overflow: hidden;
  cursor: crosshair;
  -webkit-font-smoothing: antialiased;
  transition: background-color 200ms ease, color 200ms ease;
}

.fig { transition: background-color 200ms ease; }

/* theme toggle + svg animation */
.theme-toggle {
  position: fixed;
  right: var(--pad);
  bottom: var(--pad);
  display: grid;
  place-items: center;
  padding: 6px;
  margin: -6px;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle svg { display: block; transition: transform 400ms cubic-bezier(0.65, 0, 0.35, 1); }
:root[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
  body, .fig, .theme-toggle svg { transition: none; }
}

::selection { background: var(--ink); color: var(--paper); }

.page {
  height: 100dvh;
  padding: var(--pad);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: calc(var(--pad) * 1.25);
}

/* Figures */
.figures {
  display: grid;
  grid-template-columns: repeat(2, var(--s));
  grid-template-rows: repeat(3, var(--s));
  gap: var(--gap);
  align-self: center;
}

.fig { background: var(--tile); overflow: hidden; }
.fig img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* text */
.text {
  justify-self: end;
  width: min(34em, 100%);
  display: flex;
  flex-direction: column;
  gap: 1.6em;
  min-height: 0;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

h1 {
  font-size: 2.4em;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-align: left;
  margin-bottom: 0.15em;
}

/* name animation */
.name .add { white-space: pre; }

.name .caret {
  display: inline-block;
  width: 1px;
  height: 0.85em;
  margin-right: -1px;
  vertical-align: -0.12em;
  background: var(--ink);
  animation: blink 1s steps(1) infinite;
}
.name .caret.typing { animation: none; }
.name .caret.done { animation: none; opacity: 0; transition: opacity 250ms ease; }

@keyframes blink { 50% { opacity: 0; } }

.name.copyable { cursor: pointer; }

.lead {
  font-size: 1.2em;
  line-height: 1.18;
  margin-bottom: 0.9em;
}

p + p { margin-top: 0.75em; }

h2 {
  font-size: 1em;
  font-weight: 400;
  font-style: italic;
  margin-bottom: 0.4em;
}

.work { list-style: none; }

.work li {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  padding: 0.14em 0;
  text-align: left;
}

.work .title { white-space: nowrap; }
.work .where { color: var(--quiet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* dot leader */
.work .leader {
  flex: 1;
  min-width: 1em;
  border-bottom: 1px dotted var(--quiet);
  transform: translateY(-0.25em);
}

.work .year { font-variant-numeric: lining-nums tabular-nums; }

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

/* footer separation */
.contact p { display: flex; justify-content: space-between; gap: 1em; }

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

/* mobile */
@media (max-width: 720px) {
  :root { --s: calc((100vw - 2 * var(--pad) - 2 * var(--gap)) / 3); }
  body { overflow: auto; }
  .page { height: auto; min-height: 100dvh; grid-template-columns: minmax(0, 1fr); align-content: start; row-gap: calc(var(--gap) * 2); }
  .figures { grid-template-columns: repeat(3, var(--s)); grid-template-rows: repeat(2, var(--s)); align-self: start; }
  .text { justify-self: start; }
  h1 { font-size: 2.2em; }
  p { font-size: calc(1em - 2pt); }
}
