@font-face {
  font-family: "tiktok";
  src: url("../assets/fonts/TikTokSans.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "tronica-mono";
  src: url("../assets/fonts/DepartureMono-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --label: 0, 0, 0;
  --label-d: 54, 54, 48;
  --background-deep: 251, 250, 244;
  --label-1: rgba(var(--label), 1);
  --label-2: rgba(var(--label-d), 0.6);
  --label-3: rgba(var(--label-d), 0.32);
  --label-4: rgba(var(--label-d), 0.18);
  --line: rgba(var(--label-d), 0.1);
  --background-1: rgb(var(--background-deep));
  --selection-bg: #c0fe04;
  --cubic-66: cubic-bezier(0.66, 0, 0.01, 1);
  --pad: clamp(16px, 2.9vw, 56px);
}

.dark {
  --label: 255, 255, 255;
  --label-d: 230, 232, 232;
  --background-deep: 15, 17, 17;
  --label-1: rgba(var(--label), 1);
  --label-2: rgba(var(--label-d), 0.6);
  --label-3: rgba(var(--label-d), 0.32);
  --label-4: rgba(var(--label-d), 0.16);
  --line: rgba(var(--label-d), 0.08);
  --background-1: rgb(var(--background-deep));
}

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

html,
body {
  height: 100%;
}

body {
  font-family: "tiktok", sans-serif;
  background: var(--background-1);
  color: var(--label-1);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--selection-bg);
  color: #000;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--background-1);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-line {
  width: min(180px, 40vw);
  height: 2px;
  background: var(--label-4);
  overflow: hidden;
  position: relative;
}

.loader-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--label-1);
  transform: translateX(-100%);
  animation: load 1.1s var(--cubic-66) infinite;
}

@keyframes load {
  to { transform: translateX(100%); }
}

.scroll-shell {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.scroll-shell::-webkit-scrollbar {
  display: none;
}

/* Fixed chrome */
.chrome {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  font-family: "tronica-mono", monospace;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.chrome-top,
.chrome-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 28px var(--pad);
  gap: 16px;
}

.chrome-bottom {
  align-items: center;
}

.chrome a,
.chrome button {
  pointer-events: auto;
}

.brand {
  position: relative;
  padding: 8px;
  font-family: "tiktok", sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  gap: clamp(12px, 2vw, 48px);
  align-items: center;
}

.nav-btn {
  position: relative;
  padding: 8px;
  font-size: 16px;
  letter-spacing: 0.02em;
  font-family: inherit;
  text-transform: uppercase;
}

.brand::before,
.nav-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px dotted transparent;
  pointer-events: none;
  transition: border-color 0.2s ease;
}

.brand:hover::before,
.nav-btn:hover::before,
.nav-btn:focus-visible::before {
  border-color: var(--label-1);
}

.theme-mark,
.sound-mark {
  font-variant-numeric: tabular-nums;
}

.status-left,
.status-mid,
.status-right {
  font-size: 14px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.globe {
  width: 22px;
  height: 22px;
  opacity: 0.85;
}

/* Case article */
.case {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(72px, 10vh, 120px) 24px 100px;
  color: var(--label-1);
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.case-header {
  padding-top: 10vh;
}

.case-header h1 {
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variation-settings: "wdth" 120;
}

.case-date {
  margin-top: 4px;
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.6;
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}

.case-rule {
  margin-top: 8px;
  border-bottom: 1px solid var(--line);
}

.case-years {
  padding-top: 12px;
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.6;
  color: var(--label-2);
}

.case-body {
  color: var(--label-2);
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.7;
}

.case-body > * + * {
  margin-top: 16px;
}

.case-body p + p {
  margin-top: 12px;
}

.case-body a {
  color: var(--label-1);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--label-3);
  transition: text-decoration-color 0.2s ease;
}

.case-body a:hover {
  text-decoration-color: var(--label-2);
}

.case-body code {
  font-family: "tronica-mono", monospace;
  font-size: 0.9em;
  color: var(--label-1);
  background: rgba(var(--label-d), 0.08);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

.case-lead {
  padding: 14px 16px;
  border-left: 3px solid var(--selection-bg);
  background: rgba(var(--label-d), 0.04);
  border-radius: 0 8px 8px 0;
  color: var(--label-1);
  font-size: 0.95em;
  line-height: 1.65;
}

.case-lead strong {
  color: var(--label-1);
}

.case-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(var(--label-d), 0.06);
}

.case-body h2 {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 700;
  color: var(--label-1);
  line-height: 1.3;
}

.case-body h3 {
  margin-top: 22px;
  font-size: clamp(16px, 1.5vw, 18px);
  font-weight: 700;
  color: var(--label-1);
}

.case-body h3 .st {
  display: inline-block;
  margin-right: 8px;
  min-width: 1.5em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--label-1);
  color: var(--background-1);
  font-size: 11px;
  font-weight: 700;
  font-family: "tronica-mono", monospace;
  vertical-align: 1px;
}

.case-body h3 .st-s { background: #7a8cb8; color: #fff; }
.case-body h3 .st-t { background: #d45a3a; color: #fff; }
.case-body h3 .st-a { background: #3cb878; color: #fff; }
.case-body h3 .st-r { background: #8b6bc9; color: #fff; }

.case-note {
  margin: 0 !important;
  font-size: 0.88em;
  color: var(--label-3);
}

.case-body ul,
.case-body ol {
  margin: 0;
  padding-left: 1.25em;
}

.case-body li {
  margin: 0 0 6px;
}

.case-body li strong {
  color: var(--label-1);
}

.case-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88em;
}

.case-body th,
.case-body td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.case-body th {
  background: rgba(var(--label-d), 0.05);
  color: var(--label-1);
  font-weight: 600;
}

.case-kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.case-kpi-item {
  padding: 14px 10px;
  border-radius: 10px;
  background: rgba(var(--label-d), 0.04);
  text-align: center;
}

.case-kpi-item strong {
  display: block;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.2;
  color: var(--label-1);
  font-weight: 700;
  font-family: "tronica-mono", monospace;
}

.case-kpi-item span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--label-3);
  line-height: 1.35;
}

.case-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.case-cell {
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(var(--label-d), 0.04);
}

.case-cell h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--label-1);
}

.case-cell p {
  margin: 0 !important;
  font-size: 0.9em;
  color: var(--label-3);
  line-height: 1.5;
}

.case-quote {
  padding: 16px 18px;
  border-radius: 10px;
  background: rgba(var(--label-d), 0.04);
  color: var(--label-1);
  font-size: 0.95em;
  line-height: 1.7;
}

.case-quote b {
  color: var(--selection-bg);
}

.case-quote br + b {
  display: inline;
}

@media (max-width: 640px) {
  .case-kpi,
  .case-grid2 {
    grid-template-columns: 1fr;
  }
}

.meta-footer {
  margin-top: 64px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(var(--label-d), 0.03);
}

@media (min-width: 1024px) {
  .meta-footer {
    padding: 24px;
  }
}

.meta-title {
  margin-bottom: 20px;
  font-weight: 600;
  font-size: 16px;
  color: var(--label-1);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

@media (min-width: 1024px) {
  .meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.meta-grid dt {
  font-weight: 600;
  font-size: 14px;
  color: var(--label-1);
  margin-bottom: 6px;
}

.meta-grid dd {
  font-family: "tronica-mono", monospace;
  font-size: 14px;
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}

.meta-rule {
  margin: 24px 0;
  border-top: 1px dashed var(--line);
}

.meta-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}

@media (min-width: 1024px) {
  .meta-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.meta-links-label {
  display: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--label-1);
}

@media (min-width: 1024px) {
  .meta-links-label {
    display: block;
  }
}

.meta-links-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-family: "tronica-mono", monospace;
}

.meta-links-col a {
  position: relative;
  display: inline-block;
  margin: 0 -4px;
  padding: 2px 4px;
  font-size: 14px;
  color: var(--label-2);
  transition: color 0.2s ease;
}

.meta-links-col a::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px dotted transparent;
  pointer-events: none;
  transition: border-color 0.2s ease;
}

.meta-links-col a:hover {
  color: var(--label-1);
}

.meta-links-col a:hover::before {
  border-color: var(--label-1);
}

@media (max-width: 640px) {
  .chrome-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    gap: 4px;
    flex-wrap: wrap;
  }

  .nav-btn {
    font-size: 12px;
    padding: 6px;
  }

  .status-mid {
    display: none;
  }

  .case-header {
    padding-top: 6vh;
  }
}
