/* JetBrains Mono, self-hosted. latin-ext carries Š, č, ľ and only
   downloads when one of those characters is on the page. */
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/jetbrains-mono-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Every colour on the page. The chrome (menu bar, title bars) and the lines
   are shared, so the bar at the top and the windows read as one set. */
:root {
  --paper: #fbfbf9;   /* page */
  --panel: #ffffff;   /* inside windows */
  --chrome: #ececea;  /* menu bar and title bars */
  --line: #d6d6d1;    /* every border and divider */
  --ink: #111111;
  --dim: #6b6b6b;
  --column: 36rem;
  --radius: 10px;
  color-scheme: light;
}

/* Dark mode: the same roles, darker values. It follows the system setting
   unless the toggle in the menu bar has set data-theme on <html>. */
:root[data-theme="dark"] {
  --paper: #161616;
  --panel: #1e1e1e;
  --chrome: #2a2a2a;
  --line: #3a3a3a;
  --ink: #ececea;
  --dim: #9a9a9a;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161616;
    --panel: #1e1e1e;
    --chrome: #2a2a2a;
    --line: #3a3a3a;
    --ink: #ececea;
    --dim: #9a9a9a;
    color-scheme: dark;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  line-height: 1.5;
}

h1, h2, h3, p, ul, dl, dd, figure {
  margin: 0;
  font-size: 1em;
}

p, ul {
  margin-bottom: 1rem;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

small {
  font-size: 0.8em;
  font-weight: 400;
  color: var(--dim);
}

.dim {
  color: var(--dim);
}

a,
.copy {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  border-radius: 2px;
}

a:hover,
.copy:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

a:focus-visible,
.copy:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* "copy" after the email is a button that looks like the links. */
.copy {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-decoration-line: underline;
  cursor: pointer;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* Menu bar across the top: name on the left, clock on the right. */

.bar {
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
}

.bar-inner,
main {
  width: min(100% - 2.5rem, var(--column));
  margin-inline: auto;
}

.bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2ch;
  padding: 0.75rem 0;
}

.bar-right {
  display: flex;
  align-items: center;
  gap: 1.25ch;
}

.bar h1,
.bar-right {
  white-space: nowrap;
}

/* The narrowest phones have room for the time but not "in Slovakia". It is
   hidden from sight only, so screen readers still say where the time is. */
@media (max-width: 22.4em) {
  .where {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

/* Dark mode toggle: a half-filled circle, top right. */
.theme {
  display: grid;
  place-items: center;
  padding: 0.35rem;
  margin: -0.15rem -0.35rem -0.15rem 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--dim);
  cursor: pointer;
}

.theme[hidden] {
  display: none;
}

.theme:hover {
  color: var(--ink);
}

.theme:focus-visible {
  outline: 2px solid var(--ink);
}

.theme svg {
  width: 1rem;
  height: 1rem;
}

/* The filled half sits on the right in light mode and flips to the left in
   dark mode. */
:root[data-theme="dark"] .theme svg {
  scale: -1 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme svg {
    scale: -1 1;
  }
}

.theme circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.theme path {
  fill: currentColor;
}

main {
  padding: 2rem 0 4rem;
}

section + section {
  margin-top: 2.5rem;
}

/* The "> " hangs in the margin, so a heading that wraps lines up under its
   first word. The grey note after it wraps as one piece. */
h2 {
  margin-bottom: 1rem;
  padding-left: 2ch;
  text-indent: -2ch;
}

h2 small {
  white-space: nowrap;
}

ul {
  padding-left: 2ch;
  list-style: "- ";
}

li::marker {
  color: var(--dim);
}

/* Windows: rounded frame, title bar with the three dots and a centred
   title. Content runs to the edges, the way the photo does. */

.window {
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.titlebar {
  display: grid;
  grid-template-columns: 4rem 1fr 4rem;
  align-items: center;
  padding: 0.3rem 0;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  font-size: 0.8em;
}

.dots {
  display: flex;
  gap: 0.45rem;
  padding-left: 0.7rem;
}

.dots span {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #ff5f57;
  box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.15);
}

.dots span:nth-child(2) {
  background: #febc2e;
}

.dots span:nth-child(3) {
  background: #28c840;
}

.title {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.window-body {
  padding: 0.75rem 1rem 0;
}

/* About: on phones the photo window runs the full width with the intro and
   the list under it; on wider screens it gets a column of its own beside
   them. The window is narrow there, so the title sits in the space after the
   dots. */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.about p {
  margin-bottom: 0;
}

.photo {
  margin: 0 0 0.5rem;
}

@media (min-width: 36rem) {
  .about {
    grid-template-columns: 11rem 1fr;
    grid-template-rows: auto 1fr;
    gap: 1rem 2rem;
    align-items: start;
  }

  .photo {
    grid-row: span 2;
    margin: 0.25rem 0 0;
  }

  .photo .titlebar {
    grid-template-columns: auto 1fr;
    padding-right: 0.5rem;
  }
}

/* Key/value list in About. Keys line up in one column. */

dl {
  display: grid;
  grid-template-columns: 10ch 1fr;
  gap: 0.2rem 1ch;
}

dt {
  color: var(--dim);
}

dd {
  overflow-wrap: anywhere;
}

/* Projects: one screenshot filling the window, then two lines of text. */

article + article {
  margin-top: 2.5rem;
}

article p {
  margin-bottom: 0.25rem;
}

/* Screenshot slider: the images sit in a row, one frame wide each, and the
   title bar shows "1/3". Without JavaScript the row scrolls sideways and
   snaps one image at a time. live.js adds .looping and moves the row itself
   (see further down) so it can loop forever. */

.counter {
  justify-self: end;
  padding-right: 0.7rem;
  color: var(--dim);
}

.slider {
  position: relative;
}

.slides {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.slides::-webkit-scrollbar {
  display: none;
}

.slides:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.slides img {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
}

/* --x is how many images the row is shifted by. Up-and-down swipes still
   scroll the page, and sideways ones don't trigger the browser's back
   gesture. */
.slides.looping {
  overflow: hidden;
  scroll-snap-type: none;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
}

.slides.looping img {
  transform: translateX(calc(var(--x) * -100%));
  will-change: transform;
}

/* Arrows: a bare chevron, blended with "difference" so it inverts whatever is
   behind it (light on dark screenshots, dark on light ones) without needing a
   shadow. Faint, and solid only while that arrow is hovered.
   The whole strip down the image edge is clickable. */
.arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 3rem;
  padding: 0;
  border: 0;
  background: none;
  color: #ffffff;
  opacity: 0.75;
  mix-blend-mode: difference;
  cursor: pointer;
}

.arrow[hidden] {
  display: none;
}

.prev {
  left: 0;
}

.next {
  right: 0;
}

.arrow:hover,
.arrow:focus-visible {
  opacity: 1;
}

.arrow:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -6px;
}

.arrow svg {
  width: 1.75rem;
  height: 1.75rem;
}

.arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Recently pushed: a bar per day, then repo names and dates in two columns. */

.activity {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 2.5rem;
  margin-bottom: 1rem;
}

.activity[hidden] {
  display: none;
}

.activity span {
  flex: 1;
  height: calc(var(--h) * 100%);
  min-height: 2px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
}

.activity .none {
  background: var(--line);
}

/* The names make a column and the dates follow it. On narrow screens the
   column shrinks, and a name too long for it is cut short with "…" rather
   than pushing its date onto a second line. */
.pushed li {
  white-space: nowrap;
}

.pushed .name {
  display: inline-flex;
  min-width: min(21ch, 100% - 11ch);
  max-width: calc(100% - 11ch);
}

.pushed .name a {
  overflow: hidden;
  text-overflow: ellipsis;
}
