/* aleksandra.design — Home
   Breakpoints follow the Framer project: phone < 810px, tablet 810–1199px, desktop ≥ 1200px. */

@font-face { font-family: "General Sans"; src: url("/fonts/GeneralSans-Variable.woff2") format("woff2"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Departure Mono"; src: url("/fonts/DepartureMono-Regular.woff2") format("woff2"); font-display: swap; }

:root {
  /* design tokens: the same four colours as the Framer project */
  --bg: #111112;      /* Pagina/Sfondo */
  --text: #F2EEE8;    /* Pagina/Testo */
  --muted: #7E7A74;   /* Pagina/Tenue */
  --accent: #57FFD2;  /* Accento */
  --track: rgba(242, 238, 232, 0.16);

  --sans: "General Sans", system-ui, sans-serif;
  --mono: "Departure Mono", ui-monospace, monospace;
  color-scheme: dark;

  /* spacing scale: every margin, padding and gap on the page comes from here */
  --s-8: 8px; --s-12: 12px; --s-16: 16px; --s-20: 20px; --s-24: 24px; --s-32: 32px; --s-40: 40px;
  --s-48: 48px; --s-96: 96px;
  /* Fluid scale. Every size below has two values on the 8px grid: one for a 390px phone and one for a
     1920px screen, and grows in a straight line between them (clamp keeps it inside the two).
     So nothing jumps at a breakpoint: the page scales as one piece. rem stays 16px, so the browser's
     own text-size setting still works. */

  /* the frame: the same distance from all four edges, 20 → 32px (reaches 32 at 1200px) */
  --edge: clamp(1.25rem, 0.8889rem + 1.4815vw, 2rem);
  --gutter: var(--edge);
  /* space between sections 80 → 160, between blocks 24 → 40 */
  --space-section: clamp(5rem, 3.7255rem + 5.2288vw, 10rem);
  --space-block: clamp(1.5rem, 1.2451rem + 1.0458vw, 2.5rem);

  /* type: four levels plus a caption. Mono labels stay fixed, the sans grows. */
  --fs-caption: .75rem;                                  /* 12: small group labels, the same size as the Visual Codes labels */
  --fs-label: 1rem;                                      /* 16 */
  --fs-menu: 2rem;                                       /* 32, phone menu */
  --fs-title: clamp(1.5rem, 1.2451rem + 1.0458vw, 2.5rem); /* 24 → 40 (32 at 1200) */
  --fs-display: clamp(2rem, 1.2353rem + 3.1373vw, 5rem);   /* 32 → 80 (56 at 1200): hero message and About */

  /* sans headlines share one letter spacing and one line height */
  --tracking: -.02em;
  --leading: 1.04;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-label);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none; /* never fake a bold or italic: only the real cuts of the two fonts */
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
/* readable by screen readers and search engines, invisible on screen */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.nav-links, .status, .scroll-meter, .contact { font-family: var(--mono); font-size: var(--fs-label); line-height: 1.5; text-transform: uppercase; }

/* ---------- hover: blink twice and land on the accent (was withDecodeAccent / withBlink) ---------- */
@keyframes blink { 0%, 50% { opacity: 0; } 25%, 75%, 100% { opacity: 1; } }
.accent { transition: color .2s; }
@media (hover: hover) {
  .accent:hover { color: var(--accent); }
  .accent:hover > span, .nav-logo.accent:hover { animation: blink .26s steps(1); }
}
.accent:focus-visible { color: var(--accent); }

/* ---------- background dots ---------- */
.dot-grid { position: fixed; inset: 0; width: 100%; height: 100vh; z-index: 1; pointer-events: none; }

/* ---------- navigation ---------- */
.nav {
  position: fixed; top: var(--edge); left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 var(--gutter);
}
.nav-logo { position: relative; z-index: 2; /* stays above the open phone menu */ font-weight: 600; font-size: var(--fs-label); line-height: 1.5; text-transform: uppercase; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: var(--s-32); }
.sound { text-transform: uppercase; white-space: nowrap; }

.menu { display: none; }
.menu-btn { position: relative; z-index: 2; display: block; padding: var(--s-12); margin: calc(-1 * var(--s-12)); }
.menu-bar { display: block; width: 22px; height: 1.5px; background: currentColor; transition: transform .45s cubic-bezier(.7, 0, .2, 1); }
.menu-bar + .menu-bar { margin-top: 6px; }
.menu.open .menu-bar:first-child { transform: translateY(3.75px) rotate(45deg); }
.menu.open .menu-bar:last-child { transform: translateY(-3.75px) rotate(-45deg); }
/* opening: the panel grows out of the menu button as a circle (--cx/--cy, set by menu.js),
   the links slide in from the right on a spring (--spring, also from menu.js). Closing is quick, with no bounce. */
.menu-panel {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column; justify-content: center; padding: 0 var(--gutter);
  background: var(--bg);
  clip-path: circle(0 at var(--cx, calc(100% - 31px)) var(--cy, 30px)); visibility: hidden;
  transition: clip-path .4s cubic-bezier(.7, 0, .8, .3) .06s, visibility 0s linear .46s;
}
.menu.open .menu-panel {
  clip-path: circle(150% at var(--cx, calc(100% - 31px)) var(--cy, 30px)); visibility: visible;
  transition: clip-path .7s cubic-bezier(.7, 0, .2, 1);
}
.menu-link {
  display: block; padding: var(--s-12) 0; font-size: var(--fs-menu); line-height: 1.3;
  transform: translateX(48px); opacity: 0;
  transition: opacity .2s, transform .25s ease-in;
}
.menu.open .menu-link { transform: none; opacity: 1; transition: opacity .3s ease, transform var(--spring-d, .6s) var(--spring, cubic-bezier(.16, 1, .3, 1)); }
.menu.open .menu-link:nth-child(1) { transition-delay: .22s; }
.menu.open .menu-link:nth-child(2) { transition-delay: .3s; }

@media (max-width: 809px) {
  .nav-links { gap: var(--s-24); }
  .nav-desktop { display: none; }
  .menu { display: block; }
}

/* ---------- hero: a tall section whose stage sticks while the scene plays with the scroll ---------- */
.hero { position: relative; z-index: 3; height: 260vh; overflow: clip; }
.hero-title {
  position: absolute; z-index: 4; top: calc(var(--edge) + var(--s-48)); left: var(--gutter); width: 11em; /* under the logo: one 24px line + 24px */
  font-size: var(--fs-title); font-weight: 500; line-height: var(--leading); letter-spacing: var(--tracking);
}
.scene { position: absolute; inset: 0; }
.stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.stars { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.moon {
  position: absolute; left: 50%; top: 56%; width: 108%; aspect-ratio: 1;
  transform: translate3d(-50%, 0, 0); will-change: transform;
}
.moon-turn, .moon img { width: 100%; height: 100%; }
.moon-turn { will-change: transform; }
.moon img { object-fit: contain; user-select: none; -webkit-user-drag: none; }
.cat {
  position: absolute; left: 49%; top: 37%; width: clamp(160px, 84%, 1200px); aspect-ratio: 2.038;
  transform: translate3d(-50%, -50%, 0); will-change: transform;
}
.cat div { position: absolute; will-change: transform; }
.cat img { width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.message {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(17.5em, calc(100% - 2 * var(--s-24))); text-align: center;
  font-size: var(--fs-display); font-weight: 500; line-height: var(--leading); letter-spacing: var(--tracking);
}
.message-rest { opacity: 0; }


/* ---------- about ---------- */
.about { position: relative; z-index: 2; padding: var(--space-section) var(--gutter); }
.about-intro { display: grid; grid-template-columns: repeat(4, 1fr); align-items: start; }
.portrait { position: relative; width: 88%; aspect-ratio: .75; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
/* tilted -11° on every breakpoint, as in Framer */
.signature { position: absolute; z-index: 1; left: -28px; top: -34px; width: 78%; height: auto; overflow: visible; transform: rotate(-11deg); }
.about-text { grid-column: span 3; display: flex; flex-direction: column; gap: var(--space-block);
  /* keep clear of the scroll meter (20px wide, on the right margin): the text stops one frame-width before it */
  padding-right: calc(var(--s-20) + var(--edge)); }
.about-bio, .about-more { font-size: var(--fs-display); font-weight: 500; line-height: var(--leading); letter-spacing: var(--tracking); }
.about-more { color: var(--muted); }
/* the rolling word: in the main text colour, clipped to its line */
/* the extra bottom padding keeps descenders (the "y" of motorcycles) inside the clip without moving the line */
.roll { display: inline-block; overflow: hidden; vertical-align: bottom; white-space: pre; color: var(--text); padding-bottom: .14em; margin-bottom: -.14em; }
.roll-word { display: inline-block; }

@media (max-width: 809px) {
  .about-intro { display: flex; flex-direction: column; gap: var(--s-48); }
  .portrait { width: 100%; }
  .signature { left: -8px; top: -30px; }
  .about-text { padding-right: 0; } /* no scroll meter on phones */
}

/* ---------- contact / footer ---------- */
.contact { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: var(--space-block); padding: var(--space-block) var(--gutter) var(--s-96); }
.contact-row { width: 100%; display: flex; justify-content: space-between; gap: var(--s-32); }
.social { display: flex; gap: var(--s-32); }
.hover-link { white-space: pre; transition: color .2s; }
.hover-link.on { color: var(--accent); }

@media (max-width: 809px) {
  /* one rhythm for the whole bottom of the page: lines in a group sit 8px apart (a 32px step),
     groups sit 32px apart. Groups: email + socials · copyright · the two widgets. */
  .contact { gap: var(--s-32); padding-bottom: calc(var(--edge) + 2 * var(--s-24) + var(--s-8) + var(--s-32)); }
  .contact-row { flex-direction: column; align-items: center; gap: var(--s-8); }
  .copyright { text-align: center; }
}

/* ---------- corner status widgets: invert over the moon ---------- */
.status {
  position: fixed; bottom: var(--edge); z-index: 50;
  /* words are separate pieces (for the decode and the blinking colon): the gap is exactly one mono space,
     so they read with the same spacing as the email and the links */
  display: inline-flex; align-items: center; gap: 1ch;
  /* "difference" subtracts the page colour (#111112): this lighter ink lands on the same colour as the
     rest of the text instead of a dimmer grey */
  color: rgb(255 255 249); white-space: nowrap;
  mix-blend-mode: difference; pointer-events: none;
}
.status-place { left: var(--gutter); }
.status-presence { right: var(--gutter); }
.status .num { font-variant-numeric: tabular-nums; }
.status .colon { animation: colon 2s steps(1) infinite; }
.status .pulse { width: 6px; height: 6px; background: var(--accent); animation: pulse 2s ease-in-out infinite; }
@keyframes colon { 50% { opacity: .25; } }
@keyframes pulse { 50% { opacity: .35; } }
@media (max-width: 809px) {
  /* phone: both widgets centred, like the email, the socials and the copyright above them */
  .status-place, .status-presence { left: 0; right: 0; justify-content: center; }
  .status-place { bottom: calc(var(--edge) + var(--s-24) + var(--s-8)); } /* one line + 8px above the other widget */
  .status-presence { bottom: var(--edge); }
}

/* ---------- scroll meter ---------- */
.scroll-meter {
  position: fixed; top: 0; right: var(--gutter); height: 100vh; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-12);
  pointer-events: none;
}
/* two digits wide, so "00"–"99" end exactly on the right margin like the menu and the footer;
   "100" grows to the left (flex-end) and never moves the track */
.scroll-value { width: 2ch; display: flex; justify-content: flex-end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.scroll-track { position: relative; width: 1px; height: 160px; background: var(--track); overflow: hidden; }
.scroll-fill { position: absolute; inset: 0; background: var(--accent); transform: scaleY(0); transform-origin: 50% 0; }
@media (max-width: 809px) { .scroll-meter { display: none; } }

/* ---------- touch: every tappable text gets at least a 44px tall target, without moving the layout ---------- */
@media (pointer: coarse) {
  .contact a, .sound, .nav-desktop { position: relative; }
  .contact a::after, .sound::after, .nav-desktop::after { content: ""; position: absolute; inset: -10px -6px; }
}
/* on the phone footer the lines are only 8px apart: targets grow 4px each way so neighbours never overlap */
@media (pointer: coarse) and (max-width: 809px) { .contact a::after { inset: -4px -6px; } }

/* ---------- cursor trail ---------- */
.cursor-trail { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 100; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---------- the Home star field as a fixed background (404, links) ---------- */
.sky { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }

/* ---------- 404 page: the Home sky, with the moon as the 0 (js/lost.js) ---------- */
.lost { overflow: hidden; }
.lost-clicks { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.lost-main {
  position: relative; z-index: 2; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: var(--space-block);
  padding: var(--space-section) var(--gutter); text-align: center;
}
/* 128 → 320px, and never taller than a third of the screen (phones turned sideways) */
.lost-code {
  display: flex; align-items: center; gap: .04em;
  font-size: min(clamp(8rem, 4.9412rem + 12.549vw, 20rem), 34vh); font-weight: 500; line-height: 1; letter-spacing: var(--tracking);
}
.lost-code > span { animation: rise 1s cubic-bezier(.16, 1, .3, 1) both; }
.lost-code > span:nth-child(2) { animation-delay: .08s; }
.lost-code > span:nth-child(3) { animation-delay: .16s; }
.lost-moon { display: block; width: .74em; height: .74em; margin-top: -.02em; }
.lost-moon img { width: 100%; height: 100%; object-fit: contain; animation: turn 120s linear infinite; user-select: none; -webkit-user-drag: none; }
@keyframes rise { from { opacity: 0; transform: translateY(.12em); } }
@keyframes turn { to { transform: rotate(1turn); } }
.lost-title { max-width: 13em; font-size: var(--fs-title); font-weight: 500; line-height: var(--leading); letter-spacing: var(--tracking); text-wrap: balance; }
.lost-rest { opacity: 0; }
.lost-link { position: relative; font-family: var(--mono); font-size: var(--fs-label); line-height: 1.5; text-transform: uppercase; }
@media (pointer: coarse) { .lost-link::after { content: ""; position: absolute; inset: -10px -6px; } }
