/*
 * ulascemh.com
 * Fonts: Raleway and Roboto Slab, SIL Open Font License 1.1.
 */

@font-face {
  font-family: "Raleway";
  src: url("/assets/fonts/raleway-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto Slab";
  src: url("/assets/fonts/roboto-slab-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark light;

  --bg: #14161d;
  --bg-raised: #1d2029;
  --ink: #f2f0ec;
  --ink-soft: #b4b5bd;
  --line: rgb(255 255 255 / 0.13);
  --grid: rgb(255 255 255 / 0.035);
  --accent: #f0654f;
  --accent-ink: #14161d;

  --font-body: "Raleway", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Roboto Slab", Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;

  --gutter: clamp(1.25rem, 5vw, 3rem);
  --trace-tile: 900px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f3ee;
    --bg-raised: #ffffff;
    --ink: #1b1d25;
    --ink-soft: #565863;
    --line: rgb(20 22 29 / 0.16);
    --grid: rgb(20 22 29 / 0.045);
    --accent: #b9301c;
    --accent-ink: #ffffff;
  }
}

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

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

body {
  display: grid;
  grid-template-rows: 1fr auto auto;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 2.5rem 2.5rem;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
}

h1,
p {
  margin: 0;
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

/* Layout */

.page {
  display: grid;
  align-items: center;
  width: 100%;
  max-width: 54rem;
  margin-inline: auto;
  padding: clamp(2.5rem, 8vh, 5rem) var(--gutter) 2rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 4rem);
  align-items: center;
}

.mark {
  display: block;
  color: var(--ink);
  transition: color 0.2s ease;
}

.mark:hover {
  color: var(--accent);
}

.mark svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Type */

.eyebrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
}

.title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 11vw, 5.5rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 34ch;
  margin-top: 0.875rem;
  color: var(--ink-soft);
  font-size: 1.125rem;
  font-weight: 500;
}

/* Actions */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem 1.25rem;
  align-items: center;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  gap: 0.625rem;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.125rem;
  border: 1px solid var(--accent);
  border-radius: 0.375rem;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.btn:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn__tag {
  padding: 0.0625rem 0.4375rem;
  border-radius: 0.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.btn:hover .btn__tag {
  background: var(--accent-ink);
  color: var(--accent);
}

.social {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.375rem;
  color: var(--ink-soft);
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

.social a:hover {
  background: var(--bg-raised);
  color: var(--accent);
}

.social svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Status pages */

.status {
  max-width: 42rem;
}

.status .title {
  font-size: clamp(2.75rem, 9vw, 4.5rem);
}

.status .lede {
  max-width: 44ch;
}

.pill {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 62.5rem;
  background: var(--bg-raised);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.6s ease-in-out infinite;
}

.tape {
  position: fixed;
  inset: 0 0 auto;
  height: 0.875rem;
  background: repeating-linear-gradient(
    -45deg,
    var(--accent) 0 1.125rem,
    var(--bg) 1.125rem 2.25rem
  );
}

.gears {
  position: absolute;
  top: 1.75rem;
  right: clamp(1rem, 4vw, 3rem);
  width: clamp(6.5rem, 17vw, 12rem);
  height: auto;
  pointer-events: none;
}

/* 12 and 8 teeth: the durations keep the 3:2 ratio so the teeth stay meshed. */
.gear {
  animation: turn 24s linear infinite;
}

.gear--large {
  color: var(--accent);
}

.gear--small {
  color: var(--ink-soft);
  animation-duration: 16s;
  animation-direction: reverse;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

/* Signal trace */

.trace {
  overflow: hidden;
  height: 5rem;
  color: var(--accent);
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 12%,
    #000 88%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 12%,
    #000 88%,
    transparent
  );
}

.trace__line {
  width: calc(100% + var(--trace-tile));
  height: 100%;
  background: currentColor;
  -webkit-mask: var(--trace) left center / var(--trace-tile) 5rem repeat-x;
  mask: var(--trace) left center / var(--trace-tile) 5rem repeat-x;
  /* Five real beats at the 73 bpm of the source EKG: 5 x 60 / 73 s. */
  animation: drift 10.11s linear infinite;
}

.trace--live {
  --trace: url("/assets/img/trace-live.svg?v=2");
}

.trace--low {
  --trace: url("/assets/img/trace-low.svg?v=2");
}

.trace--flat {
  --trace: url("/assets/img/trace-flat.svg?v=2");
}

.trace--flat .trace__line {
  animation-duration: 30s;
}

@keyframes drift {
  to {
    transform: translateX(calc(var(--trace-tile) * -1));
  }
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* Footer */

.footer {
  padding: 0.75rem var(--gutter) 1.25rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
}

/* Small screens */

@media (max-width: 40rem) {
  .gears {
    top: 1.25rem;
    right: 0.75rem;
    width: 4.5rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    justify-items: center;
    text-align: center;
  }

  .mark {
    width: min(11rem, 55vw);
  }

  .lede {
    margin-inline: auto;
  }

  .hero .actions {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .trace {
    display: none;
  }
}
