/* ABOUTME: Shared stylesheet for the Epilogue Labs site (home and careers). */
/* ABOUTME: Day/night palette, Geist type scale, the hero resolve animation, and careers roles. */

:root {
  color-scheme: light;

  --day: #f3f2ee;
  --ink: #1d1c1a;
  --ink-soft: #5f5b54;
  --night: #121311;
  --night-ink: #ecebe6;
  --night-soft: rgb(236 235 230 / 0.64);

  /* Contextual tokens; .night swaps them for dark sections */
  --bg: var(--day);
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);
  --line: rgb(29 28 26 / 0.14);

  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(1rem, 5vw, 3rem);
  --measure: 34rem;
  --ease-out: cubic-bezier(0.3, 0, 0.2, 1);
}

.night {
  --bg: var(--night);
  --fg: var(--night-ink);
  --fg-soft: var(--night-soft);
  --line: rgb(255 255 255 / 0.14);
  background: var(--bg);
  color: var(--fg);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1.02rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
  line-height: 1.08;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
  border-radius: 2px;
}

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

.skip-link {
  position: absolute;
  top: -4rem;
  left: var(--gutter);
  z-index: 20;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--day);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: 100%;
  max-width: 76rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

/* ---------- Links and buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.button:hover {
  border-color: var(--fg-soft);
}

.button--primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.button--primary:hover {
  background: var(--fg-soft);
  border-color: var(--fg-soft);
}

.text-link {
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: color 0.25s ease;
}

.text-link:hover {
  color: var(--fg-soft);
}

.nav-link {
  color: var(--fg-soft);
  text-decoration: none;
  transition: color 0.25s ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--fg);
}

/* ---------- Header ---------- */

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1.5rem;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  gap: clamp(1rem, 3vw, 1.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

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

.hero {
  /* The trace overhangs the art; keep it inside the hero */
  overflow: clip;
  padding-top: clamp(3rem, 8vw, 6rem);
  text-align: center;
}

.hero__text {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 1.4rem;
}

.hero h1 {
  font-size: clamp(2.3rem, 1.5rem + 3.2vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero__lede {
  max-width: 30rem;
  color: var(--fg-soft);
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.hero__caption {
  position: relative;
  padding-top: 1.5rem;
  color: var(--fg-soft);
}

.hero__caption-sep {
  margin-inline: 0.35em;
}

/* On phones the two caption phrases stack instead of wrapping mid-phrase */
@media (max-width: 30rem) {
  .hero__caption-phrase {
    display: block;
  }

  .hero__caption-sep {
    display: none;
  }
}

/* ---------- Campfire stage: watercolor resolving out of a pixel mosaic ---------- */

@property --resolve {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 46%;
}

.stage {
  position: relative;
  z-index: 0;
  width: min(100%, 60rem);
  aspect-ratio: 576 / 433;
  /* Tuck the illustration's empty sky up behind the hero text */
  margin: -16% auto -6%;
  pointer-events: none;
}

.stage__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  --resolve: 46%;
  animation: resolve 2.4s var(--ease-out) 0.15s both;
}

.stage__paint {
  -webkit-mask-image: linear-gradient(90deg, #000 var(--resolve), transparent calc(var(--resolve) + 10%));
  mask-image: linear-gradient(90deg, #000 var(--resolve), transparent calc(var(--resolve) + 10%));
}

.stage__mosaic {
  -webkit-mask-image: linear-gradient(90deg, transparent var(--resolve), #000 calc(var(--resolve) + 10%));
  mask-image: linear-gradient(90deg, transparent var(--resolve), #000 calc(var(--resolve) + 10%));
}

@keyframes resolve {
  from { --resolve: -10%; }
  to { --resolve: 46%; }
}

/* Thin trace across the art, annotated with lifecycle stages */
.trace {
  position: absolute;
  inset: 30% -10%;
}

.trace svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.trace path {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.trace__stage {
  position: absolute;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgb(243 242 238 / 0.82);
  color: var(--fg);
  white-space: nowrap;
  transform: translate(-50%, -100%);
}

.trace__stage::after {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  margin: 6px auto 0;
  border: 1.5px solid var(--fg);
  border-radius: 50%;
  background: var(--bg);
  transform: translateY(50%);
}

.trace__stage--serve { left: 26%; top: 59%; }
.trace__stage--feedback { left: 50%; top: 48%; }
.trace__stage--adapt { left: 76%; top: 30%; }

/* ---------- Dusk: day fades into night ---------- */

.dusk {
  height: clamp(6rem, 14vw, 12rem);
  background: linear-gradient(var(--day), var(--night));
}

/* ---------- Thesis essay ---------- */

.thesis {
  padding-block: clamp(5rem, 11vw, 9rem);
}

.thesis .container {
  display: grid;
  gap: 2rem;
}

.thesis h2 {
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.3rem);
  letter-spacing: -0.025em;
}

.thesis__aside {
  display: grid;
  align-content: start;
  gap: clamp(2rem, 4vw, 3rem);
}

/* A cropped window onto the tea watercolor: its figures sit within x 114–462, y 134–315 of 576×433 */
.thesis__art {
  position: relative;
  max-width: 26rem;
  aspect-ratio: 348 / 181;
  overflow: hidden;
}

.thesis__art-frame {
  position: absolute;
  top: -73.9%;
  left: -32.8%;
  width: 165.5%;
  aspect-ratio: 576 / 433;
}

/* Same watercolor/mosaic split as the hero, held still */
.thesis__art .stage__layer {
  animation: none;
}

@media (min-width: 56rem) {
  .thesis .container {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(3rem, 7vw, 7rem);
  }

  .thesis__aside {
    position: sticky;
    top: 2rem;
    align-self: start;
  }
}

.prose {
  display: grid;
  gap: 1.2rem;
  max-width: var(--measure);
  line-height: 1.7;
}

.prose__quiet {
  color: var(--fg-soft);
}

.prose__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  margin-top: 0.5rem;
  /* Land the #work-with-us anchor mid-screen so the essay above stays in view */
  scroll-margin-top: 30vh;
}

/* ---------- Closing ---------- */

.closing {
  padding-block: clamp(6rem, 12vw, 10rem);
}

.closing .container {
  display: grid;
  justify-items: center;
  gap: 1.5rem;
  text-align: center;
}

.closing h2 {
  font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.75rem);
  letter-spacing: -0.025em;
}

.closing p {
  max-width: 32rem;
  color: var(--fg-soft);
  line-height: 1.7;
}

.closing__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--fg-soft);
  font-size: 0.9rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 2rem;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--fg);
}

/* ---------- Careers ---------- */

.careers-intro {
  display: grid;
  gap: 1.25rem;
  padding-block: clamp(3rem, 8vw, 6rem) clamp(3rem, 6vw, 4.5rem);
}

.careers-intro h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  letter-spacing: -0.03em;
}

.careers-intro p {
  max-width: 30rem;
  color: var(--fg-soft);
}

.roles {
  margin-bottom: clamp(5rem, 10vw, 8rem);
  border-top: 1px solid var(--line);
}

.role {
  border-bottom: 1px solid var(--line);
  interpolate-size: allow-keywords;
}

.role summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5rem;
  padding-block: clamp(1.5rem, 3.5vw, 2.25rem);
  cursor: pointer;
  list-style: none;
}

.role summary::-webkit-details-marker {
  display: none;
}

.role summary h2 {
  display: grid;
  gap: 0.5rem;
  font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.9rem);
  letter-spacing: -0.02em;
  transition: color 0.25s ease;
}

.role summary:hover h2 {
  color: var(--fg-soft);
}

.role__focus {
  color: var(--fg-soft);
  text-transform: uppercase;
}

/* Plus that turns into a minus when the role is open */
.role__marker {
  position: relative;
  width: 1.25rem;
  height: 1.25rem;
}

.role__marker::before,
.role__marker::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--fg);
  transition: rotate 0.4s var(--ease-out), opacity 0.4s ease;
}

.role__marker::after {
  rotate: 90deg;
}

.role[open] .role__marker::after {
  rotate: 0deg;
  opacity: 0;
}

.role::details-content {
  block-size: 0;
  overflow: clip;
  transition: block-size 0.45s var(--ease-out), content-visibility 0.45s allow-discrete;
}

.role[open]::details-content {
  block-size: auto;
}

.role__body {
  display: grid;
  gap: 1.5rem;
  max-width: 40rem;
  /* Top padding keeps the summary's focus ring clear of the first heading */
  padding-top: 0.75rem;
  padding-bottom: clamp(2rem, 4vw, 3rem);
}

.role__body h3 {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.role__body p {
  color: var(--fg-soft);
}

.role__contact {
  display: grid;
  justify-items: start;
  gap: 0.9rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

@media (min-width: 48rem) {
  .role__body {
    margin-left: clamp(0rem, 8vw, 6rem);
  }
}

/* ---------- Reduced motion ---------- */

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  /* Separate rule: browsers without ::details-content would otherwise drop the whole list */
  .role::details-content {
    transition: none !important;
  }
}
