/* Light version of the page. Colours follow annalishchynska.com. */

:root {
  --bg: #fff;
  --text: #282828;
  --tagline: #757575;
  --name: #757575;
  --card: rgba(235, 235, 235, 0.4); /* dark version's rgba(20, 20, 20, 0.4), inverted */
  --card-hover: #161616;
  --logo: #282828;
  --logo-hover: #c5fe02;
  --card-border: rgba(51, 51, 51, 0.1); /* dark version's rgba(204, 204, 204, 0.1), inverted */
}

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

/* Safari tints its toolbar from the root's colour, so on computers the root stays white,
   intro included. Phones follow the screen instead: see the intro styles. */
html { background: var(--bg); color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Golos Text", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h3, p { margin: 0; font-weight: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ---------- Intro ---------- */

html.intro-active { overflow: hidden; }

html.intro-active .page { opacity: 0; }

/* The tagline keeps its place in the layout until intro.js reveals it. */
.hero__tagline.is-waiting { opacity: 0; }

/* Not fixed, and its colour is an image: Safari leaves images out when it samples the top
   of the page, so this dark layer doesn't tint the toolbar. */
.intro {
  display: none;
  position: absolute;
  z-index: 100;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-image: linear-gradient(#282828, #282828);
}

html.intro-active .intro { display: block; }

/* Phones: the browser's top follows the screen, dark over the intro and white over the page. */
@media (hover: none) and (pointer: coarse) {
  html.intro-active { background: #282828; }

  .intro {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    background-color: #282828;
    background-image: none;
  }
}

.intro canvas {
  position: absolute;
  pointer-events: none;
}

/* ---------- Page ---------- */

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  overflow-x: clip; /* entrance offsets must not add a horizontal scroll */
}

.site-header {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-top: 48px;
}

.site-header__logo {
  flex: none;
  width: 180px;
  height: 34px;
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  padding: 216px 40px 0;
}

.hero__clip { width: 100%; }

.hero__greeting,
.hero__title {
  width: 100%;
  font-size: 56px;
  font-weight: 500;
  letter-spacing: calc(-2.4 / 56 * 1em); /* -2.4px at 56px */
  line-height: calc(64 / 56);
  text-align: center;
  word-break: break-word;
  white-space: pre-wrap;
  will-change: transform;
}

.hero__greeting a {
  position: relative;
  color: var(--name);
  text-decoration-thickness: 0.0625em; /* 3.5px at 56px */
  text-underline-offset: 0.12em;
  transition: color 0.2s ease;
}

.hero__greeting a:focus-visible,
.hero__greeting a:hover {
  color: var(--text);
  text-decoration-line: underline;
}

/* The arrow from Figma frame 14:52: 24px at the 56px heading, above the full stop. */
.hero__greeting a::after {
  content: "";
  position: absolute;
  top: calc(-7 / 56 * 1em);
  left: 100%;
  width: calc(24 / 56 * 1em);
  height: calc(24 / 56 * 1em);
  background: url("assets/name-arrow.svg") center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.hero__greeting a:focus-visible::after,
.hero__greeting a:hover::after {
  opacity: 1;
  pointer-events: auto;
}

.hero__title { white-space: normal; }
.hero__break { display: none; }

.hero__tagline {
  position: relative;
  width: fit-content;
  margin-top: 104px;
  color: var(--tagline);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: calc(28 / 20);
  text-align: center;
  text-wrap: balance;
}

/* The marks from Figma 44:169 and 44:170: 20px with an 8px gap at the 20px tagline, sized in
   em so they follow the text. Outside the text box, so they don't take space from it. */
.hero__tagline::before,
.hero__tagline::after {
  content: "";
  position: absolute;
  top: calc(50% - 0.45em);
  width: 1em;
  height: 1em;
  background: url("assets/tagline-mark.svg") center / contain no-repeat;
}

.hero__tagline::before { right: calc(100% + 0.4em); }
.hero__tagline::after { left: calc(100% + 0.4em); }

.spacer { width: 100%; min-height: 19px; }

.cases {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  width: 100%;
  padding: 186px 0 204px;
  scroll-margin-top: 20px;
}

/* Not sticky: Safari on iOS 26 paints its toolbars in the colour of a sticky element. */
.case {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 1080px;
  cursor: pointer;
}

/* The whole block opens the case page; the link itself adds no box to the layout. */
.case__link {
  display: contents;
  cursor: inherit;
}

.card {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 480px;
  overflow: hidden;
  border-radius: 32px;
  background: var(--card);
  transition: background-color 0.3s ease;
  will-change: transform;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--card-border);
  border-radius: inherit;
  pointer-events: none;
}

.card__logo {
  position: relative;
  top: -1.0417%; /* 5px of the 480px card, scales with it */
  width: clamp(160px, 36.3%, 392px);
  aspect-ratio: 392 / 96;
  background: var(--logo);
  -webkit-mask: url("assets/hadron-logo.svg") center / contain no-repeat;
  mask: url("assets/hadron-logo.svg") center / contain no-repeat;
  transition: background-color 0.3s ease;
}

@media (hover: hover) {
  .case:hover .card { background: var(--card-hover); }
  .case:hover .card__logo { background: var(--logo-hover); }
  /* With the spray running, the paint itself makes this colour change. */
  .case.has-spray:hover .card { background: var(--card); }
  .case.has-spray:hover .card__logo { background: var(--logo); }
  .case:hover .case__title {
    text-decoration-line: underline;
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
  }

  /* The name's arrow at 18px for the 34px title, its base level with the capitals.
     The negative margin keeps it out of the centring, so the text doesn't shift. */
  .case__title::after {
    content: "";
    display: inline-block;
    position: relative;
    top: calc(-1.5 / 34 * 1em);
    left: calc(-3 / 34 * 1em);
    width: calc(18 / 34 * 1em);
    height: calc(18 / 34 * 1em);
    margin-right: calc(-18 / 34 * 1em);
    vertical-align: top;
    background: url("assets/name-arrow.svg") center / contain no-repeat;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .case:hover .case__title::after { opacity: 1; }
}

.cover-cursor {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 0;
  width: 208px;
  height: 208px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  will-change: transform;
}

.cover-cursor.is-visible { opacity: 1; }

.case.has-cover-cursor { cursor: none; }

.card__spray {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.card.is-squircle { border-radius: 0; }
.card.is-squircle::after { display: none; }

.card__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--card-border);
  stroke-width: 1;
  pointer-events: none;
}

.case__title {
  width: 100%;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.4;
  text-align: center;
}

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

.site-logo {
  display: block;
  flex: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  width: min(1080px, 100% - 80px);
  margin-top: 240px; /* on top of the case list's own 204px */
  padding-block: 40px 56px;
}

.site-footer__logo {
  width: 180px;
  height: 34px;
}

.site-footer__contacts {
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-footer__email,
.site-footer__link {
  position: relative;
  color: var(--text);
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: calc(28 / 18);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Both labels share one cell, so "Copied" doesn't move anything. */
.site-footer__email {
  display: grid;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.site-footer__address,
.site-footer__copied {
  grid-area: 1 / 1;
  text-align: left;
  transition: opacity 0.2s ease;
}

.site-footer__copied { opacity: 0; }
.site-footer__email.is-copied .site-footer__address { opacity: 0; }
.site-footer__email.is-copied .site-footer__copied { opacity: 1; }

/* The name's arrow from the top of the page, in the same proportion to the text. */
.site-footer__link::after {
  content: "";
  position: absolute;
  top: calc(-3 / 18 * 1em);
  left: 100%;
  width: calc(8 / 18 * 1em);
  height: calc(8 / 18 * 1em);
  background: url("assets/name-arrow.svg") center / contain no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}

@media (hover: hover) {
  .site-footer__email:hover .site-footer__address,
  .site-footer__link:hover { text-decoration-line: underline; }

  .site-footer__link:hover::after { opacity: 1; }
}

.site-footer__email:focus-visible .site-footer__address,
.site-footer__link:focus-visible { text-decoration-line: underline; }

/* ---------- Adaptation: tablet ---------- */

@media (max-width: 1199.98px) {
  .hero { padding: 136px 40px 0; }
  .hero__tagline { margin-top: 72px; }

  .hero__greeting,
  .hero__title { font-size: min(56px, 4.5vw); }

  .cases { padding-inline: 40px; }

  .card { height: clamp(380px, 44.4vw, 480px); }
  .case__title { font-size: clamp(26px, 3.1vw, 34px); }
}

/* ---------- Adaptation: phone ---------- */

@media (max-width: 809.98px) {
  .site-header { padding-top: 32px; }

  .hero { padding: 140px 24px 0; }
  /* 18px from a 440px screen up; narrower screens scale it so the marks stay inside the heading's width */
  .hero__tagline { margin-top: 48px; font-size: min(18px, 4.1vw); line-height: calc(28 / 18); }

  .hero__greeting,
  .hero__title { font-size: clamp(26px, 8.7vw, 44px); }
  .hero__break { display: inline; }

  .cases { gap: 32px; padding-top: 102px; padding-inline: 16px; }

  .case { gap: 12px; }
  .card { height: clamp(280px, 80vw, 480px); }
  .case__title { font-size: min(34px, 5.8vw); } /* scales with the screen, so it stays on two lines */

  .site-footer {
    flex-direction: column;
    gap: 36px;
    width: calc(100% - 48px);
    margin-top: 112px;
    padding-block: 32px 48px;
  }

  .site-footer__contacts { gap: 24px; }

  .site-footer__email,
  .site-footer__link { font-size: 16px; line-height: 1.5; }
}

/* Smallest phones: a little more room so the heading stays on four lines */
@media (max-width: 359.98px) {
  .hero { padding-inline: 16px; }
}
