/*
 * Hypehammer, landing page.
 * Identity: an encyclopedia page turned into a quote board. Navy ink on cool paper,
 * link blue for articles, and one signal colour: the yellow mark the hammer leaves under a price.
 */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #f2f4fa;
  --paper-raised: #ffffff;
  --ink: #1a2340;
  --ink-soft: #4b5576;
  --rule: #cbd1e1;
  --link: #2e59d1;
  --strike: #ffd43b;
  --strike-hover: #f5c400;
  --on-strike: #1a2340;
  --up: #0b7a51;
  --down: #c63a31;

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121830;
    --paper-raised: #1a2242;
    --ink: #e9edf8;
    --ink-soft: #a6aecb;
    --rule: #2f3a5c;
    --link: #93adff;
    --up: #43c98f;
    --down: #ff8177;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}

h1,
h2 {
  font-stretch: 112%;
  font-weight: 760;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
}

h2 {
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem);
}

p {
  margin: 0;
}

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

/* Section rules line up with the text, not with the padding. */
.day,
.fame,
.rules {
  background: linear-gradient(var(--rule), var(--rule)) top center / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}

.closing {
  background: linear-gradient(var(--ink), var(--ink)) top center / calc(100% - 2 * var(--gutter)) 2px no-repeat;
}

/* Masthead ---------------------------------------------------------------- */

.masthead,
main > section,
main > article,
.site-footer {
  max-width: 74rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.25rem;
}

.wordmark {
  color: var(--ink);
  font-size: 1.4rem;
  font-stretch: 125%;
  font-weight: 820;
  letter-spacing: -0.02em;
  text-decoration: none;
  /* The hammer's mark, the same yellow as under a price. */
  box-shadow: inset 0 -0.36em 0 var(--strike);
  padding-inline: 0.06em;
}

.lang {
  display: flex;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.lang a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.25rem 0.1rem;
}

.lang a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--ink);
}

/* Hero -------------------------------------------------------------------- */

.hero {
  display: grid;
  gap: 3rem;
  padding-block: clamp(2rem, 6vw, 5rem) clamp(3rem, 7vw, 6rem);
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: start;
    gap: 4.5rem;
  }
}

.hero h1 {
  font-size: clamp(2.6rem, 1.4rem + 5.2vw, 5.1rem);
  line-height: 0.98;
  max-width: 11ch;
}

.lead {
  margin-top: 1.5rem;
  max-width: var(--measure);
  font-size: 1.2rem;
  color: var(--ink-soft);
}

/* Sign-up form ------------------------------------------------------------ */

.signup {
  margin-top: 2.25rem;
  max-width: var(--measure);
}

.signup-label {
  display: block;
  font-weight: 650;
  margin-bottom: 0.5rem;
}

.signup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.signup input[type="email"] {
  flex: 1 1 15rem;
  min-height: 3.1rem;
  padding: 0 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
}

.signup input[aria-invalid="true"] {
  border-color: var(--down);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.1rem;
  padding: 0 1.3rem;
  border: 0;
  border-radius: 6px;
  background: var(--strike);
  color: var(--on-strike);
  font: inherit;
  font-stretch: 110%;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--strike-hover);
  text-decoration: none;
}

.signup-error {
  margin-top: 0.6rem;
  color: var(--down);
  font-weight: 600;
}

.consent {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.consent input {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2rem 0 0;
  accent-color: var(--ink);
}

.fine {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Quote board ------------------------------------------------------------- */

.board {
  margin: 0;
  background: var(--paper-raised);
  border-top: 5px solid var(--ink);
  border-radius: 2px 2px 14px 14px;
  padding: 1rem clamp(1rem, 3vw, 1.5rem) 0.25rem;
}

.board figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 0.75rem;
}

.board-session {
  font-weight: 700;
  font-stretch: 108%;
}

.board-note {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.quotes {
  list-style: none;
  margin: 0;
  padding: 0;
}

.quote {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 5.5rem 5rem;
  grid-template-areas:
    "title spark price change"
    "sector spark price change";
  column-gap: 1rem;
  align-items: center;
  padding-block: 0.8rem;
  border-top: 1px solid var(--rule);
}

.quote-title {
  grid-area: title;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.quote-title:hover {
  color: var(--link);
  text-decoration: underline;
}

.quote-sector {
  grid-area: sector;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.quote-spark {
  grid-area: spark;
  width: 96px;
  height: 28px;
}

.spark-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.spark-ref {
  stroke: var(--ink-soft);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.6;
  vector-effect: non-scaling-stroke;
}

.is-up {
  color: var(--up);
}

.is-down {
  color: var(--down);
}

.is-flat {
  color: var(--ink-soft);
}

.quote-price {
  grid-area: price;
  justify-self: end;
  position: relative;
  color: var(--ink);
  font-size: 1.45rem;
  font-stretch: 112%;
  font-weight: 720;
  line-height: 1;
  padding-inline: 0.12em;
}

/* The hammer strike: the yellow mark lands under each price, then the price appears. */
.quote-price::before {
  content: "";
  position: absolute;
  inset: auto 0 0.04em;
  height: 0.46em;
  background: var(--strike);
  transform-origin: 0 50%;
}

.quote-figure {
  position: relative;
}

.quote-change {
  grid-area: change;
  justify-self: end;
  font-size: 0.95rem;
  font-weight: 650;
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .quote-price::before {
    animation: strike 560ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
  }

  .quote-figure {
    animation: land 560ms steps(1, end) both;
  }

  .quote:nth-child(1) > .quote-price::before,
  .quote:nth-child(1) > .quote-price .quote-figure { animation-delay: 350ms; }
  .quote:nth-child(2) > .quote-price::before,
  .quote:nth-child(2) > .quote-price .quote-figure { animation-delay: 470ms; }
  .quote:nth-child(3) > .quote-price::before,
  .quote:nth-child(3) > .quote-price .quote-figure { animation-delay: 590ms; }
  .quote:nth-child(4) > .quote-price::before,
  .quote:nth-child(4) > .quote-price .quote-figure { animation-delay: 710ms; }
  .quote:nth-child(5) > .quote-price::before,
  .quote:nth-child(5) > .quote-price .quote-figure { animation-delay: 830ms; }
}

@keyframes strike {
  0% {
    opacity: 0;
    transform: translateY(-1.4em) rotate(-9deg) scaleX(0.7);
  }
  55% {
    opacity: 1;
    transform: translateY(0.05em) rotate(0) scaleX(1.06);
  }
  78% {
    transform: translateY(-0.03em) scaleX(0.98);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* The figure stays hidden until the mark lands (55 % of the strike). */
@keyframes land {
  0% { opacity: 0; }
  55% { opacity: 1; }
  100% { opacity: 1; }
}

@media (max-width: 30rem) {
  .quote {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title price"
      "sector change"
      "spark spark";
    row-gap: 0.2rem;
  }

  .quote-spark {
    width: 100%;
    margin-top: 0.3rem;
  }

}

/* A day on the market ----------------------------------------------------- */

.day {
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.day-steps {
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 2rem;
}

.day-step {
  position: relative;
  padding-left: 2rem;
  max-width: 24rem;
}

/* The timeline: a thin rule with a dot per moment, and the hammer's mark on the morning session. */
.day-step::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.day-step.is-hammer::before {
  width: 1.1rem;
  height: 0.7rem;
  left: -0.15rem;
  border: 0;
  border-radius: 2px;
  background: var(--strike);
}

.day-time {
  display: block;
  font-weight: 760;
  font-stretch: 112%;
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
}

.day-step p {
  color: var(--ink-soft);
}

@media (min-width: 52rem) {
  .day-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2.5rem;
    border-top: 2px solid var(--ink);
    padding-top: 1.6rem;
  }

  .day-step {
    padding-left: 0;
  }

  .day-step::before {
    top: calc(-1.6rem - 0.45rem);
  }

  .day-step.is-hammer::before {
    top: calc(-1.6rem - 0.4rem);
    left: 0;
  }
}

/* Fame alone pays nothing ------------------------------------------------- */

.fame {
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.fame-intro p {
  margin-top: 1rem;
  max-width: var(--measure);
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.fame-charts {
  display: grid;
  gap: 2.5rem;
  margin-top: 2.5rem;
}

@media (min-width: 52rem) {
  .fame-charts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.fame-chart {
  margin: 0;
}

.fame-chart svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 240 / 96;
}

.fame-chart .spark-line {
  stroke-width: 2.2;
}

.fame-chart figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 1rem;
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
}

.fame-name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
}

.fame-figure {
  justify-self: end;
  font-weight: 720;
  font-stretch: 112%;
  font-size: 1.2rem;
  color: var(--ink);
}

.fame-text {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.fame-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.legend-ref {
  width: 2rem;
  border-top: 1px dashed var(--ink-soft);
}

/* Rules that will not change ---------------------------------------------- */

.rules {
  padding-block: clamp(3rem, 7vw, 5.5rem);
}

.rules dl {
  display: grid;
  gap: 1.75rem 3rem;
  margin: 2.25rem 0 0;
}

@media (min-width: 46rem) {
  .rules dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.rules dt {
  font-weight: 700;
  font-stretch: 106%;
  font-size: 1.1rem;
}

.rules dd {
  margin: 0.3rem 0 0;
  max-width: 30rem;
  color: var(--ink-soft);
}

/* Closing call to action -------------------------------------------------- */

.closing {
  padding-block: clamp(3rem, 7vw, 5rem);
}

.closing p {
  margin-top: 0.75rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.closing .button {
  margin-top: 1.5rem;
}

/* Messages and legal pages ------------------------------------------------ */

.notice {
  padding-block: clamp(3rem, 10vw, 7rem);
}

.notice h1,
.legal h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem);
  max-width: 18ch;
}

.notice p {
  max-width: var(--measure);
  margin-top: 1.25rem;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

.notice form {
  margin-top: 2rem;
}

.legal {
  max-width: 46rem;
  padding-block: clamp(2.5rem, 7vw, 5rem);
}

.legal h2 {
  font-size: 1.35rem;
  margin-top: 2.25rem;
}

.legal p,
.legal ul {
  margin-top: 0.75rem;
  max-width: 40rem;
}

.legal ul {
  padding-left: 1.2rem;
}

.legal li + li {
  margin-top: 0.5rem;
}

.legal-note {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

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

.site-footer {
  padding-block: 2rem 3rem;
  background: linear-gradient(var(--rule), var(--rule)) top center / calc(100% - 2 * var(--gutter)) 1px no-repeat;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.site-footer p {
  max-width: 46rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 0.75rem;
}

/* Dark theme: light figures cannot sit on the yellow, so the mark moves under the baseline.
   Kept last so it wins over the rules above. */
@media (prefers-color-scheme: dark) {
  .wordmark {
    box-shadow: inset 0 -0.2em 0 var(--strike);
    padding-bottom: 0.24em;
  }

  .quote-price::before {
    inset: auto 0 -0.24em;
    height: 0.2em;
  }
}
