/* ==========================================================================
   Cedric Chang portfolio
   Base is black and white. Each page sets --accent on <body>.
   ========================================================================== */

:root {
  --ink: #0d0d0d;
  --ink-soft: #4a4a4a;
  --ink-faint: #8a8a8a;
  --rule: #e0e0e0;
  --paper: #fbfbfa;
  --paper-2: #f2f2f0;

  --accent: #0d0d0d;
  --accent-ink: #ffffff;

  --display: "Space Grotesk", "Helvetica Neue", sans-serif;
  --body: "Inter Tight", "Helvetica Neue", sans-serif;
  --util: "JetBrains Mono", ui-monospace, monospace;

  --gutter: clamp(1.25rem, 5vw, 5rem);
  --stack: clamp(3.5rem, 8vw, 7rem);
}

body.theme-games {
  --accent: #14803c;
  --accent-ink: #ffffff;
}

body.theme-teaching {
  --accent: #b02a1f;
  --accent-ink: #ffffff;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

/* --------------------------------------------------------------- type ---- */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0;
}

h1 {
  font-size: clamp(2.75rem, 8vw, 6rem);
}

h2 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
}

h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 1.1em;
  max-width: 62ch;
}

.eyebrow {
  font-family: var(--util);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 2px;
  background: var(--accent);
  flex: none;
}

.lede {
  font-size: clamp(1.125rem, 1.7vw, 1.375rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 46ch;
}

/* ------------------------------------------------------------ skip link -- */

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

.skip:focus {
  left: 0;
}

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

/* ---------------------------------------------------------------- nav ---- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  z-index: 40;
}

.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark span {
  color: var(--accent);
}

.masthead nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--util);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.masthead nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.masthead nav a:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.masthead nav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--accent);
}

/* ------------------------------------------------------------- layout ---- */

.wrap {
  padding: var(--stack) var(--gutter);
  max-width: 78rem;
  margin: 0 auto;
}

.wrap--tight {
  max-width: 52rem;
}

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0;
}

/* ========================================================== landing page == */
/* Signature: two full-bleed doors. Monochrome at rest, the panel floods with
   its own accent on hover or focus. The structure is the design.           */

.hero {
  padding: clamp(4rem, 12vw, 9rem) var(--gutter) clamp(3rem, 7vw, 5rem);
  max-width: 78rem;
  margin: 0 auto;
}

.hero h1 {
  max-width: 14ch;
}

.hero h1 em {
  font-style: normal;
  display: block;
  color: var(--ink-faint);
}

.hero .lede {
  margin-top: 1.75rem;
}

.doors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--rule);
  max-width: 78rem;
  margin: 0 auto;
}

.door {
  --door: #0d0d0d;
  position: relative;
  display: block;
  text-decoration: none;
  padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1.5rem, 3.5vw, 3rem) clamp(3rem, 6vw, 5rem);
  min-height: clamp(20rem, 40vh, 30rem);
  background: var(--paper);
  border-right: 1px solid var(--rule);
  overflow: hidden;
  isolation: isolate;
  transition: color 0.35s ease;
}

.door:last-child {
  border-right: 0;
}

.door--games {
  --door: #14803c;
}

.door--teaching {
  --door: #b02a1f;
}

.door::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--door);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: -1;
}

.door:hover,
.door:focus-visible {
  color: #fff;
}

.door:hover::before,
.door:focus-visible::before {
  transform: translateY(0);
}

.door:hover .door__index,
.door:focus-visible .door__index,
.door:hover .door__list,
.door:focus-visible .door__list {
  color: rgba(255, 255, 255, 0.72);
}

.door:hover .door__go,
.door:focus-visible .door__go {
  border-color: rgba(255, 255, 255, 0.5);
}

.door__index {
  display: block;
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.35s;
}

.door__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.75vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1.03;
  margin: 1.5rem 0 1.25rem;
  white-space: nowrap;
  color: var(--door);
  transition: color 0.35s;
}

.door:hover .door__title,
.door:focus-visible .door__title {
  color: #fff;
}

@media (max-width: 46rem) {
  .door__title {
    white-space: normal;
  }
}

.door__list {
  font-family: var(--util);
  font-size: 0.75rem;
  line-height: 2;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  list-style: none;
  padding: 0;
  margin: 0;
  transition: color 0.35s;
}

.door__go {
  position: absolute;
  left: clamp(1.5rem, 3.5vw, 3rem);
  bottom: clamp(1.5rem, 3vw, 2.5rem);
  font-family: var(--util);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.35s;
}

/* ------------------------------------------------------------- ticker ---- */

.strip {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  font-family: var(--util);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  max-width: 78rem;
  margin: 0 auto;
}

/* ============================================================ work items == */

.work {
  border-top: 1px solid var(--rule);
  padding-top: clamp(2rem, 4vw, 3.5rem);
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.work:first-of-type {
  margin-top: 0;
}

.work__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  margin-bottom: 2.25rem;
}

.work__meta {
  font-family: var(--util);
  font-size: 0.75rem;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
}

.work__meta b {
  color: var(--ink);
  font-weight: 500;
}

.tag {
  display: inline-block;
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  margin-bottom: 1rem;
}

.tag--quiet {
  border-color: var(--rule);
  color: var(--ink-faint);
}

/* ------------------------------------------------------------- embeds ---- */

.embed {
  border: 1px solid var(--rule);
  background: var(--paper-2);
  margin-bottom: 1.75rem;
}

.embed__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.embed__bar a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.embed__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.embed__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* itch player is usually 4:3-ish. Override per project if you need to. */
.embed__frame--itch {
  aspect-ratio: 4 / 3;
}

/* ------------------------------------------------------------ carousel --- */

.shots {
  position: relative;
}

.shots__track {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
}

.shots__track figure {
  margin: 0;
  flex: 0 0 min(34rem, 82%);
  scroll-snap-align: start;
}

.shots__track img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}

.shots__track figcaption {
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding-top: 0.6rem;
}

.shots__nav {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.shots__nav button {
  font-family: var(--util);
  font-size: 0.875rem;
  line-height: 1;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.shots__nav button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.shots__nav button:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ============================================================== columns == */

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: clamp(1.5rem, 3vw, 2.75rem);
}

.card {
  border-top: 2px solid var(--accent);
  padding-top: 1.25rem;
}

.card h3 {
  margin-bottom: 0.6rem;
}

.card p {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  margin-bottom: 0;
}

/* -------------------------------------------------------------- phases --- */
/* Numbered only because this really is an ordered process. */

.phases {
  counter-reset: phase;
  display: grid;
  gap: 0;
}

.phase {
  counter-increment: phase;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
  align-items: start;
}

.phase:last-child {
  border-bottom: 1px solid var(--rule);
}

.phase::before {
  content: counter(phase, decimal-leading-zero);
  font-family: var(--util);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding-top: 0.4rem;
}

.phase h3 {
  margin-bottom: 0.4rem;
}

.phase p {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* ---------------------------------------------------------- data table --- */

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.matrix th,
.matrix td {
  text-align: left;
  padding: 1rem 1.25rem 1rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.matrix th {
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  border-bottom-color: var(--ink);
}

.matrix td:first-child {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  padding-right: 2rem;
}

.matrix td em {
  font-style: normal;
  color: var(--ink-faint);
  font-family: var(--util);
  font-size: 0.75rem;
}

/* --------------------------------------------------------------- lists --- */

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

.chips li {
  font-family: var(--util);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.note {
  font-size: 0.875rem;
  color: var(--ink-faint);
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
  max-width: 52ch;
}

/* ================================================================= form == */

.form {
  display: grid;
  gap: 1.5rem;
  max-width: 40rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label,
.fieldset legend {
  font-family: var(--util);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0.75rem 0.85rem;
  width: 100%;
  transition: border-color 0.15s;
}

.field textarea {
  min-height: 7rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field .hint {
  font-size: 0.8125rem;
  color: var(--ink-faint);
}

.fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.choice {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.choice label {
  flex: 1 1 12rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--rule);
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-family: var(--body);
  font-size: 0.9375rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}

.choice label:hover {
  border-color: var(--accent);
}

.choice input {
  accent-color: var(--accent);
  width: auto;
  margin: 0;
}

.choice input:checked + span {
  font-weight: 600;
}

.btn {
  font-family: var(--util);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  padding: 1rem 2rem;
  cursor: pointer;
  justify-self: start;
  transition: background 0.15s, color 0.15s;
}

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

.form__status {
  font-family: var(--util);
  font-size: 0.8125rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
}

.form__status[data-state="ok"] {
  border-color: var(--accent);
  color: var(--accent);
}

.form__status[data-state="err"] {
  border-color: #b02a1f;
  color: #b02a1f;
}

.form__status[hidden] {
  display: none;
}

/* =============================================================== footer == */

.footer {
  border-top: 1px solid var(--rule);
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter);
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  align-items: end;
  font-family: var(--util);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.15s;
}

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

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

/* ============================================================ responsive == */

@media (max-width: 46rem) {
  .doors {
    grid-template-columns: 1fr;
  }

  .door {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    min-height: 0;
    padding-bottom: 4.5rem;
  }

  .work__head {
    grid-template-columns: 1fr;
  }

  .phase {
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }

  .matrix td:first-child {
    white-space: normal;
  }

  .masthead {
    position: static;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .shots__track {
    scroll-behavior: auto;
  }
}
