/* Viktor Ferus – osobní web. Písmo: Martian Mono (SIL OFL 1.1), viz assets/fonts/OFL.txt
 *
 * The page is not a document but a scene, like the menu of a game: nothing scrolls, the camera moves.
 * <html data-view="home|cv|kontakt"> selects the view; everything that changes between views is a CSS
 * transition, and the camera of the 3D scene frames the figure into the visible ".slot" of the view. */

@font-face {
  font-family: "Martian Mono";
  src: url("../assets/fonts/MartianMono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-0: #050a18;
  --bg-1: #08122b;
  --ink: #e9effc;
  --ink-dim: #8fa2cc;
  --ink-faint: #56678f;
  --accent: #6fdcff;
  --accent-soft: rgba(111, 220, 255, 0.35);
  --line: rgba(143, 162, 204, 0.32);
  --font: "Martian Mono", ui-monospace, "DejaVu Sans Mono", "Liberation Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --io: cubic-bezier(0.65, 0, 0.35, 1);          /* camera-like: gentle start and stop */
  --move: 1.3s;                                   /* keep in step with MOVE_S in js/main.js */
  --enter-delay: 0.5s;                            /* set by js/main.js: shorter when only the text changes */

  /* where things stand on the landing screen (desktop); the page views move them away from here */
  --site-x: 11vw;
  --site-y: 29vh;
  --ext-x: 10vw;
  --ext-y: 29vh;
  /* the in-site menu in the page views: top left corner, small */
  --menu-x: 2.6rem;
  --menu-y: 2.2rem;
  --menu-scale: 0.42;
  /* 1 % of the height that is surely visible: on phones vh is the height with the browser's toolbars hidden,
     but the page never scrolls, so they stay on screen and cover the bottom of a 100vh layout */
  --sh: 1vh;
  color-scheme: dark;
}
@supports (height: 1svh) { :root { --sh: 1svh; } }

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

html {
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-stretch: 87.5%;
  font-weight: 400;
  color: var(--ink);
  /* no background here: it would cover the fixed canvases behind the page (see html) */
  text-transform: uppercase;
  letter-spacing: 0.04em;
  -webkit-font-smoothing: antialiased;
}

/* first paint and direct links: no transitions until the page has settled (js/main.js removes the class) */
.is-instant *, .is-instant *::before, .is-instant *::after { transition: none !important; }

/* ---------- background: triangles (2D canvas), vignette, the 3D stage */
.bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
  background: linear-gradient(160deg, var(--bg-1), var(--bg-0) 55%, #060c20);
  transition: transform var(--move) var(--io);
}
/* the far background drifts a little against the camera move: depth */
html:not([data-view="home"]) .bg { transform: translateX(2.2vw) scale(1.06); }

.bg-veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(2, 5, 14, 0.72) 100%);
}
/* a dark wash behind the text column of the page views */
.bg-veil::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(3, 7, 18, 0.62), rgba(3, 7, 18, 0.35) 45%, transparent 65%);
  opacity: 0;
  transition: opacity var(--move) var(--io);
}
html:not([data-view="home"]) .bg-veil::after { opacity: 1; }

.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

/* Slots: invisible rectangles the camera fits the figure into (head top .. chest, shoulder to shoulder).
   --orbit: from how far to the side the camera looks (degrees, > 0 = camera to the left);
   --fit: "height" lets the shoulders run past the slot (close-up), "both" keeps the whole bust inside. */
.slot { position: fixed; visibility: hidden; pointer-events: none; }
.slot--home {
  --h: min(80vh, 78vw);
  --orbit: 0;
  --fit: both;
  height: var(--h);
  width: calc(var(--h) * 1.12);
  left: calc(50% - var(--h) * 0.56);
  bottom: 0;
}
.slot--page {
  --orbit: 16;
  --fit: height;
  left: 52vw;
  width: 46vw;
  top: 15vh;
  height: 96vh;
}

.stage-status {
  position: fixed;
  left: 0;
  right: 0;
  top: 58%;
  margin: 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  pointer-events: none;
  transition: opacity 0.4s;
}
.is-ready .stage-status { opacity: 0; }

/* ---------- name + greeting */
.masthead {
  position: fixed;
  top: clamp(1.2rem, 6.2vh, 4.5rem);
  left: 50%;
  z-index: 3;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
  transform-origin: 50% 0;
  transition: transform var(--move) var(--io), left var(--move) var(--io), top var(--move) var(--io);
}
html:not([data-view="home"]) .masthead { transform: translateX(-50%) scale(0.8); }

.title {
  margin: 0;
  font-size: clamp(2rem, min(5.5vw, 8.6vh), 6rem);
  font-weight: 300;
  font-stretch: 112.5%;
  letter-spacing: 0.06em;
  line-height: 1.05;
}
.title__link {
  color: inherit;
  text-decoration: none;
  text-shadow: 0 0 28px rgba(111, 220, 255, 0.18);
  outline: none;
  transition: text-shadow 0.25s, color 0.2s;
}
/* on the landing screen the name is a heading; in the page views it is the way back */
html[data-view="home"] .title__link { cursor: default; }
html:not([data-view="home"]) .title__link:hover,
.title__link:focus-visible { color: #fff; text-shadow: 0 0 26px var(--accent-soft); }

.subtitle {
  margin: 0.55em 0 0;
  font-size: clamp(0.72rem, min(1.35vw, 2.3vh), 1.35rem);
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  min-height: 1.4em;
  transition: opacity 0.5s;
}
html:not([data-view="home"]) .subtitle { opacity: 0; }
.caret {
  display: inline-block;
  width: 0.62em;
  height: 1.05em;
  margin-left: 0.18em;
  vertical-align: -0.16em;
  background: var(--accent);
  opacity: 0.85;
  animation: caret 1.05s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.caret.is-typing { animation: none; opacity: 0.85; }

/* ---------- menus. The box of a menu is its list; the label hangs above it, so that the list alone can travel
   to the corner. */
.menu { position: fixed; z-index: 3; }
.menu--site {
  left: var(--site-x);
  top: var(--site-y);
  transform-origin: 0 0;
  transition: transform var(--move) var(--io);
}
html:not([data-view="home"]) .menu--site {
  transform: translate(calc(var(--menu-x) - var(--site-x)), calc(var(--menu-y) - var(--site-y))) scale(var(--menu-scale));
}
.menu--ext {
  right: var(--ext-x);
  top: var(--ext-y);
  transition: opacity 0.6s, transform 0.9s var(--io), visibility 0s;
}
html:not([data-view="home"]) .menu--ext {
  opacity: 0;
  visibility: hidden;
  transform: translateX(4vw);
  transition: opacity 0.5s, transform 0.9s var(--io), visibility 0s linear 0.9s;
}

.menu__label {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin: 0 0 0.9em;
  font-size: clamp(0.66rem, min(1.2vw, 2.1vh), 1.2rem);
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: opacity 0.4s;
}
html:not([data-view="home"]) .menu__label { opacity: 0; }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu li { margin: 0; line-height: 1; }
.menu li + li { margin-top: clamp(0.5rem, 1.5vh, 1.1rem); }

.link {
  position: relative;
  display: inline-block;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(1.5rem, min(3.3vw, 5.8vh), 4rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.1;
  outline: none;
  transition: font-weight 0.16s var(--ease), color 0.2s, text-shadow 0.25s;
}
.link::before,
.link::after {
  position: absolute;
  top: 0;
  font-weight: 300;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.16s, transform 0.22s var(--ease);
  pointer-events: none;
}
.link::before { content: "["; right: 100%; margin-right: 0.42em; transform: translateX(0.35em); }
.link::after { content: "]"; left: 100%; margin-left: 0.36em; transform: translateX(-0.35em); }

.link:hover,
.link:focus-visible {
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 22px var(--accent-soft);
}
.link:hover::before, .link:focus-visible::before,
.link:hover::after, .link:focus-visible::after,
.link[aria-current="page"]::before, .link[aria-current="page"]::after { opacity: 1; transform: none; }
.link[aria-current="page"] { color: #fff; }

/* ---------- page views (CV, Kontakt): text standing in the space left of the figure */
.page {
  position: fixed;
  z-index: 2;
  left: 12vw;
  top: 20vh;
  width: min(40vw, 46rem);
  max-height: calc(100vh - 20vh - 2.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  padding: 0 1rem 0.5rem 0;
  /* leaving: quick, no delay */
  opacity: 0;
  visibility: hidden;
  transform: perspective(1600px) translate3d(-2.5rem, 0, 0) rotateY(9deg);
  transform-origin: 0 50%;
  transition: opacity 0.35s, transform 0.5s var(--io), visibility 0s linear 0.5s;
}
.page.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.7s ease var(--enter-delay), transform 1s var(--ease) var(--enter-delay), visibility 0s;
}
/* lines come in one after another (js/main.js numbers them: --i) */
.page > * {
  opacity: 0;
  transform: translateX(-0.8rem);
  transition: opacity 0.25s, transform 0.25s;
}
.page.is-active > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease calc(var(--enter-delay) + 0.1s + var(--i, 0) * 0.07s),
              transform 0.8s var(--ease) calc(var(--enter-delay) + 0.1s + var(--i, 0) * 0.07s);
}

.page__title {
  margin: 0 0 0.25em;
  font-size: clamp(2rem, min(4.6vw, 8vh), 5rem);
  font-weight: 300;
  font-stretch: 112.5%;
  letter-spacing: 0.06em;
  line-height: 1;
  outline: none;
}
.page__lead {
  margin: 0 0 min(2.2em, 3.2vh);
  font-size: clamp(0.62rem, min(0.95vw, 1.7vh), 0.9rem);
  line-height: 1.6;
  letter-spacing: 0.14em;
  color: var(--accent);
}
.page__label {
  margin: 2.6em 0 1em;
  font-size: clamp(0.6rem, min(0.85vw, 1.6vh), 0.85rem);
  letter-spacing: 0.14em;
  color: var(--ink-dim);
}

/* running text reads better in normal case; headings, labels and tags stay in capitals */
.bullets {
  list-style: none;
  margin: 0 0 min(1.5em, 2.2vh);
  padding: 0;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: clamp(0.78rem, min(1.02vw, 1.95vh), 1.05rem);
  line-height: 1.55;
}
.bullets li { position: relative; padding-left: 1.5em; }
.bullets li + li { margin-top: 0.4em; }
.bullets li::before { content: "–"; position: absolute; left: 0; color: var(--accent); }
.bullets strong { font-weight: 600; }

.inline-link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  outline: none;
  transition: color 0.2s, border-color 0.2s;
}
.inline-link:hover, .inline-link:focus-visible { color: var(--accent); border-color: var(--accent); }

.tags {
  list-style: none;
  margin: min(2.2em, 3vh) 0 min(1.8em, 2.6vh);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 40rem;
}
.tags li {
  padding: 0.35em 0.65em;
  font-size: clamp(0.56rem, min(0.72vw, 1.35vh), 0.76rem);
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  background: rgba(8, 16, 40, 0.4);
}

.langs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 1em;
  margin: 0;
  font-size: clamp(0.62rem, min(0.9vw, 1.65vh), 0.9rem);
  letter-spacing: 0.12em;
}
.langs__sep { color: var(--ink-faint); }

/* Kontakt */
.mail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.4rem;
  margin: 0;
}
.mail__link {
  color: #fff;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: clamp(1rem, min(1.9vw, 3.4vh), 1.9rem);
  border-bottom: 1px solid var(--accent-soft);
  outline: none;
  transition: color 0.2s, border-color 0.2s, text-shadow 0.25s;
  overflow-wrap: anywhere;
}
.mail__link:hover, .mail__link:focus-visible { color: var(--accent); border-color: var(--accent); text-shadow: 0 0 22px var(--accent-soft); }

.button,
.mail__copy,
.sound-toggle {
  padding: 0.7em 1em;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  background: rgba(8, 16, 40, 0.6);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.mail__copy:hover, .mail__copy:focus-visible { color: var(--ink); border-color: var(--accent); outline: none; }
.mail__copy.is-done { color: var(--accent); border-color: var(--accent); }

.contact-links {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: clamp(0.72rem, min(0.95vw, 1.8vh), 0.95rem);
}
.contact-links li + li { margin-top: 0.85em; }
.contact-links a { text-transform: none; letter-spacing: 0.02em; border-bottom-color: transparent; }
.contact-links a span {
  display: inline-block;
  min-width: 6.5em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.contact-links a:hover { border-bottom-color: var(--accent); }

/* ---------- sound switch */
/* bottom right corner: language switch and sound */
.corner {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}
.sound-toggle { backdrop-filter: blur(6px); }
.lang-switch {
  display: flex;
  background: rgba(8, 16, 40, 0.6);
  border: 1px solid var(--line);
  border-radius: 2px;
  backdrop-filter: blur(6px);
}
.lang-switch button {
  padding: 0.7em 0.8em;
  font: inherit;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.2s;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button[aria-pressed="true"] { color: var(--accent); cursor: default; }
.lang-switch button[aria-pressed="false"]:hover, .lang-switch button:focus-visible { color: var(--ink); outline: none; }

/* English visitors: the Czech texts of the page stay hidden until js/main.js has swapped them */
html.i18n-pending .subtitle, html.i18n-pending .menu, html.i18n-pending .pages, html.i18n-pending .corner { visibility: hidden; }
.sound-toggle:hover, .sound-toggle:focus-visible { color: var(--ink); border-color: var(--accent); outline: none; }
.sound-toggle::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.7em;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.sound-toggle[aria-pressed="false"]::before { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-faint); }

:focus-visible { outline: 1px dashed var(--accent); outline-offset: 0.3em; }
.link:focus-visible { outline: none; }

/* ---------- lower landscape screens: the CV has to fit without scrolling. First only the vertical rhythm gets
   tighter (the text stays where it is, next to the figure); only on small screens does the column also move
   to the left and widen, so that fewer lines wrap. */
@media (max-height: 1000px) and (min-aspect-ratio: 1/1) {
  .page { top: 17vh; max-height: calc(100vh - 17vh - 1.25rem); }
  .page__title { font-size: clamp(2rem, min(4.6vw, 7vh), 5rem); }
  .page__lead { margin-bottom: min(1.8em, 2.4vh); }
  .bullets { margin-bottom: min(1.3em, 1.9vh); line-height: 1.5; }
  .bullets li + li { margin-top: min(0.4em, 0.6vh); }
  .tags { margin: min(1.8em, 2.4vh) 0 min(1.6em, 2.2vh); gap: min(0.45rem, 0.6vh); }
}
@media (max-height: 900px) and (min-aspect-ratio: 1/1), (max-width: 1600px) and (min-aspect-ratio: 1/1) {
  .page { left: 10vw; width: min(42vw, 46rem); }
}
@media (max-height: 760px) and (min-aspect-ratio: 1/1), (max-width: 1300px) and (min-aspect-ratio: 1/1) {
  .page { left: 8vw; width: min(44vw, 46rem); }
}

/* ---------- portrait screens (phones, narrow windows)
   Landing: name on top, figure in the middle, both menus at the bottom.
   Page views: menu small in the top left corner, name small in the top right, the figure (head and shoulders)
   below them, the text underneath it in its own scrolling panel. */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  :root {
    --link-size: clamp(1.15rem, 6vw, 2rem);
    --link-gap: clamp(0.5rem, calc(1.5 * var(--sh)), 1.1rem);
    --corner-h: 4.6rem;                           /* language / sound switch at the bottom, with a margin */
    --site-x: 8vw;
    /* the menus stand on the bottom of the visible area: the three outer links, then the corner under them */
    --site-y: calc(100 * var(--sh) - var(--corner-h) - 3 * 1.1 * var(--link-size) - 2 * var(--link-gap));
    --ext-x: 8vw;
    --ext-y: var(--site-y);
    --menu-x: 1.5rem;
    --menu-y: 1.1rem;
    --menu-scale: 0.55;
  }
  .title { font-size: clamp(1.6rem, 8.6vw, 3.6rem); }
  .subtitle { font-size: clamp(0.6rem, 2.6vw, 1rem); }
  /* the figure fills what the name and the menu labels (two lines above the menus) leave free */
  .slot--home { left: 0; width: 100vw; top: calc(16 * var(--sh)); bottom: auto; height: calc(var(--site-y) - 2.8rem - 16 * var(--sh)); }
  /* the chest runs on under the text panel, which covers it */
  .slot--page { --orbit: 12; left: 28vw; width: 66vw; top: 8vh; height: 50vh; }
  .link { font-size: var(--link-size); }
  .menu li + li { margin-top: var(--link-gap); }
  .menu__label { font-size: 0.56rem; white-space: normal; width: 11em; }

  html:not([data-view="home"]) .masthead { left: calc(100% - 1rem); transform: translateX(-100%) scale(0.5); transform-origin: 100% 0; top: 1rem; }

  .bg-veil::after { background: linear-gradient(180deg, transparent 30%, rgba(3, 7, 18, 0.5) 50%, rgba(3, 7, 18, 0.7)); }

  .page {
    left: 0;
    right: 0;
    top: 44vh;
    bottom: 0;
    width: auto;
    max-height: none;
    padding: 2.6rem 1.4rem 5rem;
    transform: translate3d(0, 1.5rem, 0);
    background: linear-gradient(180deg, rgba(5, 10, 24, 0), rgba(5, 10, 24, 0.9) 2.4rem, rgba(5, 10, 24, 0.94));
  }
  .page__title { font-size: clamp(1.7rem, 8vw, 3rem); }
  .bullets { font-size: clamp(0.8rem, 3.5vw, 1rem); }
  .tags li { font-size: clamp(0.56rem, 2.5vw, 0.72rem); }
  .langs, .page__lead, .page__label { font-size: clamp(0.58rem, 2.6vw, 0.8rem); }
  .contact-links { font-size: clamp(0.72rem, 3.3vw, 0.95rem); }
  .mail__link { font-size: clamp(1rem, 4.6vw, 1.5rem); }
}

/* short landscape screens (a phone on its side): smaller name, menus higher */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  :root { --site-y: 34vh; --ext-y: 34vh; --menu-y: 1rem; --menu-x: 1rem; }
  .page { top: 24vh; max-height: calc(100vh - 24vh - 1rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; animation: none !important; }
}
