/* Jan Aleksander Wojtaś: portfolio.
   Same direction as the plain BiType site: a white page, black Times New Roman,
   blue underlined links, nothing else. */

:root {
  color-scheme: only light;      /* always the white design, also in night mode */
  --name-size: min(8.2vw, 116px);
  /* The left margin is the BiType grid's margin, max(16px, 1vw): the J stands in the corner,
     its left edge where BiType's J stands, so the J hands over from one site to the other in
     the same place. */
  --m: max(16px, 1vw);
  --pad: var(--m);
}

* { box-sizing: border-box; }
html { background: #fff; }
body {
  margin: 0;
  background: #fff;
  color: #000;
  font-family: "Times New Roman", Times, Tinos, serif;
  font-size: 18px;
  line-height: 1.35;
  overflow-x: hidden;
}
a { color: #00e; }
a:visited { color: #00e; }          /* one blue, visited or not (as on BiType) */
a:focus-visible { outline: 2px solid #00e; outline-offset: 3px; }

/* ---- The name ---- */
.hero {
  min-height: 100vh;
  padding: 26vh var(--pad) 0;
}
.name {
  margin: 0;
  font-size: var(--name-size);
  font-weight: normal;
  line-height: 1;
  white-space: nowrap;
}
/* The drawn J takes exactly the room the typed letter would: 0.389em wide, cap height tall,
   sitting on the baseline. Whatever it grows into spills below without moving the text. */
.j { display: inline-block; position: relative; width: 0.38916em; height: 0.66211em; vertical-align: baseline; }
/* The J is three drawings stacked in the letter's place (see hook.js): the top stays,
   the stem slides out, the tail is moved. Moving is the one change a browser can make
   without redrawing, so the letter follows the scroll smoothly and stays sharp. */
.j svg { display: block; position: absolute; left: 0; width: 100%; overflow: visible; pointer-events: none; fill: #000; }
#j-top { top: 0; height: 0.26311em; }
/* The stem is drawn once at its full length and slides down from behind a window that
   starts where the letter is cut. It is never resized, so its edges stay sharp. */
.j-clip { display: block; position: absolute; left: 0; width: 100%; top: 0.26011em; height: 0; overflow: hidden; pointer-events: none; }
#j-stem { top: 0; height: 100%; transform: translateY(-100%); will-change: transform; }
#j-tail { top: 0.25911em; height: 0.422em; will-change: transform; }

/* Where the browser can tie an animation to the scroll position, it drives the J itself,
   in step with the page, with no script in between. hook.js sets --j-max (how far the
   tail travels on this screen). Other browsers are moved by hook.js. */
@supports (animation-timeline: scroll()) {
  #j-stem { animation: j-grow linear both; animation-timeline: scroll(root block); }
  #j-tail { animation: j-drop linear both; animation-timeline: scroll(root block); }
}
@keyframes j-grow { from { transform: translateY(-100%); } to { transform: translateY(0); } }
@keyframes j-drop { from { transform: translateY(0); } to { transform: translateY(var(--j-max, 0px)); } }

/* The final ś: on hover it becomes the logo, and it links to Instagram (as on the BiType site).
   The logo is set like a character. Its drawing fills only part of the 1024 x 1024 image
   (x 237 to 797, y 84 to 939), so the numbers below place the drawing, not the image:
   - height: the drawing is exactly as tall as a capital letter (0.662em);
   - floor: the bottom of the drawing stands on the baseline;
   - spacing: 0.04em of space on each side of the drawing, like a letter's side bearings. */
.name-s, .name-s:visited { color: inherit; text-decoration: none; }
.name-s-logo {
  display: none;
  height: 0.792em; width: 0.792em; max-width: none;
  vertical-align: -0.065em;
  margin: 0 -0.135em 0 -0.143em;
  filter: invert(1);              /* the image is white; invert it to show on white */
}
.name-s:hover .name-s-letter, .name-s:focus-visible .name-s-letter { display: none; }
.name-s:hover .name-s-logo, .name-s:focus-visible .name-s-logo { display: inline-block; }

/* ---- The white the line is let down through ---- */
.depth { height: 110vh; }

/* ---- What it reaches ---- */
.catch { padding: 0 var(--pad) 34vh; }
.projects { list-style: none; margin: 0; padding: 0; }
.projects li { margin: 0 0 0.6em; }
.projects a { font-size: 1.6em; }
.projects span { display: block; margin-top: 0.15em; }

footer {
  padding: 12px var(--pad) 16px;
  border-top: 1px solid #000;
  font-size: 14px;
}

/* ---- Phones ----
   The name is set large on three lines. "Aleksander" and "Wojtaś" are moved in by the
   width of the J, so the J's stem runs down the left edge beside them as it stretches. */
@media (max-width: 760px) {
  :root { --name-size: min(15.5vw, 72px); }
  body { font-size: 18px; }
  .hero { min-height: 0; padding-top: 14vh; padding-bottom: 12vh; }
  .name { white-space: normal; line-height: 1.04; }
  .name-part { display: block; padding-left: 0.389em; }
  .depth { height: 95vh; }
  .catch { padding-bottom: 30vh; }
  .projects a { display: inline-block; padding: 6px 0; font-size: 1.3em; }
  .projects li { margin-bottom: 0.9em; }
  .projects span { margin-top: 0; }
}


/* Coming from BiType: hidden for the moment it takes to set the scroll (index.html, hook.js) */
.arriving body { visibility: hidden; }

/* The index stands to the right of the J: the J's tail ends beside the first project, and
   the projects to come are listed down from there. */
.catch { padding-left: calc(var(--pad) + var(--name-size) * 0.389 + 28px); }

/* Going to a project: everything but the J slides up and away, the J stays (hook.js) */
.going .catch, .going footer, .going .name > :not(.j) {
  transform: translateY(var(--away, -100vh)); transition: transform .7s cubic-bezier(.5,0,.75,0);
}
.going .projects a { color: #00e; }
