:root {
  color-scheme: light;

  /* IBM Model M inspired palette */
  --case: #cfcdc0;
  --case-shadow: #a29c8c;

  /* Fallbacks (overridden below when color-mix is supported). */
  --text: #0b0b0b;
  --focus-outline: var(--text);
  --bg: #cfcdc0;

  --pill-base: #cfcdc0;
  --pill-border: #a29c8c;
  --pill-grad-top: #dad8cc;
  --pill-grad-bottom: #c9c6b8;
  --pill-shadow-inset: rgba(255, 255, 255, 0.70);
  --pill-shadow-drop: rgba(0, 0, 0, 0.18);

  --case-border: #a29c8c;
  --case-shadow-drop: rgba(0, 0, 0, 0.22);
}

@supports (color: color-mix(in srgb, black, white)) {
  :root {
    --text: color-mix(in srgb, black 92%, var(--case));
    --focus-outline: var(--text);

    --pill-base: color-mix(in srgb, var(--case) 92%, white);
    --pill-border: color-mix(in srgb, var(--case-shadow) 78%, black);
    --pill-grad-top: color-mix(in srgb, var(--pill-base) 92%, white);
    --pill-grad-bottom: color-mix(in srgb, var(--pill-base) 86%, var(--case-shadow));
    --pill-shadow-inset: rgba(255, 255, 255, 0.78);
    --pill-shadow-drop: rgba(0, 0, 0, 0.20);

    --case-border: color-mix(in srgb, var(--case-shadow) 82%, black);
    --case-shadow-drop: rgba(0, 0, 0, 0.26);
    --bg: radial-gradient(
        1400px 900px at 30% -10%,
        color-mix(in srgb, var(--case) 88%, white),
        var(--case)
      );
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  min-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.25rem 3.5rem;
  gap: 3.25rem;
  margin: 1.5rem auto;
}

@supports not (color: color-mix(in srgb, black, white)) {
  .page {
    background: linear-gradient(180deg, #dad8cc, #c9c6b8);
  }
}

.hero {
  display: flex;
  flex-direction: column;
  align-content: center;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: min(70ch, calc(100vw - 2.5rem));
  min-height: clamp(50vh, 60vh, 70vh);
  gap: 1rem;
}

.work {
  width: min(1100px, calc(100vw - 2.5rem));
  display: grid;
  gap: 2.25rem;
  padding: 0.25rem 0;
}

.work-loader {
  display: grid;
  place-items: center;
  padding: 1.25rem 0;
}

.section-title{
  font-weight: 600;
  margin-bottom: .5rem;
  text-align: center;
  color: #858073;
}

.work-card {
  display: grid;
  gap: 1.1rem;
  margin: 0;
  padding: 1.25rem;
  border-radius: 1.1rem;
  border: 3px solid var(--case-border);
  background-color: var(--pill-base);
  background-image: linear-gradient(var(--pill-grad-top), var(--pill-grad-bottom));
  background-repeat: no-repeat;
  background-position: top;
  background-size: 100% calc(100% - 6px);
  box-shadow:
    0 1px 0 var(--pill-shadow-inset) inset,
    0 -2px 0 rgba(0, 0, 0, 0.18) inset,
    0 18px 40px var(--case-shadow-drop);
  position: relative;
}

.work-card::before,
.work-card::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--case-border);
  background: var(--case-shadow);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 2px 6px rgba(0, 0, 0, 0.18);
  opacity: 0.75;
}

@supports (color: color-mix(in srgb, black, white)) {
  .work-card::before,
  .work-card::after {
    border-color: color-mix(in srgb, var(--case-border) 70%, black);
    background: color-mix(in srgb, var(--pill-base) 75%, var(--case-shadow));
  }
}

.work-card::before {
  top: 12px;
  right: 12px;
}

.work-card::after {
  bottom: 12px;
  left: 12px;
}

.work-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1rem;
}



.work-title {
  display: flex;
  gap: 0.55rem;
  align-items: baseline;
}

.work-name {
  margin: 0;
  font-size: 3.05rem;
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.work-meta {
  display: grid;
  gap: 0.9rem;
  justify-items: end;
  text-align: right;
}

.work-desc {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.work-cta {
  position: absolute;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 2;

  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
  margin-bottom: 0.5%;  
  font-weight: 650;
  text-decoration: none;
  color: inherit;

  display: inline-block;
  padding: 0.35rem 0.8rem;
  border-radius: 0.4rem;
  border: 2px solid var(--pill-border);
  background-color: var(--pill-base);
  background-image: linear-gradient(var(--pill-grad-top), var(--pill-grad-bottom));
  background-repeat: no-repeat;
  background-position: top;
  background-size: 100% calc(100% - 4px);
  box-shadow:
    0 1px 0 var(--pill-shadow-inset) inset,
    0 -2px 0 rgba(0, 0, 0, 0.18) inset,
    0 2px 6px var(--pill-shadow-drop);
}

.work-cta:hover {
  text-decoration: none;
}

.work-cta:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 3px;
  border-radius: 0.4rem;
}

@supports (color: color-mix(in srgb, black, white)) {
  .work-cta {
    color: color-mix(in srgb, var(--text) 84%, var(--case-shadow));
  }
}

@supports (color: color-mix(in srgb, black, white)) {
  .work-desc {
    color: color-mix(in srgb, var(--text) 82%, var(--case-shadow));
  }
}

.work-tags {
  margin-left: 0;
  justify-content: flex-end;
}

.work-preview {
  width: 100%;
  height: min(520px, 62vh);
  border-radius: 0.95rem;
  border: 3px solid var(--case-border);
  /* solid fallback color; actual images are applied via inline background-image */
  background-color: color-mix(in srgb, var(--text) 82%, var(--case));
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 300ms ease-in-out;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.08) inset,
    0 -3px 0 rgba(0, 0, 0, 0.36) inset,
    0 12px 28px rgba(0, 0, 0, 0.20);
  position: relative;
  overflow: hidden;
}

.work-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 25% 10%, rgba(255, 255, 255, 0.10), transparent 60%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 55%);
  pointer-events: none;
}

.work-preview:focus {
  outline: 3px solid rgba(100,150,255,0.6);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .work-preview {
    transition: none;
  }
}

@supports not (color: color-mix(in srgb, black, white)) {
  .work-preview {
    background-color: #2b2b2b;
    background-image: none;
  }
}

@media (max-width: 780px) {
  .page {
    gap: 1.5rem;
  }

  .hero{
    margin-top: clamp(2rem, 5vh, 3rem);
    min-height: 0;
  }

  .work-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .work-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.55rem;
    text-align: left;
  }

  .work-desc {
    flex: 0 0 100%;
  }

  .work-tags {
    flex: 0 1 auto;
    max-width: 100%;
    margin-left: 0;
  }

  .work-cta {
    position: static;
    left: auto;
    bottom: auto;
    z-index: auto;
    margin-bottom: 0;
  }

  .work-tags {
    justify-content: flex-start;
  }

  .work-name {
    font-size: 2.6rem;
  }
}

@media (min-width: 860px) {
  .work-card {
    grid-template-columns: 0.95fr 1.15fr;
    align-items: stretch;
    gap: 1.5rem;
  }

  .work-top {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    border-bottom: 0;
    padding-bottom: 0;
  }

  .work-meta {
    justify-items: start;
    text-align: left;
  }

  .work-tags {
    justify-content: flex-start;
  }

  .work-preview {
    height: auto;
    min-height: 360px;
  }
}

.hero-line {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.hero-line--spaced {
  margin-top: 2.25rem;
}

.hero-br {
  display: inline;
}

@media (max-width: 640px) {
  .hero-line {
    line-height: 1.35;
  }

  .hero-br {
    display: none;
  }
}

.pill {
  text-decoration: none;
  color: inherit;
  display: inline-block;
  padding: 0.26em 0.7em;
  border-radius: 0.4rem;
  border: 2px solid var(--pill-border);
  background-color: var(--pill-base);
  background-image: linear-gradient(var(--pill-grad-top), var(--pill-grad-bottom));
  background-repeat: no-repeat;
  background-position: top;
  background-size: 100% calc(100% - 4px);
  box-shadow:
    0 1px 0 var(--pill-shadow-inset) inset,
    0 -2px 0 rgba(0, 0, 0, 0.18) inset,
    0 2px 0 rgba(255, 255, 255, 0.18) inset,
    0 2px 6px var(--pill-shadow-drop);
  vertical-align: baseline;
  white-space: nowrap;
}

.pill--button:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.20) inset,
    0 -2px 0 rgba(0, 0, 0, 0.30) inset,
    0 1px 2px rgba(0, 0, 0, 0.18);
}

.pill-row {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-left: 0.4rem;
}

.pill--button {
  font: inherit;
  cursor: pointer;
}

.pill--button:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 3px;
}

.corner-pill {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  text-decoration: none;
  color: inherit;

  font-size: 0.95rem;

  display: inline-block;
  padding: 0.25rem 0.8rem;
  border-radius: 0.4rem;
  border: 2px solid var(--pill-border);
  background-color: var(--pill-base);
  background-image: linear-gradient(var(--pill-grad-top), var(--pill-grad-bottom));
  background-repeat: no-repeat;
  background-position: top;
  background-size: 100% calc(100% - 4px);
  box-shadow:
    0 1px 0 var(--pill-shadow-inset) inset,
    0 -2px 0 rgba(0, 0, 0, 0.18) inset,
    0 2px 6px var(--pill-shadow-drop);
}

.corner-pill:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 3px;
}

.menu-area {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 2rem;
  display: grid;
  place-items: center;
  gap: 0.75rem;
}

.menu {
  width: min(520px, calc(100vw - 2.5rem));
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.75rem);
  transform: translateX(-50%);
  z-index: 20;

  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  will-change: opacity;
}

.menu.menu--open {
  opacity: 1;
  pointer-events: auto;
}

.menu-overlay {
  display: grid;
  place-items: center;
  gap: 1.25rem;
  padding: 0;
  background: transparent;
}

.menu-panel {
  width: min(360px, calc(100vw - 3rem));
  border-radius: 0.95rem;
  border: 3px solid var(--case-border);
  background-color: var(--case);
  background-image: linear-gradient(
    color-mix(in srgb, var(--case) 82%, white),
    color-mix(in srgb, var(--case) 88%, var(--case-shadow))
  );
  background-repeat: no-repeat;
  background-position: top;
  background-size: 100% calc(100% - 4px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 -2px 0 rgba(0, 0, 0, 0.22) inset,
    0 18px 40px var(--case-shadow-drop);
  padding: 1.1rem;
  display: grid;
  gap: 0.95rem;
  text-align: left;
  position: relative;
}

.menu-panel::before,
.menu-panel::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--case-border);
  background: var(--case-shadow);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 2px 6px rgba(0, 0, 0, 0.18);
  opacity: 0.7;
}

.menu-panel::before {
  top: 10px;
  right: 10px;
}

.menu-panel::after {
  bottom: 10px;
  left: 10px;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.menu-title {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 0.9rem;
  opacity: 0.9;
}

.menu-keys {
  display: grid;
  gap: 0.65rem;
}

.menu-langs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.menu-sep {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.22),
      rgba(255, 255, 255, 0.18)
    );
  opacity: 0.55;
}

.menu-key {
  text-decoration: none;
  color: inherit;
  font: inherit;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.6rem 0.9rem;
  border-radius: 0.55rem;
  border: 3px solid var(--pill-border);
  background-color: var(--pill-base);
  background-image: linear-gradient(var(--pill-grad-top), var(--pill-grad-bottom));
  background-repeat: no-repeat;
  background-position: top;
  background-size: 100% calc(100% - 5px);
  box-shadow:
    0 1px 0 var(--pill-shadow-inset) inset,
    0 -3px 0 rgba(0, 0, 0, 0.22) inset,
    0 6px 14px var(--pill-shadow-drop);

  font-weight: 600;
  letter-spacing: 0.06em;
}

.menu-key:hover {
  filter: brightness(1.02);
}

.menu-key:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.20) inset,
    0 -3px 0 rgba(0, 0, 0, 0.30) inset,
    0 3px 8px rgba(0, 0, 0, 0.18);
}

.menu-key:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 4px;
}

.menu-key[aria-pressed="true"] {
  filter: brightness(0.98);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 -3px 0 rgba(0, 0, 0, 0.30) inset,
    0 0 0 2px color-mix(in srgb, var(--case-border) 70%, transparent);
}

.menu-close {
  width: auto;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.menu-item {
  font-size: 1.05rem;
}

@supports not (color: color-mix(in srgb, black, white)) {
  .menu-panel {
    background-image: linear-gradient(180deg, #dad8cc, #c9c6b8);
  }
}

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

/* Case-study / project detail pages */
.case-page {
  gap: 2.25rem;
  padding-bottom: 7.5rem;
}

.work-card.work-card--detail {
  grid-template-columns: 1fr;
}

@media (min-width: 860px) {
  .work-card.work-card--detail {
    grid-template-columns: 1fr;
  }
}

.case-article {
  width: min(1100px, calc(100vw - 2.5rem));
  margin: 0;
}

.case-header {
  display: grid;
  gap: 0.85rem;
  padding-bottom: 1.1rem;
  border-bottom: 3px solid var(--case-border);
}

.case-title {
  margin: 0;
  font-size: clamp(1.55rem, 1.05rem + 2.05vw, 2.45rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
  font-weight: 900;
  text-wrap: balance;
}

.case-lede {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.55;
  max-width: 78ch;
}

@supports (color: color-mix(in srgb, black, white)) {
  .case-lede {
    color: color-mix(in srgb, var(--text) 86%, var(--case-shadow));
  }
}

.case-section {
  display: grid;
  gap: 0.75rem;
  padding-top: 1.15rem;
  position: relative;
}

.case-section::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.22),
      rgba(255, 255, 255, 0.18)
    );
  opacity: 0.35;
}

.case-body {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
}

@media (min-width: 900px) {
  .case-section {
    grid-template-columns: minmax(14ch, 20ch) minmax(0, 1fr);
    column-gap: 1.6rem;
    align-items: start;
  }

  .case-section::before {
    left: 0;
    right: 0;
  }

  .case-h2 {
    margin-top: 0.1rem;
    position: sticky;
    top: 1.25rem;
    align-self: start;
  }
}

.case-h2 {
  margin: 0.2rem 0 0;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}

.case-h3 {
  margin: 0.55rem 0 0;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
  font-weight: 800;
}

.case-article p {
  margin: 0;
  line-height: 1.55;
  max-width: 82ch;
}

.case-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.65rem;
  max-width: 84ch;
}

.case-table {
  overflow-x: auto;
  border-radius: 0.8rem;
  border: 3px solid var(--case-border);
  background: var(--pill-base);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 -2px 0 rgba(0, 0, 0, 0.16) inset;
}

.case-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  table-layout: fixed;
}

.case-col--layer {
  width: 28%;
}

.case-col--tech {
  width: 26%;
}

.case-col--strategy {
  width: 46%;
}

.case-table th,
.case-table td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid var(--pill-border);
  vertical-align: top;
  font-size: 0.98rem;
  line-height: 1.35;
  word-break: break-word;
}

.case-table thead th {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.case-table tbody th {
  font-weight: 650;
}

.case-callout {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  border: 3px solid var(--pill-border);
  background-color: var(--pill-base);
  background-image: linear-gradient(var(--pill-grad-top), var(--pill-grad-bottom));
  box-shadow:
    0 1px 0 var(--pill-shadow-inset) inset,
    0 -2px 0 rgba(0, 0, 0, 0.18) inset,
    0 8px 18px rgba(0, 0, 0, 0.10);
  max-width: 86ch;
}

.case-quote {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-left: 6px solid var(--case-border);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
  max-width: 88ch;
}

.case-code {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  border: 3px solid var(--case-border);
  background: var(--pill-base);
  overflow-x: auto;
  max-width: 100%;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 -2px 0 rgba(0, 0, 0, 0.14) inset;
}

.case-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

.case-article :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 0.35rem;
  border: 2px solid var(--pill-border);
  background: var(--pill-base);
}

.case-ref {
  font-size: 0.95rem;
  opacity: 0.85;
}

.case-ref a {
  color: inherit;
}

.case-ref a:focus-visible {
  outline: 3px solid var(--focus-outline);
  outline-offset: 3px;
  border-radius: 0.35rem;
}

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

  .menu {
    transition: none;
  }
}
