/* awalkley.com — portfolio styles */

:root {
  --bg: #0f1115;
  --bg-alt: #161922;
  --fg: #e8eaed;
  --fg-muted: #9aa3af;
  --accent: #6ea8fe;
  --border: #262b36;
  --measure: 68ch;
  --radius: 10px;

  /* The chess montage behind the Marginal Chess card. The board is drawn on
     a canvas from these, so the montage follows the page's theme instead of
     carrying one of its own. */
  --montage-light: rgba(255, 255, 255, 0.1);
  --montage-dark: rgba(0, 0, 0, 0.34);
  --montage-move: rgba(110, 168, 254, 0.26);
  --montage-piece-light: rgba(255, 255, 255, 0.96);
  --montage-piece-dark: rgba(4, 6, 10, 0.97);
  --montage-piece-light-edge: rgba(0, 0, 0, 0.6);
  --montage-piece-dark-edge: rgba(255, 255, 255, 0.5);
  --montage-veil: rgba(15, 17, 21, 0.56);
  --montage-veil-strong: rgba(15, 17, 21, 0.76);
  --montage-band: rgba(15, 17, 21, 0.9);
  --montage-ribbon: rgba(15, 17, 21, 0.9);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --bg-alt: #f6f7f9;
    --fg: #14171c;
    --fg-muted: #5b6472;
    --accent: #1a5fd0;
    --border: #e2e5ea;

    --montage-light: rgba(0, 0, 0, 0.085);
    --montage-dark: rgba(0, 0, 0, 0.22);
    --montage-move: rgba(26, 95, 208, 0.24);
    --montage-piece-light: rgba(255, 255, 255, 0.99);
    --montage-piece-dark: rgba(14, 18, 26, 0.96);
    --montage-piece-light-edge: rgba(20, 23, 28, 0.72);
    --montage-piece-dark-edge: rgba(255, 255, 255, 0.8);
    --montage-veil: rgba(255, 255, 255, 0.68);
    --montage-veil-strong: rgba(255, 255, 255, 0.86);
    --montage-band: rgba(255, 255, 255, 0.92);
    --montage-ribbon: rgba(255, 255, 255, 0.92);
  }
}

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

/* The browser's own [hidden] rule only sets display: none, so any author
   rule that sets display beats it — .btn sets display: inline-block, which
   left the account page showing its "Log out" button before anyone had
   signed in. This makes the attribute mean what it says. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* Header / nav */

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav__brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--fg);
}

.nav__brand span {
  color: var(--fg-muted);
  font-weight: 400;
}

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

.nav__links a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav__links a:hover,
.nav__links a:focus-visible {
  color: var(--fg);
}

/* Session controls, top right. Every page carries them; js/nav.js keeps them
   honest about who is signed in. */

.nav__auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav__user {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
}

.nav__user:hover,
.nav__user:focus-visible {
  color: var(--fg);
}

@media (max-width: 640px) {
  .nav {
    padding: 0.85rem 1rem;
    gap: 0.75rem;
  }

  /* Brand and session controls on the first row, links on their own row
     underneath — three buttons do not fit beside four links. */
  .nav__links {
    order: 3;
    width: 100%;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .nav__auth {
    margin-left: auto;
  }
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  opacity: 0.9;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--ghost {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--fg);
}

.btn--small {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* A button doing slow work — hashing a password, waiting on the mail relay —
   says so with a spinner, so the pause reads as progress rather than a dead
   click. Paired with the `aria-busy` form state set in account.js. */
.btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

.btn:disabled:hover,
.btn:disabled:focus-visible {
  transform: none;
  opacity: 0.65;
}

.btn--busy::before {
  content: '';
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.5em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .btn--busy::before {
    animation-duration: 2s;
  }
}

/* Sections */

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 1.25rem;
}

.section--alt {
  max-width: none;
  background: var(--bg-alt);
}

.section--alt > * {
  max-width: 1100px;
  margin-inline: auto;
}

.section__title {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin: 0 0 2rem;
}

.prose {
  max-width: var(--measure);
  color: var(--fg-muted);
}

.prose p {
  margin: 0 0 1rem;
}

/* Project cards */

.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--bg-alt);
}

.card__title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.card__title a {
  color: var(--fg);
  text-decoration: none;
}

.card__title a:hover,
.card__title a:focus-visible {
  color: var(--accent);
}

.card__meta {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.card__body {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  color: var(--fg-muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tags li {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-muted);
}

/* Work grid */

.work-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.work {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  background: var(--bg-alt);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.work:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.work__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.work__title {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.work__title a {
  color: var(--fg);
  text-decoration: none;
}

/* Stretched link: whole card is clickable, but only the title is a link
   for screen readers and keyboard focus. */
.work__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.work__status {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.work__status--live {
  border-color: var(--accent);
  color: var(--accent);
}

.work__tagline {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.97rem;
  flex: 1;
}

.work__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.work__stack li {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

.work__stats {
  display: flex;
  gap: 1.25rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* Chess montage

   Hovering the Marginal Chess card plays famous games on a board behind the
   card. The board and the veil sit below the card's own text (negative
   z-index inside an isolated stacking context), so nothing about the card
   moves or reflows when the montage starts. */

.work--montage {
  /* Its own stacking context, so the board below cannot escape the card,
     and so the rounded corners clip it. */
  isolation: isolate;
  overflow: hidden;
}

.work__montage {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.work.is-montage .work__montage {
  opacity: 1;
}

.work__montage-veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    var(--montage-veil-strong) 0%,
    var(--montage-veil) 30%,
    var(--montage-veil) 100%
  );
}

.work.is-montage .work__montage-veil {
  opacity: 1;
}

/* The band along the top of the card names the game being played, and the
   ribbon along the bottom says who is playing and how far through the game
   the montage is. Both sit in the card's own padding, so they cost the
   layout nothing and never cover the card's text. */

.work__montage-band,
.work__montage-ribbon {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  /* The height of the card's own padding, so the band sits in the padding
     and the card's title still lines up with the other cards. */
  height: 1.6rem;
  padding: 0 0.9rem;
  font-size: 0.63rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-muted);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  white-space: nowrap;
}

.work.is-montage .work__montage-band,
.work.is-montage .work__montage-ribbon {
  opacity: 1;
}

.work__montage-band {
  top: 0;
  background: linear-gradient(180deg, var(--montage-band) 40%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.work__montage-ribbon {
  bottom: 0;
  background: linear-gradient(0deg, var(--montage-ribbon) 40%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.work__montage-band-name {
  color: var(--accent);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work__montage-band-where {
  margin-left: auto;
  flex-shrink: 0;
}

.work__montage-ribbon-players {
  color: var(--fg);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work__montage-ribbon-move {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Project detail pages */

.project {
  max-width: 1000px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.project__crumb {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.project__crumb a {
  color: var(--fg-muted);
  text-decoration: none;
}

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

.project__title {
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.project__tagline {
  font-size: 1.15rem;
  color: var(--fg-muted);
  max-width: 55ch;
  margin: 0 0 2rem;
}

/* The stat figures on a work card, separated by bullets. These used to sit
   inside the .project__tagline rule by accident, where they only matched a
   card inside a tagline — nowhere on the site. */
.work__stat {
  display: inline-block;
}

.work__stat:not(:last-child)::after {
  content: " \2022 ";
  margin: 0 0.5rem;
  color: var(--border);
}

.project__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 2.5rem;
}

/* Under the buttons of a service that needs an account: the reason a link
   will ask you to sign in is better said here than on the sign-in page. */
.project__account-note {
  margin: -1.5rem 0 2.5rem;
  max-width: var(--measure);
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.project__section {
  margin: 0 0 2.75rem;
  max-width: var(--measure);
}

.project__section h2 {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.85rem;
}

.project__section h3 {
  font-size: 1rem;
  letter-spacing: -0.01em;
  margin: 1.75rem 0 0.55rem;
}

.project__section p {
  color: var(--fg-muted);
  margin: 0 0 1rem;
}

/* A plain list of facts.
   `.steps` numbers its items in a circle, which is right for a sequence and
   wrong for a set — a list of cookie names or of retention periods is a set,
   not a sequence. */
.fact-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0 0 1rem;
  color: var(--fg-muted);
}

.fact-list li {
  margin-bottom: 0.6rem;
}

.fact-list li:last-child {
  margin-bottom: 0;
}

.fact-list strong {
  color: var(--fg);
  font-weight: 600;
}

.fact-list code {
  font-size: 0.9em;
  color: var(--fg);
}

.project__section--caveat {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
}

.stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1.25rem 0;
  margin: 0 0 2rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat__value {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.stat__label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--fg-muted);
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 0.9rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.details {
  display: grid;
  gap: 1rem;
}

.detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  background: var(--bg-alt);
}

.detail h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.detail p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--fg-muted);
}

.caveats {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.caveats li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.6rem;
}

.caveats li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Feature tour list */

.features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
  max-width: var(--measure);
  color: var(--fg-muted);
  font-size: 0.95rem;
}

.features li {
  position: relative;
  padding-left: 1.5rem;
}

.features li strong {
  color: var(--fg);
  font-weight: 600;
}

.features li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}

.attribution {
  font-size: 0.85rem;
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  max-width: var(--measure);
}

/* Contact */

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.contact-list a {
  color: var(--accent);
  text-decoration: none;
}

.contact-list a:hover,
.contact-list a:focus-visible {
  text-decoration: underline;
}

/* Interest form (procurement API) */
.interest-form {
  display: grid;
  gap: 1rem;
  max-width: var(--measure);
  margin: 0 0 1.5rem;
}
.interest-form .field {
  display: grid;
  gap: 0.4rem;
}
.interest-form label {
  font-size: 0.9rem;
  color: var(--fg);
}
.interest-form input,
.interest-form textarea {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  width: 100%;
}
.interest-form button {
  justify-self: start;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* Contact lives in the footer, so it needs to read as part of it: the links
   sit above the copyright line, centred like everything else down here. */
.site-footer .contact-list {
  justify-content: center;
  gap: 1.25rem;
  margin: 0 0 0.75rem;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Tables (procurement deep-dive) */

.flags-table,
.api-table,
.tiers-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

.flags-table th,
.api-table th,
.tiers-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.flags-table td,
.api-table td,
.tiers-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
}

.flags-table tr:hover,
.api-table tr:hover,
.tiers-table tr:hover {
  background: var(--bg-alt);
}