/* misguidedlabs.co — one stylesheet, no build step. */

@font-face {
  font-family: "Departure Mono";
  src: url("/static/fonts/DepartureMono-Regular.woff2") format("woff2");
  font-display: swap;
}

@view-transition { navigation: auto; }

:root {
  /* the frame: one inset for every edge of the chrome */
  --frame: 75px;
  /* where the sea's horizon sits, in px from the bottom; sky.js keeps it exact */
  --horizon: 39.4svh;
  --horizon-gap: 40px;
  --hero-size: clamp(20px, 14px + 1.5vw, 40px);
  /* theme changes: the page and the sea share one duration and curve */
  --theme-time: 900ms;
  --theme-curve: cubic-bezier(0.33, 0, 0.67, 1);

  --bg: #e6e4df;
  --ink: #353431;
  --ink-soft: #6a6761;
  --rule: rgba(53, 52, 49, 0.18);
  --paper: 249, 248, 245;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "Departure Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  /* the emblem, small, as the hover mark, and one of its rings as a bullet (masked, so both take the text colour) */
  --mark: url("/static/mark.svg");
  --ring: url("/static/ring.svg");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1b;
    --ink: #eceae5;
    --ink-soft: #a9a59e;
    --rule: rgba(236, 234, 229, 0.18);
    --paper: 44, 43, 41;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1c1b;
  --ink: #eceae5;
  --ink-soft: #a9a59e;
  --rule: rgba(236, 234, 229, 0.18);
  --paper: 44, 43, 41;
  color-scheme: dark;
}
/* registered so the paper colour can glide between themes */
@property --paper { syntax: "*"; inherits: true; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--theme-time) var(--theme-curve), color var(--theme-time) var(--theme-curve);
}
a { color: inherit; }

/* Background: the sea fades in once its first frame is drawn */
#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  opacity: 0;
  transition: opacity 1s ease;
}
#sky.ready { opacity: 1; }
.grain {
  position: fixed;
  inset: -100px;
  z-index: 3;
  pointer-events: none;
  opacity: 0.13;
  will-change: transform;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 2.2 -.7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.5s steps(5) infinite;
}
:root[data-theme="dark"] .grain { opacity: 0.1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .grain { opacity: 0.1; } }
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-37px, 21px); }
  40% { transform: translate(29px, -44px); }
  60% { transform: translate(-18px, -27px); }
  80% { transform: translate(41px, 33px); }
}

/* The constellation's name, under the figure the sea's shader draws; night only, and not before the sea has shown */
.sign {
  position: fixed;
  z-index: 1;
  translate: -50% 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 1s ease;
}
:root[data-theme="dark"] #sky.ready ~ .sign { opacity: calc(0.55 * var(--sign-a, 1)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #sky.ready ~ .sign { opacity: calc(0.55 * var(--sign-a, 1)); } }
body[data-page="content"] .sign { display: none; }
.sign-lines {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  color: var(--ink);
  opacity: 0;
}
.sign-lines line { stroke: currentColor; stroke-width: 1; stroke-linecap: round; shape-rendering: geometricPrecision; }
/* once the sea has shown, and when the sign changes, the lines draw themselves in from star to star, one after another */
.sign-lines line.draw { animation: draw var(--dur, 0.5s) ease-in-out var(--delay, 0s) both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
:root[data-theme="dark"] #sky.ready ~ .sign-lines { opacity: calc(0.5 * var(--sign-a, 1)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #sky.ready ~ .sign-lines { opacity: calc(0.5 * var(--sign-a, 1)); } }
body[data-page="content"] .sign-lines { display: none; }

/* Chrome: emblem top left, menu top right, footer bottom, all pinned to the frame */
.frame { position: relative; z-index: 2; min-height: 100svh; }
.emblem {
  --emblem: 44px;
  position: fixed;
  left: var(--frame);
  /* centred on the menu's first line (its label is 18px tall and sits on the frame line) */
  top: calc(var(--frame) + 9px - var(--emblem) / 2);
  z-index: 6;
  display: block;
  width: var(--emblem);
  height: var(--emblem);
  color: var(--ink);
}
.emblem svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* five rings, five-fold symmetry: on hover the ring turns one step about its centre */
.emblem g {
  transform-box: view-box;
  transform-origin: 300px 309px;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.emblem:is(:hover, :focus-visible) g { transform: rotate(72deg); }

.menu, .bottom, .works .kicker {
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: uppercase;
}
.menu {
  position: fixed;
  right: var(--frame);
  top: var(--frame);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.menu button {
  all: unset;
  position: relative;
  z-index: 2;
  cursor: pointer;
  font: inherit;
  text-transform: uppercase;
  line-height: 18px;
  /* the links carry room for their hover mark on the right; the label lines up with their text */
  padding-right: 21px;
}
.menu-links {
  position: absolute;
  top: 26px;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  white-space: nowrap;
}
.menu-links[hidden] { display: none; }
.menu-links .gap { height: 3px; }
.menu-links { --pitch: 27px; }
.menu-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  line-height: 18px;
  opacity: 0;
  transform: translateY(calc(var(--i, 0) * -1 * var(--pitch)));
  animation: drop 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  animation-delay: calc(var(--i, 0) * 35ms);
  will-change: transform, opacity;
}
@keyframes drop {
  30% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
/* closing: the stack slides back up, bottom link first, fading as it goes, on the same smooth curve */
.menu-links.closing a {
  animation: rise 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) both;   /* both: a link holds its place until its turn to rise */
  animation-delay: calc((var(--n, 1) - 1 - var(--i, 0)) * 35ms);
}
@keyframes rise {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(calc(var(--i, 0) * -1 * var(--pitch))); }
}
  70% { opacity: 1; }
  to { opacity: 0; transform: translateY(calc(var(--i, 0) * -1 * var(--pitch))); }
}
.menu a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

/* Hover: a dotted underline, and the small emblem turns beside the word */
.menu-links a::after,
.hero a::before {
  content: "";
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--mark) center / contain no-repeat;
  mask: var(--mark) center / contain no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.menu-links a:hover,
.menu-links a:focus-visible {
  text-decoration: underline dotted;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.14em;
}
.menu-links a:is(:hover, :focus-visible)::after,
.hero a:is(:hover, :focus-visible)::before {
  opacity: 1;
  animation: spin 4s linear infinite;
}
@keyframes spin { to { rotate: 360deg; } }

.bottom {
  position: fixed;
  left: var(--frame);
  right: var(--frame);
  bottom: calc(var(--frame) + 1px);
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.bottom > * { pointer-events: auto; }
.bottom button {
  all: unset;
  cursor: pointer;
  font: inherit;
  text-transform: uppercase;
  padding: 6px 10px;
  margin-right: -1px;
}
.menu button:hover, .bottom button:hover { color: var(--ink-soft); }

/* Home: the line sits a fixed gap above the horizon and grows upward */
.hero {
  position: fixed;
  left: var(--frame);
  right: var(--frame);
  bottom: calc(var(--horizon) + var(--horizon-gap));
  z-index: 2;
  margin: 0;
  text-align: center;
}
.hero p {
  margin: 0;
  font-style: italic;
  font-weight: 400;
  font-size: var(--hero-size);
  line-height: 1.15;
  text-wrap: balance;
}
.hero a {
  position: relative;
  display: inline-block;
  text-decoration: underline dotted;
  text-decoration-thickness: 0.03em;
  text-underline-offset: 0.08em;
}
.hero a:hover { text-decoration: none; }
.hero a::before {
  position: absolute;
  left: 50%;
  top: -18px;
  translate: -50% 0;
}
.nowrap { white-space: nowrap; }

/* Text pages: a paper wash, solid behind the column and thinning toward the edges */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 112% at 50% 48%,
    rgba(var(--paper), 0.98) 0 46%,
    rgba(var(--paper), 0.93) 55%,
    rgba(var(--paper), 0.62) 68%,
    rgba(var(--paper), 0.24) 81%,
    rgba(var(--paper), 0) 95%
  );
  transition: --paper var(--theme-time) var(--theme-curve);
}
.prose {
  position: relative;
  z-index: 2;
  width: min(100% - 2 * var(--frame), 760px);
  margin: 0 auto;
  padding: calc(var(--frame) + 76px) 0 calc(var(--frame) + 100px);
  font-size: clamp(18px, 17px + 0.375vw, 20px);
  line-height: 1.6;
}
.prose p { margin: 0 0 20px; }
.prose .lead { font-style: italic; }
.prose h2 {
  margin: 20px 0 0;
  font-size: inherit;
  font-style: italic;
  font-weight: 700;
}
.prose h2 + p { margin-top: 0; }
.prose a {
  text-decoration: underline dotted;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.14em;
}
.prose a:hover { text-decoration-style: solid; }
.works { list-style: none; margin: 0 0 1.4em; padding: 0; }
.works li { padding: 0.9em 0; border-top: 1px solid var(--rule); }
.works li:last-child { border-bottom: 1px solid var(--rule); }
.works .head { display: flex; justify-content: space-between; gap: 1em; align-items: baseline; flex-wrap: wrap; }
.works .name { font-style: italic; font-weight: 700; }
.works .kicker { font-size: 13px; color: var(--ink-soft); }
.works p { margin: 0.2em 0 0; }
.works .limit { color: var(--ink-soft); font-size: 0.9em; }

/* Values: a heading, then rows that open on their reasons */
.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; }
.prose .section-heading { margin: 0 0 10px; }
.prose .section-heading--spaced { margin-top: 20px; }
.prose .section-heading strong { font-size: 20px; }
.disclosure { margin: 0 0 6px; }
.disclosure-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  list-style: none;
  cursor: pointer;
}
.disclosure-summary::-webkit-details-marker { display: none; }
.disclosure-summary::before {
  content: "";
  box-sizing: border-box;
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
.disclosure[open] .disclosure-summary::before { transform: rotate(45deg); }
.disclosure-summary em { display: contents; }
.disclosure-title { font-size: 20px; line-height: 1.15; font-style: italic; }
.disclosure-summary:is(:hover, :focus-visible) .disclosure-title {
  text-decoration: underline dotted;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.14em;
}
/* the small emblem turns beside a row, a role's APPLY and the posts' link on hover, as in the menu */
.disclosure-summary::after,
.join-role__apply::after,
.posts-action::after {
  content: "";
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--mark) center / contain no-repeat;
  mask: var(--mark) center / contain no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.disclosure-summary:is(:hover, :focus-visible)::after,
.join-role__apply:is(:hover, :focus-visible)::after,
.posts-action:is(:hover, :focus-visible)::after { opacity: 1; animation: spin 4s linear infinite; }
.icon-list { list-style: none; margin: 6px 0 14px 20px; padding: 0; }
.icon-list li { position: relative; margin: 0 0 3px; padding-left: 16px; }
.icon-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 10px;
  height: 10px;
  background: currentColor;
  -webkit-mask: var(--ring) center / contain no-repeat;
  mask: var(--ring) center / contain no-repeat;
}

/* Join: a table of roles with an APPLY link each */
.join-roles { border-collapse: collapse; border: 0; width: auto; max-width: 100%; }
.join-roles td { padding: 0; border: 0; vertical-align: baseline; }
.join-role__title { width: min(24rem, 60vw); }
.join-role__title em { display: block; line-height: 1.4; }
.join-role__spacer { width: 10vw; min-width: 10vw; }
.join-role__apply, .posts-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
}
.join-role__apply:is(:hover, :focus-visible), .posts-action:is(:hover, :focus-visible) {
  text-decoration: underline dotted;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.14em;
}

/* Posts: a mono date beside an italic title */
.posts-list {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.6em;
  row-gap: 6px;
}
.posts-list li,
.posts-list li > a { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: baseline; }
.posts-list li > a { text-decoration: none; }
.posts-list a .post-name::after {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-left: 8px;
  vertical-align: -2px;
  background: currentColor;
  -webkit-mask: var(--mark) center / contain no-repeat;
  mask: var(--mark) center / contain no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.posts-list a:is(:hover, :focus-visible) .post-name { text-decoration: underline dotted; text-decoration-thickness: 0.06em; text-underline-offset: 0.14em; }
.posts-list a:is(:hover, :focus-visible) .post-name::after { opacity: 1; animation: spin 4s linear infinite; }
.post-date { font-family: var(--mono); font-size: 15px; line-height: 24px; color: var(--ink-soft); }
.post-name { font-size: 20px; line-height: 1.15; font-style: italic; }
.prose .posts-note { margin-top: 28px; font-size: 15px; line-height: 1.5; color: var(--ink-soft); }
.prose .posts-note a { color: var(--ink); }
@media (max-width: 520px) {
  .posts-list { grid-template-columns: minmax(0, 1fr); }
  .posts-list li, .posts-list li > a { grid-template-columns: minmax(0, 1fr); }
}

/* A post, laid out as a letter */
.email-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 10px;
  align-items: baseline;
  margin: 0 0 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
}
.email-meta p { display: contents; }
.email-meta-key { color: var(--ink-soft); }
.email-meta-value { min-width: 0; overflow-wrap: anywhere; }
.email-meta a { text-decoration: none; }
.email-meta a:hover { text-decoration: underline dotted; text-decoration-thickness: 0.06em; text-underline-offset: 0.14em; }
.letter-body { font-size: 20px; line-height: 32px; text-wrap: pretty; }
.letter-body p { margin: 0 0 25px; }
.letter-body a { font-weight: 700; }
.letter-body h2, .letter-body h3 { margin: 40px 0 16px; line-height: 1.3; font-weight: 700; text-wrap: balance; }
.letter-body h2 { font-size: 24px; }
.letter-body h3 { font-size: 20px; margin: 32px 0 12px; }
.letter-body ul, .letter-body ol { margin: 0 0 25px; padding-left: 1.6em; }
.letter-body li { margin: 6px 0; }
.letter-body ul { list-style: none; padding-left: 1.4em; }
.letter-body ul li { position: relative; }
.letter-body ul li::before { content: ""; position: absolute; left: -1.4em; top: 0.62em; width: 10px; height: 10px; background: currentColor; -webkit-mask: var(--ring) center / contain no-repeat; mask: var(--ring) center / contain no-repeat; }
.letter-body blockquote { margin: 0 0 25px; padding-left: 1em; border-left: 4px solid var(--rule); font-style: italic; }
.letter-body blockquote p:last-child { margin-bottom: 0; }
.letter-body code { font-family: var(--mono); font-size: 15px; }
.letter-body pre { margin: 26px 0; padding: 24px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 24px; }
.letter-body pre code { font-size: inherit; }
.letter-body hr { margin: 48px 0; border: 0; border-top: 1px solid var(--rule); }
.letter-body figure { margin: 32px 0; }
.letter-body img { display: block; width: 100%; height: auto; }
.letter-body figcaption { margin-top: 8px; font-size: 0.85em; line-height: 1.35; text-align: center; color: var(--ink-soft); }
.prose .letter-footer {
  display: flex;
  gap: 1.6em;
  margin: 48px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.prose .letter-footer a { color: var(--ink); text-decoration: none; }
.prose .letter-footer a:hover { text-decoration: underline dotted; text-decoration-thickness: 0.06em; text-underline-offset: 0.14em; }
@media (max-width: 520px) {
  .letter-body { font-size: 18px; line-height: 29px; }
}

/* Entrance */
main { animation: in 0.52s ease both; }
main.prose { animation-duration: 0.3s; }
@keyframes in { from { opacity: 0; } to { opacity: 1; } }

/* Between phone and desktop: a narrower column, footer kept clear of it */
@media (min-width: 801px) {
  .bottom { left: clamp(28px, 50vw - 520px, var(--frame)); right: clamp(28px, 50vw - 520px, var(--frame)); }
}
@media (min-width: 801px) and (max-width: 1100px) {
  .prose { width: min(680px, 100vw - 360px); }
}

/* Tablet and phone */
@media (max-width: 800px) {
  :root { --frame: 40px; --horizon-gap: 32px; --hero-size: 22px; }
  .emblem { --emblem: 30px; }
  .menu button { padding: 15px 10px; margin: -15px -10px; min-height: 44px; box-sizing: border-box; }

  /* the menu opens as a paper panel over the page, solid on the right where the links are */
  .menu-links {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow-y: auto;
    padding: calc(var(--frame) + 44px) var(--frame) var(--frame);
    gap: 8px;
    animation: panel-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .menu-links::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgb(var(--paper));
    -webkit-mask-image: linear-gradient(to right, transparent, #000 50%);
    mask-image: linear-gradient(to right, transparent, #000 50%);
  }
  .menu-links { --pitch: 52px; }
  .menu-links a {
    position: relative;
    min-height: 44px;
    padding-left: 16px;
    justify-content: flex-end;
  }
  .menu-links a::after { position: absolute; right: calc(100% + 6px); }
  .menu-links .gap { height: 0; }
  @keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } }
  .menu-links.closing { animation: panel-out 0.5s ease 0.15s both; }
  @keyframes panel-out { to { opacity: 0; transform: translateY(-4px); } }

  /* on text pages the footer ends the page instead of floating over it */
  body[data-page="content"] .bottom { position: absolute; bottom: calc(var(--frame) + 1px); }
  body[data-page="content"] .frame { padding-bottom: calc(var(--frame) + 40px); }
  .prose { padding: calc(var(--frame) + 88px) 0 var(--frame); }

  /* a band of paper under the pinned emblem and menu, so text scrolls beneath them */
  body[data-page="content"] .frame::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--frame) + 84px);
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(rgb(var(--paper)) 0 calc(100% - 64px), rgba(var(--paper), 0));
  }
  .page-veil {
    background: radial-gradient(
      ellipse 88% 120% at 50% 48%,
      rgba(var(--paper), 0.98) 0 42%,
      rgba(var(--paper), 0.94) 52%,
      rgba(var(--paper), 0.68) 64%,
      rgba(var(--paper), 0.3) 77%,
      rgba(var(--paper), 0) 92%
    );
  }
  .works .head { flex-direction: column; gap: 0.15em; }
}
@media (max-width: 520px) {
  :root { --frame: 28px; --horizon-gap: 24px; }
  .bottom button { padding: 6px; margin-right: 1px; }
}
body.menu-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .menu-links a { opacity: 1; transform: none; }
  .sign-lines line { stroke-dashoffset: 0 !important; }
  @view-transition { navigation: none; }
}
.reg { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.8em; vertical-align: 0.25em; margin-left: 1px; }
