/* ==========================================================================
   Johhan Rosenberg — shared styles (every page)
   Header (name, home button, menu button), menu, footer, and the
   scaling system. The header and menu are written into each page by js/menu.js.

   Scaling: desktop pages are drawn on a 1440px-wide canvas, like the Wix
   Studio site. On screens 900px and wider, 1rem = 10px at 1440px and grows or
   shrinks with the window, so the composition always stays the same.
   Example: something 57px from the left on the Wix site is "5.7rem" here.
   On phones (under 900px), 1rem is simply 10px and pages use their own layout.
   ========================================================================== */

:root {
  --black: #000;
  --white: #fff;
  --grey-bg: #f0f0f0;
  --mint: #e7f5f2;
  --footer: #c2c2c2;
  --frame: #6e6e6e;
  --blue: #1a6aff;
  --purple: #cb01f7;
  --pink-bar: #ffb6f2;   /* the scroll bar: a stronger shade of the menu tag's pink (#ffebff) */

  --sans: Helvetica, "Helvetica Neue", Arial, sans-serif;

  /* Space left free at the top of a page, under the floating header buttons
     (pages that open with a full-bleed picture or video set it to 0). */
  --header-h: 7.2rem;
}

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

/* Pink scroll bar on every page (Chrome and Firefox read scrollbar-color, Safari the -webkit- rules) */
html { scrollbar-color: var(--pink-bar) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pink-bar); border-radius: 10px; }

@media (min-width: 900px) {
  html { font-size: calc(100vw / 144); }
  /* 104px, the height of the original Wix header */
  :root { --header-h: 10.4rem; }
}

/* Only the characters of the little "--x--" tag on the menu button (Rokkitt, SIL Open Font License) */
@font-face {
  font-family: "Rokkitt Tag";
  src: url("../fonts/rokkitt-tag-500.woff2") format("woff2");
  font-weight: 400 700;
  font-display: block;
}

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

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--sans);
  font-size: 1.6rem;
  line-height: 1.15;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Links to pages that aren't rebuilt yet: visible, but not clickable. */
.is-soon { pointer-events: none; cursor: default; }

/* ---------- Header ----------
   A small name on the left; on the right the round home button and the grey
   menu pill from the original Wix site. Nothing behind them: they float over
   the page. The name inverts against whatever is under it, so it stays
   readable on light and dark pages (that's why it is fixed on its own and
   the header itself has no box). */

.site-name {
  position: fixed;
  z-index: 50;
  top: 3rem;
  left: 1.6rem;
  color: var(--white);
  mix-blend-mode: difference;
  font-family: var(--sans);
  font-size: 1.3rem;
  line-height: 1;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.site-controls {
  position: fixed;
  z-index: 50;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.home-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 3.8rem;
  border-radius: 20rem;
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.home-button svg { width: 2.8rem; height: 2.8rem; fill: #0b2f5b; }

.menu-button {
  display: flex;
  align-items: center;
  width: 8rem;
  height: 5.2rem;
  padding-right: 2rem;
  border-radius: 30rem;
  /* Matches the original: 32% white over the black page */
  background: rgba(90, 90, 90, 0.9);
}
.menu-button svg { flex: none; width: 3.4rem; height: 3.4rem; fill: var(--white); }

.menu-tag {
  background: #ffebff;
  color: var(--black);
  font-family: "Rokkitt Tag", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.8rem;
  white-space: nowrap;
}

.home-button:hover, .menu-button:hover { filter: brightness(1.12); }


/* Two languages. Something marked data-l="et" shows only on the Estonian site,
   data-l="en" only on the English one; everything else (texts that exist in one
   language) always shows. The choice is set on <html data-lang> by js/menu.js. */
html:not([data-lang="et"]) [data-l="et"],
html[data-lang="et"] [data-l="en"] { display: none !important; }

@media (min-width: 900px) {
  /* Same sizes as on the original site at 1440px wide */
  .site-name { top: 4.4rem; left: 5.7rem; font-size: max(1.3rem, 12px); }
  .site-controls { top: 2rem; right: 5.7rem; gap: 0.7rem; }
  .home-button { width: max(3.8rem, 30px); height: max(3.6rem, 28px); }
  .home-button svg { width: max(2.7rem, 21px); height: max(2.7rem, 21px); }
  .menu-button { width: max(9.2rem, 64px); height: max(6.1rem, 42px); padding-right: max(2.5rem, 16px); }
  .menu-button svg { width: max(3.8rem, 28px); height: max(3.8rem, 28px); }
  .menu-tag { font-size: max(1.6rem, 12px); line-height: max(2rem, 15px); }
}

/* ---------- Menu ----------
   Small and quiet, like the menu of the original Wix site: a narrow, light, see-through
   stripe down the right edge holds a short list under the menu button; the rest of the
   page stays as it is. "Work +" opens the works, newest first, each with its year, and
   the stripe widens to fit them. A click anywhere outside the stripe closes the menu. */

.menu { position: fixed; inset: 0; z-index: 100; }
.menu[hidden] { display: none; }

.menu-backdrop { position: absolute; inset: 0; }

/* While the menu is open the home button stays on top of it and can be pressed;
   the menu button hides under the × */
html.menu-open .site-controls { z-index: 110; }
html.menu-open .menu-button { visibility: hidden; }

.menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: max-content;
  min-width: 17rem;              /* always wide enough to hold the home button and the × */
  max-width: 100%;
  overflow-y: auto;
  padding: calc(var(--header-h) + 0.4rem) 1.8rem 2.4rem 2.8rem;
  background: rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--black);
  font-size: 1.5rem;
  line-height: 1.35;
  text-align: right;
}

.menu-panel > ul > li { padding: 0.45rem 0; }
.menu-panel a { color: inherit; text-decoration: none; }
.menu-panel a:hover, .menu-panel a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.2em; }
.menu-panel .is-soon { opacity: 0.45; }

/* The × sits in the middle of where the menu button is */
.menu-close {
  position: fixed;
  top: 2.6rem;
  right: 4rem;
  width: 2rem;
  height: 2rem;
  color: var(--black);
}
.menu-close svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.5; }

/* "Work +" opens the list of works */
.sub-toggle { color: inherit; line-height: inherit; }
.sub-toggle:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.sub-toggle span { display: inline-block; margin-left: 0.4rem; transition: transform 0.2s; }
.sub-toggle[aria-expanded="true"] span { transform: rotate(45deg); }

.menu-panel .sub { display: none; padding: 0.6rem 0 0.4rem; font-size: 0.87em; }
.menu-panel .sub.is-open { display: block; }
.menu-panel .sub li { padding: 0.15rem 0; }
.menu-panel .sub .m-all { padding-top: 0.6rem; }        /* "All works" under the list, a little apart */
.menu-panel .m-work { margin-bottom: 1.2rem; }         /* a little space under the list of works */
.menu-year { margin-left: 0.5rem; font-size: 0.85em; opacity: 0.5; }

/* Order of the menu, different in English and Estonian */
.menu-panel > ul { display: flex; flex-direction: column; align-items: flex-end; }
/* English: Work, Blog, Archive, CONTACT (26 Oct 2026; Collaborations left the menu the same day) */
.m-work { order: 1; }
.m-blog { order: 2; }
.m-archive { order: 3; }
.m-cv { order: 4; }
/* Estonian: PORTFOLIO, KONTAKT, arhiiv, blog (26 Oct 2026) */
html[data-lang="et"] .m-work { order: 1; }
html[data-lang="et"] .m-cv { order: 3; }
html[data-lang="et"] .m-archive { order: 4; }
html[data-lang="et"] .m-blog { order: 5; }

/* EN / ET, apart at the bottom of the menu */
.menu-lang { display: flex; justify-content: flex-end; gap: 1.2rem; margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid rgba(0, 0, 0, 0.25); font-size: 0.87em; letter-spacing: 0.06em; }
.menu-lang button { color: rgba(0, 0, 0, 0.45); }
.menu-lang button:hover { color: var(--black); }
.menu-lang button[aria-pressed="true"] { color: var(--black); text-decoration: underline; text-underline-offset: 0.25em; }

@media (min-width: 900px) {
  .menu-panel { min-width: calc(5.7rem + max(9.2rem, 64px) + 0.7rem + max(3.8rem, 30px) + 2.8rem); padding-right: 5.7rem; font-size: max(1.4rem, 13px); }
  .menu-close {
    top: calc(2rem + max(6.1rem, 42px) / 2 - max(1rem, 8px));
    right: calc(5.7rem + max(9.2rem, 64px) / 2 - max(1rem, 8px));
    width: max(2rem, 16px);
    height: max(2rem, 16px);
  }
}

/* ---------- Previous / next work (bottom of every work page, filled by js/works.js) ---------- */

.work-nav {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  padding: 4rem 1.6rem;
  color: var(--nav-color, #000);
  font-family: var(--sans);
}
.work-nav a, .work-nav span { color: inherit; text-decoration: none; }
.work-nav-prev, .work-nav-next { display: flex; align-items: center; gap: 1.2rem; max-width: 48%; }
.work-nav-next { margin-left: auto; text-align: right; }
.work-nav-arrow { font-size: 3.6rem; line-height: 1; }
.work-nav-label { display: flex; flex-direction: column; }
.work-nav-hint { font-size: 1.2rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.work-nav-title { font-size: 1.8rem; line-height: 1.2; }
.work-nav a:hover .work-nav-title { text-decoration: underline; }
.work-nav .is-soon { opacity: 0.45; pointer-events: auto; cursor: default; }

@media (min-width: 900px) {
  .work-nav { padding: 6rem 5.7rem; }
  .work-nav-arrow { font-size: 4.8rem; }
  .work-nav-title { font-size: 2.2rem; }
}

/* ---------- Footer ---------- */

.site-footer { height: 4.1rem; background: var(--footer); }

/* Footer links (written into every page's footer by js/menu.js) */
.site-footer { display: flex; align-items: center; justify-content: flex-end; padding: 0 1.6rem; }
.site-footer .legal-links { font-size: 1.1rem; line-height: 1; }
.site-footer .legal-links a { color: var(--black); text-decoration: none; }
.site-footer .legal-links a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- Entrance: the opening of a work page (see js/entrance.js) ---------- */

.entrance { position: fixed; inset: 0; z-index: 60; }
.no-entrance .entrance { display: none; }
html.entrance-on { overflow: hidden; }
