/* NOXTAR site. One stylesheet for every page. The spec for every value here is DESIGN.md.
   No colour, size, space or duration is written outside the tokens below. */

@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/mona-sans-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* colour: five names, each with one job */
  --night:  #0A0E14;   /* the ground, and text on signal */
  --frost:  #E8EDF2;   /* text */
  --mist:   #A3B0BD;   /* secondary text, and light that is out of focus */
  --dim:    #66727F;   /* words the reader has not reached yet (large type only) */
  --signal: #16FFBD;   /* the logo's teal: what is in focus, what is confirmed, the corner */
  --rule:   rgba(232, 237, 242, .14);

  /* type: one family; width and size do the work */
  --font: "Mona Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --wd-display: 125%;  --wd-utility: 112%;  --wd-text: 100%;
  --wt-display: 520;   --wt-utility: 500;   --wt-text: 400;  --wt-strong: 600;
  /* one scale of six sizes. The top three are steps of one ratio at every width (1.28 on a phone,
     1.41 at 1440): the address is half way between the statement and the headline */
  --fs-small:   .8125rem;
  --fs-text:    1.0625rem;
  --fs-mid:     clamp(1.125rem, 1.03rem + .38vw, 1.5rem);
  --fs-lead:    clamp(1.75rem, 1.285rem + 1.905vw, 4.5rem);     /* the statement: 28 at 390, 48 at 1440, 72 at most */
  --fs-address: clamp(2.25rem, 1.507rem + 3.048vw, 6.375rem);   /* the address:   36 at 390, 68 at 1440, 102 at most */
  --fs-display: clamp(2.875rem, 1.714rem + 4.762vw, 9rem);      /* the headline:  46 at 390, 96 at 1440, 144 at most */
  /* the width of a display line in em: on a narrow phone the line is held to the measure */
  --fit-display: 7.50;   /* "for any camera." */
  --fit-mail:    8.90;   /* the address */
  --lh-display: 1;  --lh-lead: 1.1;  --lh-mid: 1.4;  --lh-text: 1.65;  --lh-small: 1.5;
  --tr-display: -.045em;  --tr-lead: -.025em;  --tr-mid: -.01em;

  /* space: steps of 4 px, one frame, one stage */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem;
  --s6: 2rem;   --s7: 3rem;  --s8: 4rem;   --s9: 6rem; --s10: 8rem;
  --frame:  clamp(1.25rem, 2.8vw, 2.5rem);   /* the same margin on every side of every screen */
  --stage:  100svh;                          /* a screen */
  --corner: min(50svh, 80vw);                /* the closing triangle's legs */
  --foot-h: 5.5rem;                          /* the footer's share of the last stage */
  --hit:    2.75rem;                         /* smallest thing a finger is asked to press */
  --measure: 44rem;                          /* reading column on the legal pages */
  --mark:   .4rem;                           /* the corner on a link */

  /* motion: one gesture, the logo's diagonal, at every scale */
  --ease:     cubic-bezier(.2, .8, .2, 1);   /* an answer: quick, then settles */
  --ease-cut: cubic-bezier(.7, 0, .2, 1);    /* a cut: the diagonal crossing */
  --t-press:  90ms;
  --t-state:  260ms;
  --t-cut:    520ms;
  --t-reveal: 700ms;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--night); color: var(--frost);
  font-family: var(--font); font-size: var(--fs-text); font-weight: var(--wt-text); font-stretch: var(--wd-text);
  line-height: var(--lh-text); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: var(--s1); }
main:focus, .contact:focus { outline: none; }
::selection { background: var(--signal); color: var(--night); }

.wrap {
  width: 100%;
  padding-left: max(var(--frame), env(safe-area-inset-left, 0px));
  padding-right: max(var(--frame), env(safe-area-inset-right, 0px));
}
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: var(--s3); left: var(--s3); z-index: 10;
  background: var(--signal); color: var(--night); font-size: var(--fs-small); font-weight: var(--wt-strong);
  text-decoration: none; padding: var(--s3) var(--s4);
  transform: translateY(-200%); transition: transform var(--t-state) var(--ease);
}
.skip-link:focus { transform: none; }

/* ── the field: one canvas behind every screen of the home page ───────────── */
#field {
  position: fixed; top: 0; left: 0; z-index: 0; display: block; pointer-events: none;
  width: 100%; height: 100vh; height: 100lvh;
  /* the header keeps a clear strip: the field comes up out of the dark below it */
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--s6), #000 var(--s10));
  mask-image: linear-gradient(to bottom, transparent var(--s6), #000 var(--s10));
}
.home main, .home .site-foot { position: relative; z-index: 1; }

/* ── header ─────────────────────────────────────────────── */
.site-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s5);
  padding-block: calc(var(--frame) - (var(--hit) - 1.25rem) / 2);
}
.home .site-head { position: absolute; top: env(safe-area-inset-top, 0px); left: 0; right: 0; z-index: 3; }
.logo { display: inline-flex; align-items: center; min-height: var(--hit); color: var(--frost); view-transition-name: nx-logo; }
.logo-svg { display: block; height: 1.25rem; width: auto; overflow: visible; }

/* a text link: pointing at it puts the logo's corner on it, pressing it dims it */
.link {
  position: relative; display: inline-flex; align-items: center; min-height: var(--hit);
  font-size: var(--fs-text); font-weight: var(--wt-utility); font-stretch: var(--wd-utility);
  text-decoration: none; white-space: nowrap;
  transition: color var(--t-press) linear;
}
.link::after {
  content: ""; position: absolute; top: calc(50% - .5lh - var(--mark) * .25); right: calc(var(--mark) * -1.6);
  width: var(--mark); height: var(--mark); background: var(--signal);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  transform: scale(0); transform-origin: 100% 0; transition: transform var(--t-state) var(--ease);
}
.link:hover::after, .link:focus-visible::after, .link[aria-current="page"]::after { transform: none; }
.link:active { color: var(--signal); }

/* ── stage 1: the headline, two lines standing on the frame, bottom left ─── */
.hero {
  min-height: var(--stage); display: flex; flex-direction: column; justify-content: flex-end;
  padding-bottom: var(--frame);
}
.fit { container-type: inline-size; }
.hero h1 {
  font-size: min(var(--fs-display), (100vw - 2 * var(--frame) - 1rem) / var(--fit-display));
  font-size: min(var(--fs-display), 100cqw / var(--fit-display));
  font-weight: var(--wt-display); font-stretch: var(--wd-display);
  line-height: var(--lh-display); letter-spacing: var(--tr-display);
  margin-bottom: .05em;   /* the descender, not the line box, stands on the frame */
}
.hero h1 .line { display: block; width: fit-content; white-space: nowrap; }

/* ── stage 2: the statement, on the other half of the page ─ */
.statement {
  min-height: var(--stage); display: flex; flex-direction: column; justify-content: center;
  padding-block: var(--s9);
}
.lead {
  font-size: var(--fs-lead); line-height: var(--lh-lead); letter-spacing: var(--tr-lead);
  max-width: 15em; text-wrap: balance;
}
.nb, .lead .w { white-space: nowrap; }
.lead.is-scrub .w { color: var(--dim); transition: color var(--t-state) linear; }
.lead.is-scrub .w.on { color: var(--frost); }
.sub {
  margin-top: var(--s7);
  font-size: var(--fs-mid); line-height: var(--lh-mid); letter-spacing: var(--tr-mid); color: var(--mist);
}
.sub span { display: block; }
@media (min-width: 64rem) { .statement-in { margin-left: 50%; } }

/* ── stage 3: the address, under the logo's corner ──────── */
.contact {
  position: relative; min-height: calc(var(--stage) - var(--foot-h));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-block: calc(var(--corner) * .6) var(--s7);
}
.contact::before {
  content: ""; position: absolute; top: 0; right: 0; width: var(--corner); height: var(--corner);
  background: var(--signal); clip-path: polygon(0 0, 100% 0, 100% 100%);
  transform: scale(var(--corner-open, 1)); transform-origin: 100% 0;
  transition: transform var(--t-state) var(--ease);
}
.mail {
  display: block; width: fit-content; white-space: nowrap; text-decoration: none;
  font-size: min(var(--fs-address), (100vw - 2 * var(--frame) - 1rem) / var(--fit-mail));
  font-size: min(var(--fs-address), 100cqw / var(--fit-mail));
  font-weight: var(--wt-display); font-stretch: var(--wd-display);
  line-height: var(--lh-display); letter-spacing: var(--tr-display);
  padding-bottom: .12em;
  background: linear-gradient(var(--signal), var(--signal)) 0 100% / 0 .045em no-repeat;
  transition: background-size var(--t-cut) var(--ease), color var(--t-press) linear;
}
.mail:hover, .mail:focus-visible { background-size: 100% .045em; }
.mail:active { background-size: 100% .09em; color: var(--signal); transition-duration: var(--t-press); }
.js .mail:not(.in):not(:focus-visible) { clip-path: polygon(100% 0, 100% 0, 100% 0); }

/* ── footer ─────────────────────────────────────────────── */
.site-foot { padding-bottom: var(--frame); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--mist); }
/* on the home page the footer closes the last stage: its row stands on the frame, as the logo hangs from it */
.home .site-foot {
  min-height: var(--foot-h); display: flex; flex-direction: column; justify-content: flex-end;
  padding-bottom: calc(var(--frame) - (var(--hit) - 1lh) / 2);
}
.foot-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0 var(--s6); padding-top: var(--s3); border-top: 1px solid var(--rule);
}
.foot-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s5); list-style: none; }
.foot-nav .link { font-size: var(--fs-small); font-stretch: var(--wd-text); color: var(--frost); }
.foot-btn { background-color: transparent; border: 0; cursor: pointer; }

/* ── legal pages ────────────────────────────────────────── */
.legal .site-head { border-bottom: 1px solid var(--rule); }
.prose { max-width: var(--measure); padding-block: var(--s9) var(--s10); }
.prose h1 {
  font-size: var(--fs-lead); font-weight: var(--wt-display); font-stretch: var(--wd-display);
  line-height: 1; letter-spacing: var(--tr-display);
}
.prose .effective {
  margin-top: var(--s5); padding-bottom: var(--s6); margin-bottom: var(--s7);
  border-bottom: 1px solid var(--rule); font-size: var(--fs-small); color: var(--mist);
}
.prose h2 {
  margin: var(--s7) 0 var(--s3); font-size: var(--fs-mid); font-weight: var(--wt-strong);
  line-height: 1.25; letter-spacing: var(--tr-mid);
}
.prose h3 { margin: var(--s5) 0 var(--s2); font-size: var(--fs-text); font-weight: var(--wt-strong); }
.prose p, .prose li { color: var(--mist); }
.prose p { margin-bottom: var(--s4); }
.prose ul { margin: 0 0 var(--s4) var(--s5); }
.prose li { margin-bottom: var(--s2); }
.prose strong { color: var(--frost); font-weight: var(--wt-strong); }
.prose a { color: var(--frost); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.prose a:hover { color: var(--signal); }
/* the summary is the page's opening paragraph, set one size up; no box */
.summary { margin-bottom: var(--s7); }
.summary li { font-size: var(--fs-mid); line-height: var(--lh-mid); letter-spacing: var(--tr-mid); color: var(--frost); margin-bottom: var(--s3); }
.contact-card { border-top: 1px solid var(--rule); padding-top: var(--s4); margin-bottom: var(--s4); }
.summary ul, .contact-card p:last-child { margin-bottom: 0; }
.contact-card p { margin-bottom: var(--s1); }
.prose section[lang="he"] {
  direction: rtl; text-align: right; scroll-margin-top: var(--s6);
  font-family: system-ui, -apple-system, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  margin-top: var(--s9); padding-top: var(--s8); border-top: 1px solid var(--rule);
}
.prose section[lang="he"] h1 { font-family: inherit; font-stretch: var(--wd-text); letter-spacing: 0; line-height: 1.15; }
.prose section[lang="he"] ul { margin: 0 var(--s5) var(--s4) 0; }

/* ── motion ─────────────────────────────────────────────── */
/* the diagonal: a right triangle opening from the top right corner until it covers the box */
@keyframes cut-in {
  from { clip-path: polygon(calc(100% + 1em) -.3em, calc(100% + 1em) -.3em, calc(100% + 1em) -.3em); }
  to   { clip-path: polygon(calc(100% + 1em - 180vw) -.3em, calc(100% + 1em) -.3em, calc(100% + 1em) calc(180vw - .3em)); }
}
@keyframes corner-in { from { transform: scale(0); } }
@keyframes fade-in { from { opacity: 0; } }

/* arriving, one sequence: the logo's corner, the field (site.js), the headline, the header link */
.home .logo-svg > path:nth-of-type(2) {
  transform-box: fill-box; transform-origin: 100% 0;
  animation: corner-in 300ms var(--ease) backwards;
}
.hero h1 .line { animation: cut-in var(--t-reveal) var(--ease-cut) 300ms backwards; }
.hero h1 .line:nth-child(2) { animation-delay: 390ms; }
.home .site-head .link { animation: fade-in 300ms linear 900ms backwards; }
.mail.in { animation: cut-in var(--t-reveal) var(--ease-cut) backwards; }

/* between pages, and on the jump to the address: the new view cuts in along the same diagonal */
@view-transition { navigation: auto; }
@keyframes page-cut {
  from { clip-path: polygon(100% 0, 100% 0, 100% 0); }
  to   { clip-path: polygon(calc(100% - 205vmax) 0, 100% 0, 100% 205vmax); }
}
::view-transition-old(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: page-cut var(--t-cut) var(--ease-cut) both; mix-blend-mode: normal; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .lead.is-scrub .w { color: inherit; }
}
