:root {
  /* Palette */
  --storybook-ivory: #fff8ea;
  --deep-plum: #3b183f;
  --royal-periwinkle: #5948b5;
  --berry-coral: #e85d75;
  --garden-green: #237a57;
  --ribbon-gold: #d8a62a;

  /* Typography */
  --font-heading: "Fraunces", Georgia, serif;
  --font-body: "Figtree", Arial, sans-serif;

  --text-xs: clamp(0.78rem, 0.75rem + 0.12vw, 0.86rem);
  --text-sm: clamp(0.92rem, 0.88rem + 0.15vw, 1rem);
  --text-body: clamp(1.08rem, 1rem + 0.35vw, 1.35rem);
  --text-lead: clamp(1.25rem, 1.08rem + 0.65vw, 1.7rem);
  --text-title: clamp(3.2rem, 2.25rem + 4.1vw, 5.5rem);
  --text-hero: clamp(5.5rem, 3.2rem + 11vw, 11.25rem);
  --text-display: clamp(4.2rem, 2.3rem + 8vw, 9rem);

  /* Spacing */
  --space-1: 0.4rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4.5rem;
  --space-8: 6.5rem;
  --space-9: 9rem;
  --space-section: clamp(5.5rem, 10vw, 10rem);

  /* Layout */
  --content-width: 70rem;
  --reading-width: 37.5rem;
  --page-gutter: clamp(1.25rem, 4vw, 3rem);

  /* Shape */
  --radius-small: 0.35rem;
  --radius-oval: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration: 700ms;
}

/* Base */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  min-width: 20rem;
  margin: 0;
  background: var(--storybook-ivory);
  color: var(--deep-plum);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--ribbon-gold);
  outline-offset: 5px;
}

::selection {
  background: var(--ribbon-gold);
  color: var(--deep-plum);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 0.98;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

[id] {
  scroll-margin-top: 2rem;
}

.site-shell {
  width: min(100% - (2 * var(--page-gutter)), var(--content-width));
  margin-inline: auto;
}

.reading-width {
  max-width: var(--reading-width);
}

/* Masthead */

.site-header {
  position: relative;
  z-index: 10;
  padding: var(--space-4) 0;
}

.masthead {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
}

.home-link {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.home-link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--ribbon-gold);
  text-decoration-thickness: 0.16em;
  text-underline-offset: 0.45em;
}

.masthead-contents-link {
  position: absolute;
  right: 0;
  font-size: var(--text-xs);
  font-weight: 700;
}

/* Hero */

.hero {
  position: relative;
  display: grid;
  min-height: calc(100svh - 5.75rem);
  overflow: hidden;
  place-items: center;
  padding: var(--space-6) var(--page-gutter) var(--space-8);
  isolation: isolate;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  width: min(100%, var(--content-width));
  text-align: center;
}

.hero-title {
  margin-bottom: var(--space-4);
  font-size: var(--text-hero);
  letter-spacing: -0.055em;
}

.hero-title-intro {
  display: block;
  margin-bottom: 0.15em;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.7rem + 1.2vw, 1.45rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.hero-title-name {
  display: block;
}

.hero-welcome {
  max-width: 30rem;
  margin-bottom: var(--space-6);
  font-size: var(--text-lead);
}

.cta-medallion {
  display: inline-grid;
  width: clamp(10rem, 33vw, 12.5rem);
  aspect-ratio: 1.45;
  place-content: center;
  gap: var(--space-1);
  border: 2px solid var(--deep-plum);
  border-radius: 50%;
  background: var(--storybook-ivory);
  color: var(--deep-plum);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 220ms ease,
    color 220ms ease,
    transform 220ms ease;
}

.cta-medallion:hover {
  background: var(--deep-plum);
  color: var(--storybook-ivory);
  transform: translateY(-3px);
}

.cta-arrow {
  font-family: var(--font-heading);
  font-size: 1.4em;
  line-height: 0.8;
}

.hero-shape {
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.hero-plus {
  top: 8%;
  left: 8%;
  color: var(--berry-coral);
  font-family: var(--font-heading);
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 600;
  line-height: 1;
  transform: rotate(-9deg);
}

.hero-circle {
  top: 15%;
  right: 7%;
  width: clamp(4.5rem, 11vw, 8rem);
  aspect-ratio: 1;
  border: clamp(0.65rem, 1.3vw, 1rem) solid var(--royal-periwinkle);
  border-radius: 50%;
}

.hero-paper {
  right: 8%;
  bottom: 14%;
  width: clamp(4rem, 9vw, 7rem);
  height: clamp(5rem, 11vw, 8.5rem);
  border: 2px solid var(--garden-green);
  background: var(--storybook-ivory);
  transform: rotate(8deg);
}

.hero-paper::after {
  position: absolute;
  top: 17%;
  right: 16%;
  bottom: 17%;
  left: 16%;
  border-top: 2px solid var(--garden-green);
  border-bottom: 2px solid var(--garden-green);
  content: "";
}

.hero-ball {
  bottom: 10%;
  left: 6%;
  width: clamp(3.5rem, 9vw, 6.5rem);
  aspect-ratio: 1;
  border: 2px solid var(--deep-plum);
  border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 47%, var(--deep-plum) 48% 51%, transparent 52%),
    linear-gradient(-35deg, transparent 47%, var(--deep-plum) 48% 51%, transparent 52%);
}

.hero-equation-seed {
  position: absolute;
  right: var(--page-gutter);
  bottom: var(--space-3);
  left: var(--page-gutter);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.7rem, 2vw, 1.5rem);
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.equation-operator {
  color: var(--berry-coral);
  font-size: 1.6em;
  line-height: 1;
}

/* Contents index */

.contents {
  border-top: 1px solid var(--deep-plum);
  border-bottom: 1px solid var(--deep-plum);
}

.contents-list {
  display: grid;
  margin: 0;
  padding: 0;
  counter-reset: contents;
  list-style: none;
}

.contents-item {
  counter-increment: contents;
}

.contents-item + .contents-item {
  border-top: 1px solid color-mix(in srgb, var(--deep-plum) 35%, transparent);
}

.contents-link {
  display: grid;
  gap: 0.1rem;
  padding: var(--space-4) 0;
  text-decoration: none;
  transition:
    color 180ms ease,
    padding 180ms ease;
}

.contents-link:hover {
  padding-left: var(--space-2);
  color: var(--royal-periwinkle);
}

.contents-title {
  font-size: var(--text-sm);
  font-weight: 700;
}

.contents-number::before {
  content: counter(contents, decimal-leading-zero) " ";
}

.contents-text {
  font-size: var(--text-xs);
}

/* Shared editorial sections */

.profile-section {
  position: relative;
  padding: var(--space-section) 0;
}

.eyebrow {
  margin-bottom: var(--space-4);
  color: var(--garden-green);
  font-size: var(--text-sm);
  font-weight: 700;
}

.section-title {
  margin-bottom: var(--space-5);
  font-size: var(--text-title);
  letter-spacing: -0.035em;
}

.section-copy {
  max-width: var(--reading-width);
  margin-bottom: var(--space-4);
  font-size: var(--text-lead);
}

.section-copy:last-child {
  margin-bottom: 0;
}

/* About */

.about-layout {
  display: grid;
  gap: var(--space-6);
}

.about-age {
  max-width: 15ch;
}

.about-copy {
  align-self: end;
}

.about-copy .section-copy:first-child {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2.7vw, 2.3rem);
  font-weight: 600;
  line-height: 1.2;
}

.about-equation {
  padding-top: var(--space-4);
  border-top: 3px solid var(--ribbon-gold);
}

/* Favorites */

.favorites-section {
  padding-bottom: 0;
}

.favorites-heading {
  max-width: 12ch;
}

.interest-tableaux {
  margin-top: var(--space-7);
}

.interest-tableau {
  position: relative;
  display: grid;
  min-height: 31rem;
  align-items: center;
  overflow: hidden;
  padding: var(--space-7) var(--page-gutter);
}

.interest-tableau:nth-child(1) {
  background: var(--garden-green);
  color: var(--storybook-ivory);
}

.interest-tableau:nth-child(2) {
  background: var(--royal-periwinkle);
  color: var(--storybook-ivory);
}

.interest-tableau:nth-child(3) {
  background: var(--berry-coral);
  color: var(--deep-plum);
}

.interest-inner {
  display: grid;
  width: min(100%, var(--content-width));
  margin-inline: auto;
  gap: var(--space-5);
}

.interest-content {
  position: relative;
  z-index: 2;
}

.interest-title {
  margin-bottom: var(--space-3);
  font-size: var(--text-display);
  letter-spacing: -0.045em;
}

.interest-text {
  margin: 0;
  font-size: var(--text-lead);
}

.interest-emblem {
  width: min(65vw, 18rem);
  justify-self: center;
  color: currentColor;
}

.interest-emblem svg {
  width: 100%;
  height: auto;
}

.interest-equation-term {
  position: absolute;
  right: var(--page-gutter);
  bottom: var(--space-3);
  margin: 0;
  color: currentColor;
  font-family: var(--font-heading);
  font-size: clamp(1rem, 2.5vw, 1.6rem);
  font-weight: 700;
  opacity: 0.85;
}

.interest-equation-term .equation-operator {
  margin-right: 0.25em;
}

/* Math peak */

.math-section {
  position: relative;
  min-height: min(52rem, 90svh);
  display: grid;
  overflow: hidden;
  place-items: center;
  padding: var(--space-8) var(--page-gutter);
  background: var(--royal-periwinkle);
  color: var(--storybook-ivory);
  text-align: center;
  isolation: isolate;
}

.math-inner {
  position: relative;
  z-index: 2;
  width: min(100%, var(--content-width));
}

.math-section .eyebrow {
  color: var(--storybook-ivory);
}

.math-title {
  max-width: 14ch;
  margin: 0 auto;
  font-size: clamp(3.6rem, 8.5vw, 8rem);
  letter-spacing: -0.045em;
}

.math-symbol {
  position: absolute;
  z-index: -1;
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 1;
  opacity: 0.28;
}

.math-symbol-plus {
  top: 5%;
  left: 4%;
  color: var(--ribbon-gold);
  font-size: clamp(8rem, 25vw, 22rem);
  transform: rotate(-8deg);
}

.math-symbol-equals {
  right: 2%;
  bottom: -4%;
  color: var(--berry-coral);
  font-size: clamp(10rem, 30vw, 25rem);
  transform: rotate(5deg);
}

/* Tablet */

.tablet-section {
  overflow: hidden;
}

.tablet-layout {
  display: grid;
  align-items: center;
  gap: var(--space-7);
}

.tablet-copy {
  position: relative;
  z-index: 2;
}

.tablet-title {
  max-width: 13ch;
}

.tablet-emblem {
  position: relative;
  width: min(75vw, 24rem);
  aspect-ratio: 0.76;
  justify-self: center;
  border: clamp(0.7rem, 2vw, 1.2rem) solid var(--deep-plum);
  background: var(--ribbon-gold);
}

.tablet-emblem::before {
  position: absolute;
  inset: 7%;
  border: 2px solid var(--deep-plum);
  background: var(--storybook-ivory);
  content: "";
}

.tablet-emblem::after {
  position: absolute;
  right: 50%;
  bottom: 1.7%;
  width: 0.6rem;
  aspect-ratio: 1;
  border: 2px solid var(--deep-plum);
  border-radius: 50%;
  content: "";
  transform: translateX(50%);
}

.tablet-shape {
  position: absolute;
  pointer-events: none;
}

.tablet-shape-circle {
  top: 15%;
  left: -10%;
  width: 40%;
  aspect-ratio: 1;
  border: 2px solid var(--berry-coral);
  border-radius: 50%;
}

.tablet-shape-plus {
  right: 7%;
  bottom: 8%;
  color: var(--royal-periwinkle);
  font-family: var(--font-heading);
  font-size: clamp(5rem, 12vw, 9rem);
  font-weight: 700;
}

/* Final equation */

.final-equation {
  padding: var(--space-8) var(--page-gutter);
  overflow: hidden;
  background: var(--deep-plum);
  color: var(--storybook-ivory);
}

.final-equation-line {
  display: flex;
  width: min(100%, var(--content-width));
  margin: 0 auto;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.18em 0.35em;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5.8vw, 5.4rem);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.final-equation-line .operator {
  color: var(--ribbon-gold);
  font-size: 1.15em;
}

.final-equation-line .result {
  color: var(--berry-coral);
  font-style: italic;
}

/* Footer */

.site-footer {
  padding: var(--space-5) var(--page-gutter);
  background: var(--deep-plum);
  color: var(--storybook-ivory);
  text-align: center;
}

.footer-name {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-lead);
  font-weight: 600;
}

/* Progressive motion */

.js .reveal {
  opacity: 0;
  transform: translateY(1.6rem);
  transition:
    opacity var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.js .operator-reveal {
  opacity: 0;
  transform: scale(0.75);
  transition:
    opacity 600ms var(--ease-out),
    transform 600ms var(--ease-out);
}

.js .operator-reveal.is-visible {
  opacity: 1;
  transform: scale(1);
}

.js .drift {
  animation: gentle-drift 5s ease-in-out infinite alternate;
}

@keyframes gentle-drift {
  from {
    transform: translateY(-3px);
  }

  to {
    transform: translateY(4px);
  }
}

/* Form support */

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

.form-status {
  min-height: 1.6em;
}

.form-status[data-state="error"] {
  color: var(--berry-coral);
}

.form-status[data-state="success"] {
  color: var(--garden-green);
}

/* Responsive layouts */

@media (min-width: 48rem) {
  .masthead-contents-link {
    display: none;
  }

  .contents-list {
    grid-template-columns: repeat(5, 1fr);
  }

  .contents-item + .contents-item {
    border-top: 0;
    border-left: 1px solid color-mix(in srgb, var(--deep-plum) 35%, transparent);
  }

  .contents-link {
    min-height: 8rem;
    padding: var(--space-4);
    justify-content: start;
    align-content: center;
  }

  .contents-link:hover {
    padding-left: calc(var(--space-4) + var(--space-2));
  }

  .about-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(17rem, 0.8fr);
    align-items: end;
  }

  .interest-inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(15rem, 0.85fr);
    align-items: center;
  }

  .interest-tableau:nth-child(even) .interest-content {
    order: 2;
  }

  .interest-tableau:nth-child(even) .interest-emblem {
    order: 1;
  }

  .tablet-layout {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.75fr);
  }
}

@media (min-width: 68rem) {
  .hero-plus {
    left: 14%;
  }

  .hero-circle {
    right: 15%;
  }

  .hero-paper {
    right: 16%;
  }

  .hero-ball {
    left: 15%;
  }

  .interest-tableau {
    min-height: 39rem;
  }
}

@media (max-width: 30rem) {
  .hero-shape {
    opacity: 0.75;
  }

  .hero-circle {
    top: 10%;
    right: 0.75rem;
    width: clamp(3.75rem, 18vw, 4.5rem);
  }

  .hero-plus {
    top: 11%;
    left: 0.5rem;
    font-size: clamp(2.75rem, 14vw, 4rem);
  }

  .hero-paper {
    right: 0.75rem;
    bottom: 17%;
    width: clamp(3.25rem, 16vw, 4rem);
    height: clamp(4.25rem, 20vw, 5rem);
  }

  .hero-ball {
    bottom: 14%;
    left: 0.75rem;
    width: clamp(3rem, 15vw, 3.5rem);
  }

  .interest-tableau {
    min-height: 34rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal,
  .js .operator-reveal {
    opacity: 1;
    transform: none;
  }
}
