/* ==========================================================================
   birdmurder ˟ design co.
   ========================================================================== */

:root {
  --color-bg: #000;
  --color-yellow: #fdd70b;
  --color-text: #8a8a8a;
  --color-text-body: #8c8c8c;
  --color-heading: #e0e0e0;
  --color-input: #ccc;
  --color-line: rgba(255, 255, 255, 0.2);
  --color-white: #fff;
  --color-grey: #808080;

  --font-mono: "Space Mono", ui-monospace, monospace;
  --font-sans: "Inter", system-ui, sans-serif;

  --tracking: 0.025rem;
  --pill: 2.5rem;
}

/* Reset ------------------------------------------------------------------ */

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

body, h1, h2, h3, p, ul, form { margin: 0; padding: 0; }
h1, h2, h3 { font-size: inherit; font-weight: 400; }
ul { list-style: none; }
img, svg { display: block; max-width: 100%; }
input, button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

html {
  font-size: 16pt;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--color-bg);
  line-height: 1;
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: underline; transition: color 0.25s; }

/* Soft cross-fade between pages in browsers that support it */
@view-transition { navigation: auto; }
a:hover { text-decoration: none; }

::selection { background: var(--color-yellow); color: #000; }

/* Visible focus ring for keyboard users only */
:focus-visible { outline: 2px solid var(--color-yellow); outline-offset: 3px; }
a:focus-visible { border-radius: 2px; }

.sprite { display: none; }

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

/* Layout ----------------------------------------------------------------- */

/* Content sits bottom-left of the viewport */
.page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  padding: 1.25rem 1.25rem 0 0;
  /* clip (not hidden) so the sticky Back button still works */
  overflow: clip;
}

.main {
  max-width: 100%;
}

.main__inner {
  --pad-x: 2.5rem;
  --pad-y: 2rem;
  --spacing: 2rem;
  width: 45rem;
  max-width: 100%;
  padding: var(--pad-y) var(--pad-x);
}

/* Vertical rhythm: siblings are separated by --spacing (margins collapse) */
.main__inner > *,
.hero > * { margin-block: var(--spacing); }

.main__inner > :first-child,
.hero > :first-child { margin-top: 0 !important; }

.main__inner > :last-child,
.hero > :last-child { margin-bottom: 0 !important; }

.hero { padding: 2rem 1.125rem; }

/* "What's up with the name?" page: vertically centred, tighter rhythm.
   Flex items don't collapse margins, so spacing comes from gap here. */
.story {
  --spacing: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--spacing);
  min-height: 100vh;
  min-height: 100svh;
  padding: 0.75rem 1.125rem;
}

/* Images ----------------------------------------------------------------- */

.logo { display: block; width: fit-content; max-width: 100%; }
.logo img { width: 36rem; height: auto; }
.story__mark { width: 3.125rem; height: auto; }
.story > .buttons { margin-block: 0.75rem 0; }

/* Centered layout (thesis page): content sits in the middle of the
   screen instead of the bottom-left like the home page */
.page--center {
  align-items: stretch;
  justify-content: flex-start;
  padding-right: 0;
}
.page--center .main__inner { width: 100%; }

@media (min-width: 737px) {
  /* Shrink-wrap the column and center it, so Back lines up with the text */
  .page--center .main__inner {
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
  }
  .story--video {
    display: grid;
    /* text column | 9:16 video sized to the screen height */
    grid-template-columns: min(26rem, 36vw) min(20rem, 45vw);
    grid-template-columns: min(26rem, 36vw) min(26rem, calc(75svh * 9 / 16), 45vw);
    align-items: center;
    column-gap: clamp(2.5rem, 6vw, 6rem);
    /* fill the screen below the Back button and center vertically */
    min-height: calc(100vh - 11rem);
    min-height: calc(100svh - 11rem);
  }
  .story--video .video { width: 100%; }
}

/* Thesis page: text + vertical (9:16) video.
   Stacked on phones; side by side on wider screens. */
.story__text {
  display: flex;
  flex-direction: column;
  gap: var(--spacing);
}

.video {
  position: relative;
  /* As wide as the column allows, but never taller than ~80% of the screen */
  width: min(100%, 22rem);
  width: min(100%, 22rem, calc(80svh * 9 / 16));
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 2px solid var(--color-line);
  border-radius: 1rem;
  background: #111;
}
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Typography ------------------------------------------------------------- */

.text-lede,
.text-mono,
.text-fine {
  color: var(--color-text);
  font-family: var(--font-mono);
  letter-spacing: var(--tracking);
  line-height: 1.5;
  text-wrap: pretty;
}
.text-lede { font-size: 1.25em; }
.text-mono { font-size: 1em; }
.text-fine { font-size: 0.75em; }

.text-title {
  color: var(--color-heading);
  font-family: var(--font-mono);
  font-size: 2.25em;
  font-weight: 400;
  line-height: 1.125;
}

.text-subhead {
  color: var(--color-heading);
  font-family: var(--font-mono);
  font-size: 1em;
  font-weight: 400;
  letter-spacing: var(--tracking);
  line-height: 1.5;
}

.text-body {
  color: var(--color-text-body);
  font-family: var(--font-sans);
  font-size: 1em;
  letter-spacing: var(--tracking);
  line-height: 1.625;
  text-wrap: pretty;
}
.text-body > p + p { margin-top: 1rem; }

/* Small yellow ✖ mark used inline in the footer */
.x {
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  vertical-align: -0.05em;
}

/* Signup form ------------------------------------------------------------ */

.signup { margin-block: 2.375rem; }

.signup__row {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.signup__field { flex: 1 1 100%; }
.signup__actions { flex: 0 0 auto; }

.signup__trap {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.signup input {
  display: block;
  width: 100%;
  height: 3.75rem;
  padding: 0 1.3125rem;
  background: transparent;
  border: 2px solid var(--color-line);
  border-radius: var(--pill);
  outline: 0;
  appearance: none;
  color: var(--color-input);
  font-family: var(--font-mono);
  font-size: 1.125em;
  line-height: calc(3.75rem - 4px);
}
.signup input:focus-visible { outline: 0; }
.signup input:focus {
  border-color: var(--color-white);
  box-shadow: 0 0 0 1px var(--color-white);
}
.signup input::placeholder { color: var(--color-input); opacity: 0.55; }
.signup input:-webkit-autofill {
  -webkit-text-fill-color: var(--color-input);
  box-shadow: inset 0 0 0 100px var(--color-bg);
  caret-color: var(--color-input);
}
.signup input:-webkit-autofill:focus {
  box-shadow: inset 0 0 0 100px var(--color-bg), 0 0 0 1px var(--color-white);
}

.signup button {
  position: relative;
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  height: 3.75rem;
  padding: 0 1.875rem;
  background: transparent;
  border: 2px solid var(--color-yellow);
  border-radius: var(--pill);
  color: var(--color-yellow);
  font-family: var(--font-mono);
  font-size: 1.125em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.25s, color 0.25s, background-color 0.25s, border-color 0.25s;
}
.signup button:hover { transform: scale(1.06); }
.signup button svg {
  flex: none;
  width: 1em;
  min-width: 16px;
  height: 100%;
  margin-left: 1rem;
  margin-right: -0.125em;
  fill: var(--color-yellow);
  transition: fill 0.25s;
}

/* Spinner shown while submitting */
.signup button::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 2.8125rem; height: 2.8125rem;
  margin: -1.40625rem 0 0 -1.40625rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 96'%3E%3Cdefs%3E%3CclipPath id='c'%3E%3Cpolygon points='0,0 48,0 48,48 96,48 96,96 0,96'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23c)'%3E%3Ccircle cx='48' cy='48' r='32' fill='none' stroke='%23FDD70B' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  animation: spin 1s linear infinite;
}
.signup.is-waiting button { color: transparent; pointer-events: none; }
.signup.is-waiting button svg { fill: transparent; }
.signup.is-waiting button::before { opacity: 1; }

.signup__status:empty { display: none; }
.signup__status { margin-top: 1rem; color: var(--color-yellow); }

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

/* Buttons ---------------------------------------------------------------- */

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block: 2.375rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  height: 3rem;
  padding: 0 1.5rem;
  border: 2px solid var(--color-white);
  border-radius: var(--pill);
  color: var(--color-white);
  font-family: var(--font-mono);
  font-size: 1.125em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.25s, color 0.25s, background-color 0.25s, border-color 0.25s;
}
.button:hover { transform: scale(1.06); }
.button svg {
  flex: none;
  width: 1em;
  min-width: 16px;
  height: 100%;
  margin-left: -0.125em;
  margin-right: 1rem;
  fill: var(--color-white);
}

/* Yellow call-to-action button (home page) */
.button--accent { border-color: var(--color-yellow); color: var(--color-yellow); }
.button--accent svg { fill: var(--color-yellow); }

/* Back button: sticks to the top while scrolling and shrinks to just the arrow.
   The nav itself ignores clicks so it never blocks content underneath it. */
.buttons--back {
  position: sticky;
  top: 1rem;
  z-index: 10;
  padding-inline: 1.125rem;
  pointer-events: none;
}
.buttons--back .button {
  border-color: var(--color-grey);
  background: rgba(0, 0, 0, 0.85);
  font-size: 1em;
  pointer-events: auto;
  transition: padding 0.3s ease, transform 0.25s, border-color 0.25s;
}
.buttons--back .button svg { transition: margin 0.3s ease; }
.buttons--back .label {
  display: inline-block;
  max-width: 8em;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 0.3s ease, opacity 0.2s ease;
}

/* Compact (scrolled) state: a 3rem circle with only the arrow */
.buttons--back.is-compact .button {
  width: auto;
  align-self: flex-start;
  /* 3rem wide: border (2px × 2) + icon (1em, min 16px) + equal padding */
  padding-inline: calc((3rem - 4px - max(1em, 16px)) / 2);
}
.buttons--back.is-compact .button svg { margin: 0; }
.buttons--back.is-compact .label { max-width: 0; opacity: 0; }

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

/* Full-bleed bar with a hairline on top */
.site-footer {
  display: grid;
  grid-template-columns: 4fr 1fr;
  column-gap: 2rem;
  align-items: start;
  width: 100vw;
  margin-left: calc(var(--pad-x) * -1);
  padding: 0.75rem 1.125rem;
  border-top: 1px solid var(--color-line);
}
.main__inner > .site-footer:last-child { margin-bottom: calc(var(--pad-y) * -1) !important; }

.site-footer__signature { text-align: right; }

/* Reveal animation --------------------------------------------------------
   Elements slide in from the left as they enter the viewport.
   Only active when JS is running, so content is never hidden without it. */

.js .reveal {
  opacity: 0;
  transform: translateX(calc(var(--distance, 1.6875rem) * -1));
  transition:
    opacity var(--duration, 1s) ease var(--delay, 0ms),
    transform var(--duration, 1s) ease var(--delay, 0ms);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  @view-transition { navigation: none; }
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 1680px) {
  html { font-size: 12pt; }
}

@media (max-width: 980px) {
  html { font-size: 10pt; }
}

@media (max-width: 736px) {
  :root { --tracking: 0.021875rem; }

  .page { padding: 0; }

  .main__inner { --pad-x: 2rem; }

  .hero { padding: 2rem 1rem; }
  .story { padding: 0.75rem 1rem; }
  .buttons--back { padding-inline: 1rem; }
  .story__mark { align-self: center; }

  .text-title { letter-spacing: 0; }

  .signup,
  .buttons { margin-block: 1.78125rem; }

  .signup__row { flex-direction: column; align-items: stretch; }
  .signup__field { flex: none; }

  .site-footer {
    grid-template-columns: 1fr;
    padding: 0.75rem 1rem;
    text-align: center;
  }
  .site-footer__signature { display: none; }
}

@media (max-width: 480px) {
  .main__inner { --spacing: 1.75rem; }
  .story { --spacing: 1.3125rem; }

  .signup button { width: 100%; max-width: 32rem; }
  .signup__actions { width: 100%; }

  .buttons { flex-direction: column; }
  .button { width: 100%; max-width: 32rem; }
}

@media (max-width: 360px) {
  .main__inner { --pad-x: 1.5rem; --pad-y: 1.5rem; --spacing: 1.5rem; }

  .hero { padding: 1.5rem 0.75rem; }
  .story { --spacing: 1.125rem; padding: 0.5625rem 0.75rem; }
  .buttons--back { padding-inline: 0.75rem; }
  .site-footer { padding: 0.5625rem 0.75rem; column-gap: 1.5rem; }

  .text-title { font-size: 2em; }

  .buttons { gap: 0.5625rem; }
}
