/* ==========================================================================
   Design tokens — architecture-inspired: modular grid, hairlines, mono meta
   ========================================================================== */
:root {
  --color-bg: #eef0f3;
  --color-bg-alt: #e4e7ec;
  --color-text: #181b20;
  --color-text-muted: #666e79;
  --color-accent: #3a5fd9;
  --color-accent-dark: #2947ad;
  --color-line: #c8ccd3;
  --color-line-strong: #a4aab5;
  --color-surface: #ffffff;
  /* Text placed directly on top of --color-accent fills (chips, active
     toggle states). The light-mode accent is dark enough for white text,
     but the dark-mode accent is deliberately pale (for contrast against a
     near-black page background) — white text on it fails contrast, so
     dark mode flips this to a near-black tone instead. */
  --color-on-accent: #ffffff;

  --font-display: "Anton", "Arial Narrow", sans-serif;
  --font-body: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* 8px modular grid — every spacing value is a multiple of this unit */
  --u: 8px;
  --gutter: clamp(24px, 6vw, 96px);
  --container-width: 1200px;
  --section-gap: clamp(80px, 10vw, 160px);

  --nav-h: 88px;

  color-scheme: light;
}

[data-theme="dark"] {
  --color-bg: #14161a;
  --color-bg-alt: #1b1e23;
  --color-text: #eef0f3;
  --color-text-muted: #9198a3;
  --color-accent: #7d9cf5;
  --color-accent-dark: #a9bdf8;
  --color-line: #30343b;
  --color-line-strong: #454a53;
  --color-surface: #1b1e23;
  --color-on-accent: #14161a;

  color-scheme: dark;
}

body {
  transition: background 0.25s ease, color 0.25s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

section {
  padding: var(--section-gap) var(--gutter) 0;
  position: relative;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  width: 100%;
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

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

/* ==========================================================================
   Entrance / reveal animation
   ========================================================================== */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  opacity: 0;
}

.reveal.is-visible {
  animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-stagger > * {
  opacity: 0;
}

body.loaded .hero-stagger > * {
  animation: fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.loaded .hero-stagger > *:nth-child(1) { animation-delay: 0.05s; }
body.loaded .hero-stagger > *:nth-child(2) { animation-delay: 0.15s; }
body.loaded .hero-stagger > *:nth-child(3) { animation-delay: 0.3s; }
body.loaded .hero-stagger > *:nth-child(4) { animation-delay: 0.42s; }
body.loaded .hero-stagger > *:nth-child(5) { animation-delay: 0.52s; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .hero-stagger > * {
    opacity: 1;
    animation: none !important;
    transform: none !important;
  }
}

/* ==========================================================================
   Section heading — ruler / drafting-line style
   ========================================================================== */
.section-heading {
  display: flex;
  align-items: baseline;
  gap: calc(var(--u) * 2.5);
  margin-bottom: calc(var(--u) * 6);
}

/* When a section heading links out to its own dedicated sub-page, it becomes
   an <a> — reset link defaults and add a pointer + a hover reveal on the
   trailing rule (the accent tick widens into a solid line and a chevron
   slides in), echoing the "hover to jump to the sub-page" pattern. */
a.section-heading {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.section-heading .index {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-text-muted);
}

.section-heading h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(28px, 4vw, 40px);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.section-heading .rule {
  flex: 1;
  height: 1px;
  background: var(--color-line);
  position: relative;
  align-self: center;
}

.section-heading .rule::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px;
  width: 1px;
  height: 9px;
  background: var(--color-line-strong);
}

.section-heading .rule::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 48px;
  height: 3px;
  background: var(--color-accent);
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

a.section-heading:hover .rule::after {
  width: 140px;
}

/* Chevron — a generated flex item that sits after the rule (last child in
   flex order), hidden until hover, then slides in from the left. */
a.section-heading::after {
  content: "";
  flex-shrink: 0;
  align-self: center;
  width: 11px;
  height: 11px;
  margin-left: calc(var(--u) * -1);
  border-top: 2px solid var(--color-accent);
  border-right: 2px solid var(--color-accent);
  transform: translateX(-10px) rotate(45deg);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
}

a.section-heading:hover::after {
  transform: translateX(0) rotate(45deg);
  opacity: 1;
}

/* ==========================================================================
   Nav
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  z-index: 220;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: calc(var(--u)) calc(var(--u) * 1.25);
  z-index: 210;
  position: relative;
}

.menu-btn span {
  display: block;
  width: 28px;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.25s ease, opacity 0.2s ease, width 0.25s ease;
}

.menu-btn span:last-child {
  width: 18px;
}

.menu-btn:hover span:last-child {
  width: 28px;
}

.menu-open .menu-btn span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.menu-open .menu-btn span:nth-child(2) {
  opacity: 0;
}
.menu-open .menu-btn span:nth-child(3) {
  width: 28px;
  transform: translateY(-8px) rotate(-45deg);
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--color-line-strong);
  border-radius: 999px;
  padding: 4px;
  background: color-mix(in srgb, var(--color-surface) 65%, transparent);
  backdrop-filter: blur(6px);
}

.lang-toggle button {
  padding: 5px 12px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.nav-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 200;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--u) * 6);
  padding: var(--gutter);
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}

.menu-open .nav-overlay {
  transform: translateY(0);
}

.nav-overlay ul {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 2);
}

.nav-overlay-panel {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 3);
}

.nav-overlay-panel .panel-photo {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--color-line);
  background: var(--color-bg-alt);
}

.nav-overlay-panel .panel-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}

.nav-overlay-panel .panel-quote {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(16px, 1.6vw, 20px);
  text-transform: uppercase;
  line-height: 1.3;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-line);
  padding-top: calc(var(--u) * 2);
}

@media (max-width: 900px) {
  .nav-overlay-panel {
    display: none;
  }
}

.nav-overlay li a,
.nav-overlay li span {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 48px);
  text-transform: uppercase;
  color: var(--color-text);
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  transition: color 0.2s ease;
}

.nav-overlay li .num {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--color-text-muted);
}

.nav-overlay li a:hover,
.nav-overlay li a.active {
  color: var(--color-accent);
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: calc(var(--nav-h) + var(--u) * 4);
  padding-bottom: calc(var(--u) * 6);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: calc(var(--u) * 8);
  align-items: center;
  max-width: var(--container-width);
  margin: 0 auto;
  width: 100%;
}

.hero-copy {
  text-align: left;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  margin-bottom: calc(var(--u) * 3);
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 108px);
  line-height: 0.92;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: calc(var(--u) * 4);
}

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

.hero-photo {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1.5);
}

.hero-photo-frame {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--color-line);
  background: var(--color-bg-alt);
}

.hero-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-photo-caption {
  display: flex;
  align-items: baseline;
  gap: calc(var(--u) * 1.5);
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hero-photo-caption .index {
  color: var(--color-text-muted);
}

.hero-intro {
  max-width: 520px;
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--color-text);
}

.hero-scroll {
  margin-top: calc(var(--u) * 6);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(var(--u) * 1.25);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--color-text-muted);
}

.hero-scroll .stem {
  width: 1px;
  height: 28px;
  background: var(--color-accent);
  animation: stem-pulse 1.8s ease-in-out infinite;
}

@keyframes stem-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ==========================================================================
   About
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: calc(var(--u) * 4);
  padding-bottom: var(--section-gap);
}

.about-lead {
  grid-column: span 5;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.3;
  text-transform: uppercase;
}

.about-body-col {
  grid-column: span 7;
}

.about-body {
  color: var(--color-text);
  max-width: 640px;
  margin-bottom: calc(var(--u) * 4);
}

.skill-cards {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--u) * 1.25);
  max-width: 560px;
  margin-bottom: calc(var(--u) * 3);
}

.skill-chip {
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 999px;
}

.link-more {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--color-accent);
  border-bottom: 1px solid var(--color-accent);
  padding-bottom: 2px;
  text-decoration: none;
}

.link-more::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translateX(0) rotate(45deg);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.link-more:hover {
  color: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
}

.link-more:hover::after {
  transform: translateX(4px) rotate(45deg);
}

/* ==========================================================================
   Projects
   ========================================================================== */
.projects-grid {
  /* Flexbox rather than a 2-column grid with a shared background-as-gridline
     trick: with an odd number of cards (e.g. 3 team projects, 1 individual
     project) a grid leaves an empty trailing cell that still shows the
     container's background, producing a stray solid block. Flex-wrap just
     leaves a gap instead, which works for any item count. */
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  background: var(--color-line);
  border: 1px solid var(--color-line);
  margin-bottom: var(--section-gap);
}

.project-card {
  background: var(--color-bg);
  padding: calc(var(--u) * 3.5);
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 1.25);
  transition: background 0.25s ease;
  flex: 1 1 calc(50% - 1px);
  min-width: 280px;
}

.project-card:hover {
  background: var(--color-surface);
}

.project-card.is-placeholder {
  opacity: 0.72;
}

.project-tag {
  color: var(--color-accent);
  text-transform: uppercase;
}

.project-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-line);
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.project-card:hover .project-thumb img {
  transform: scale(1.04);
}

.project-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--u);
}

.project-meta .index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
}

.project-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  text-transform: uppercase;
}

.project-role {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-accent);
  text-transform: uppercase;
}

.project-summary {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* ==========================================================================
   Experience
   ========================================================================== */
.experience-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--u) * 4) calc(var(--u) * 6);
  margin-bottom: calc(var(--u) * 8);
}

.experience-item {
  border-top: 1px solid var(--color-line);
  padding-top: calc(var(--u) * 2.5);
}

.experience-item .title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 4px;
}

.experience-item .org {
  color: var(--color-text-muted);
  font-size: 14px;
}

.experience-item .dates {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: calc(var(--u) * 1.5);
}

.experience-item .detail,
.experience-item .detail-list li {
  font-size: 14px;
  color: var(--color-text);
}

.experience-item .detail-list {
  list-style: disc;
  padding-left: 1.1em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.marquee {
  overflow: hidden;
  border-top: 1px solid var(--color-line-strong);
  border-bottom: 1px solid var(--color-line-strong);
  padding: calc(var(--u) * 3) 0;
  /* No bottom margin here — the next section's own top padding
     (--section-gap) already provides the spacer, so this stays visually
     consistent with the gap above the marquee instead of doubling up. */
  margin: calc(var(--u) * 2) calc(var(--gutter) * -1) 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 32s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-track .marquee-photo {
  width: 300px;
  height: 210px;
  object-fit: cover;
  margin: 0 calc(var(--u) * 1.5);
  border: 1px solid var(--color-line);
  filter: grayscale(1);
  opacity: 0.82;
  transition: filter 0.3s ease, opacity 0.3s ease;
  flex-shrink: 0;
}

.marquee-track .marquee-photo:hover {
  filter: grayscale(0);
  opacity: 1;
}

@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: none !important;
  }
}

.stats-row {
  display: flex;
  gap: calc(var(--u) * 5);
  padding-bottom: var(--section-gap);
}

.stat {
  padding-right: calc(var(--u) * 5);
  border-right: 1px solid var(--color-line);
}

.stat:last-child {
  border-right: none;
}

.stat .value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 4vw, 48px);
  color: var(--color-accent);
  line-height: 1;
}

.stat .label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-top: 6px;
}

/* ==========================================================================
   Education
   ========================================================================== */
.education-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--u) * 5);
  margin-bottom: var(--section-gap);
}

.education-item h3 {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 6px;
}

.education-item .school {
  color: var(--color-text-muted);
  font-size: 14px;
}

.education-item .dates {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: calc(var(--u) * 1.5);
}

.education-item .detail {
  font-size: 14px;
  color: var(--color-text);
  max-width: 46ch;
}

/* ==========================================================================
   Blog / Writing
   ========================================================================== */
.blog-list {
  margin-bottom: var(--section-gap);
}

.blog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--u) * 2);
  padding: calc(var(--u) * 2.5) 0;
  border-bottom: 1px solid var(--color-line);
  transition: padding-left 0.2s ease;
}

.blog-row:hover {
  padding-left: var(--u);
}

.blog-row .title {
  font-weight: 600;
  font-size: 16px;
}

.blog-row .meta {
  display: flex;
  gap: calc(var(--u) * 3);
  font-family: var(--font-mono);
  font-size: 12px;
}

.blog-row .date {
  color: var(--color-text-muted);
}

.blog-row .category {
  color: var(--color-accent);
  text-transform: uppercase;
}

/* ==========================================================================
   Contact & footer
   ========================================================================== */
.contact-section {
  padding-bottom: var(--section-gap);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--u) * 4);
  max-width: 800px;
}

.contact-grid .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.contact-grid .value {
  font-size: 16px;
  font-weight: 600;
}

.resume-cta {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 3);
  margin-top: calc(var(--u) * 5);
}

.contact-lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 3vw, 30px);
  text-transform: uppercase;
  max-width: 640px;
  margin-bottom: calc(var(--u) * 5);
}

footer {
  border-top: 1px solid var(--color-line);
  padding: calc(var(--u) * 4) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: var(--u);
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Responsive — tablet
   ========================================================================== */
@media (max-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .about-lead,
  .about-body-col {
    grid-column: 1 / -1;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .experience-grid,
  .education-grid {
    grid-template-columns: 1fr;
    gap: calc(var(--u) * 4);
  }
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: calc(var(--u) * 5);
  }
  .hero-photo {
    order: -1;
    max-width: 320px;
  }
}

/* ==========================================================================
   Responsive — mobile
   ========================================================================== */
@media (max-width: 560px) {
  :root {
    --nav-h: 72px;
  }
  section {
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }
  .hero-photo {
    max-width: 220px;
  }
  .stats-row {
    flex-wrap: wrap;
    row-gap: calc(var(--u) * 3);
  }
  .stat {
    flex: 1 1 40%;
    border-right: none;
    padding-right: 0;
  }
  .blog-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
  footer {
    flex-direction: column;
  }
}

/* ==========================================================================
   Floating theme toggle (light / dark)
   ========================================================================== */
.theme-toggle {
  position: fixed;
  right: calc(var(--u) * 3);
  bottom: calc(var(--u) * 3);
  z-index: 230;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--color-line-strong);
  background: var(--color-surface);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  transition: background 0.25s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

@media (max-width: 560px) {
  .theme-toggle {
    right: calc(var(--u) * 2);
    bottom: calc(var(--u) * 2);
    width: 42px;
    height: 42px;
  }
}

/* ==========================================================================
   Floating "back to top" button — stacked directly above the theme toggle,
   same circular treatment. Hidden until the page has scrolled a bit, then
   fades/slides in; click smooth-scrolls back to the top of the page.
   ========================================================================== */
.back-to-top {
  position: fixed;
  right: calc(var(--u) * 3);
  bottom: calc(var(--u) * 3 + 48px + var(--u) * 2);
  z-index: 230;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--color-line-strong);
  background: var(--color-surface);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 560px) {
  .back-to-top {
    right: calc(var(--u) * 2);
    bottom: calc(var(--u) * 2 + 42px + var(--u) * 1.5);
    width: 42px;
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: opacity 0.25s ease, background 0.25s ease;
    transform: none !important;
  }
}
