@font-face {
  font-family: Inter;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212;
}
@font-face {
  font-family: Inter;
  src: url(fonts/inter-cyrillic-wght-normal.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Archivo;
  src: url(fonts/archivo-latin-wdth-normal.woff2) format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --ink: #0c0c0b;
  --ink-surface: #1b1b1a;
  --ink-pressed: #262625;
  --paper: #f3f3f0;
  --paper-surface: #e5e5e1;
  --paper-pressed: #d9d9d4;

  --background: #e9e9e6;
  --surface: #f8f8f6;
  --tab-resting: #dcdcd8;
  --text: var(--ink);
  --pressed: #eeeeeb;
  --cell-empty: #e3e3df;
  --cell-1: #bfbfba;
  --cell-2: #8c8c88;
  --cell-3: #555553;
  --cell-4: var(--ink);

  --gutter: 16px;
  --group-gap: 16px;
  --radius: 14px;
  --row-height: 50px;
  --cell: 11px;
  --cell-gap: 3px;
  --calendar-weeks: 53;
  --week-step: calc(var(--cell) + var(--cell-gap));
  --calendar-width: calc(var(--calendar-weeks) * var(--week-step) - var(--cell-gap));
  --sheet-padding: 24px;
  --tab-bar-height: 62px;
  --cat-width: 48px;
  --cat-height: 44px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --display: Archivo, Inter, -apple-system, system-ui, sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.6 -.55'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a09;
    --surface: #181817;
    --tab-resting: #121211;
    --text: #f3f3f0;
    --pressed: #232322;
    --cell-empty: #252524;
    --cell-1: #474745;
    --cell-2: #7a7a77;
    --cell-3: #b4b4b0;
    --cell-4: #f3f3f0;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 400 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  font-feature-settings: "cv11", "ss03";
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.icon-sprite, .filters { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Folder */

.folder { padding: 0 var(--gutter) calc(var(--tab-bar-height) + env(safe-area-inset-bottom) + var(--gutter)); }

.tabs {
  position: fixed;
  z-index: 2;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  height: calc(var(--tab-bar-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 450;
  text-decoration: none;
}
.tab[aria-current="page"] { font-weight: 800; }
.tab[aria-current="page"] .icon { stroke-width: 2.5; }

.sheet { display: grid; gap: var(--group-gap); padding-top: var(--gutter); }

/* Groups */

.group { min-width: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--row-height);
  padding: 13px 16px;
  text-decoration: none;
  transition: background-color 150ms var(--ease);
}
a.row:hover, a.row:active { background: var(--pressed); }

.row-name { flex: none; font-size: 16px; font-weight: 600; }
.row-value { flex: 1; min-width: 0; text-align: right; font-size: 15px; font-weight: 450; overflow-wrap: anywhere; }
.chevron { flex: none; width: 16px; height: 16px; margin-left: -6px; }

/* Header */

.identity { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.avatar { display: block; width: 60px; height: 60px; border-radius: 50%; object-fit: cover; filter: grayscale(1); }
.identity h1 { margin: 0; font: 800 34px/1 var(--display); font-stretch: 125%; letter-spacing: -.03em; }

/* Calendar */

.calendar-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px 0; min-height: 48px; }
.calendar-readout { font-size: 16px; font-weight: 600; }
.calendar-year-menu { position: relative; flex: none; display: flex; align-items: center; }
.calendar-year-menu .icon { position: absolute; right: 0; width: 16px; height: 16px; pointer-events: none; }
.calendar-year {
  appearance: none;
  border: 0;
  padding: 0 20px 0 0;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: right;
  cursor: pointer;
}
.calendar-year option { background: var(--surface); color: var(--text); }

.calendar-scroll { overflow-x: auto; padding: 0 16px 13px; scrollbar-width: none; overscroll-behavior-x: contain; }
.calendar-scroll::-webkit-scrollbar { display: none; }
.calendar-canvas { position: relative; width: var(--calendar-width); padding-top: calc(var(--cat-height) + 4px); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(var(--calendar-weeks), var(--cell));
  grid-template-rows: repeat(7, var(--cell));
  gap: var(--cell-gap);
  touch-action: pan-x;
}
.cell { display: block; border-radius: 3px; background: var(--cell-empty); }
.cell[data-level="1"] { background: var(--cell-1); }
.cell[data-level="2"] { background: var(--cell-2); }
.cell[data-level="3"] { background: var(--cell-3); }
.cell[data-level="4"] { background: var(--cell-4); }
.cell:hover { outline: 1.5px solid var(--text); outline-offset: 1px; }

.calendar-months { position: relative; height: 22px; font-size: 13px; font-weight: 450; }
.calendar-months span { position: absolute; top: 5px; left: calc(var(--week) * var(--week-step)); }

.cat {
  position: absolute;
  top: 4px;
  left: clamp(0px, calc(var(--week) * var(--week-step) + var(--cell) / 2 - 20px), calc(var(--calendar-width) - var(--cat-width)));
  width: var(--cat-width);
  height: 58px;
  color: var(--text);
  pointer-events: none;
}

/* Repositories */

.repository { align-items: flex-start; }
.repository .icon { margin-top: 1px; }
.repository .chevron { align-self: center; }
.repository-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.repository-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.repository-description { font-size: 15px; line-height: 1.32; overflow-wrap: anywhere; }
.repository-facts { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; font-weight: 450; }

/* README */

.readme { padding: 13px 16px; font-size: 15px; }
.readme article { display: grid; gap: 12px; }
.readme p, .readme table { margin: 0; }
.readme samp { font: inherit; }
.readme [align] { text-align: left; }
.readme p { font-weight: 500; }
.readme table { width: 100%; border-collapse: collapse; }
.readme th, .readme td { padding: 4px 12px 4px 0; text-align: left; vertical-align: top; }
.readme th { font-size: 13px; font-weight: 600; }
.readme th:last-child, .readme td:last-child { padding-right: 0; text-align: right; }
.readme a { text-underline-offset: 2px; text-decoration-thickness: 1px; font-weight: 600; }

/* Projects: screens alternate ink and paper regardless of the system theme */

.sheet[data-screen="projects"] { gap: 0; padding-top: 0; margin: 0 calc(-1 * var(--gutter)); }

.screen {
  --surface: var(--paper-surface);
  --pressed: var(--paper-pressed);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 56px var(--gutter) 64px;
  background: var(--paper);
  color: var(--ink);
}
.screen:nth-child(odd) {
  --surface: var(--ink-surface);
  --pressed: var(--ink-pressed);
  background: var(--ink);
  color: var(--paper);
}

.screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: var(--grain);
  opacity: .07;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.screen:nth-child(odd)::after { opacity: .09; mix-blend-mode: screen; }

.smoke {
  position: absolute;
  z-index: -2;
  inset: -10% -40% -10% -10%;
  width: 150%;
  height: 120%;
  opacity: .17;
  pointer-events: none;
  animation: drift 70s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes drift {
  to { transform: translate3d(-22%, -4%, 0) scale(1.08); }
}

.screen-body { display: grid; gap: 20px; max-width: 1040px; margin: 0 auto; }

.project-title {
  margin: 0;
  font: 800 clamp(52px, 15vw, 128px)/.86 var(--display);
  font-stretch: 125%;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.project-tagline { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.project-description { margin: 0; max-width: 58ch; font-size: 17px; font-weight: 450; line-height: 1.45; }
.project-columns { display: grid; gap: 20px; align-items: start; }

.project-screenshot {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  filter: grayscale(1) contrast(1.08);
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border-radius: 12px;
  background: currentColor;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 150ms var(--ease);
}
.button span { color: var(--ink); }
.screen:nth-child(even) .button span { color: var(--paper); }
.button:active { opacity: .85; }

.toast {
  position: fixed;
  z-index: 3;
  inset: var(--gutter) var(--gutter) auto;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--background);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
}

/* Desktop: a real folder, with one sheet as the only surface */

@media (min-width: 860px) {
  :root { --cell: 14px; }

  .folder {
    width: calc(var(--calendar-width) + 2 * var(--sheet-padding));
    margin: 0 auto;
    padding: 28px 0 40px;
  }

  .tabs {
    position: static;
    display: flex;
    gap: 2px;
    height: auto;
    padding: 0 var(--radius);
    background: none;
  }

  .tab {
    position: relative;
    flex-direction: row;
    height: 40px;
    padding: 0 20px;
    border-radius: 11px 11px 0 0;
    background: var(--tab-resting);
    font-size: 15px;
    font-weight: 500;
    transition: background-color 150ms var(--ease);
  }
  .tab .icon { display: none; }
  .tab:hover { background: var(--surface); }
  .tab[aria-current="page"] { z-index: 1; background: var(--surface); font-weight: 700; }

  /* Concave feet join the active tab to the sheet the way a paper folder tab does. */
  .tab[aria-current="page"]::before,
  .tab[aria-current="page"]::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 11px;
    height: 11px;
    background: var(--surface);
    -webkit-mask: radial-gradient(circle 11px at var(--foot-x) 0, transparent 10.5px, #000 11px);
    mask: radial-gradient(circle 11px at var(--foot-x) 0, transparent 10.5px, #000 11px);
  }
  .tab[aria-current="page"]::before { left: -11px; --foot-x: 0; }
  .tab[aria-current="page"]::after { right: -11px; --foot-x: 100%; }

  .sheet {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
    gap: 8px 32px;
    padding: 12px calc(var(--sheet-padding) - 16px) 16px;
    border-radius: var(--radius);
    background: var(--surface);
  }

  /* The sheet is the only surface here, so groups dissolve into it. */
  .sheet[data-screen="profile"] .group { background: none; border-radius: 0; overflow: visible; }
  .sheet[data-screen="profile"] a.row { border-radius: 10px; }
  .identity, .span-all { grid-column: 1 / -1; }
  .column { display: grid; gap: 8px; min-width: 0; }
  .list { margin-top: 16px; }

  .calendar-scroll { overflow: visible; }

  /* The active tab is the colour of the first screen, so the folder still reads as one piece. */
  .sheet[data-screen="projects"] { display: block; margin: 0; padding: 0; overflow: hidden; background: var(--ink); }
  .tabs:has(.tab[href="#projects"][aria-current="page"]) .tab[aria-current="page"] { background: var(--ink); color: var(--paper); }
  .tabs:has(.tab[href="#projects"][aria-current="page"]) .tab[aria-current="page"]::before,
  .tabs:has(.tab[href="#projects"][aria-current="page"]) .tab[aria-current="page"]::after { background: var(--ink); }

  .screen { padding: 72px 48px 80px; }
  .screen-body { gap: 28px; }
  .project-tagline { font-size: 26px; }
  .project-columns { grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; }
  .button { width: 280px; }
  .toast { inset: 16px auto auto 50%; transform: translateX(-50%); }
}

@media (max-width: 859px) {
  .column { display: contents; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
