:root {
  color-scheme: light;
  --paper: #eee8dc;
  --paper-strong: #fbf7ee;
  --ink: #171614;
  --muted: #686158;
  --line: #cfc5b5;
  --line-dark: #998d7d;
  --stamp: #8d2520;
  --stamp-soft: #ead6cf;
  --grey: #e7e2da;
  --shadow: 0 20px 48px rgba(37, 31, 24, 0.16);
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: Courier, ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: #d8d2c8;
  color: var(--ink);
  font-family: var(--sans);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.64), transparent 34%),
    linear-gradient(rgba(255, 255, 255, 0.24) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 27px;
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 12px;
  border-bottom: 5px double var(--ink);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.wordmark__crest {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: grayscale(1) contrast(1.05);
}

.wordmark > span:last-child,
.hero__copy,
.case-header > *,
.metadata-panel,
.artifact-shell {
  min-width: 0;
}

.wordmark strong,
h1,
h2,
h3 {
  letter-spacing: 0;
}

.wordmark strong {
  display: block;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.header-docket {
  display: grid;
  gap: 3px;
  min-width: 180px;
  color: var(--ink);
  font: 0.68rem/1.35 var(--mono);
  text-align: right;
  text-transform: uppercase;
}

.wordmark small,
.eyebrow,
.case-card__meta,
.local-note {
  color: var(--muted);
  font: 0.76rem/1.4 var(--mono);
}

.wordmark small {
  display: block;
  overflow-wrap: anywhere;
}

.top-nav a,
.button,
.text-link {
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
}

.hero,
.case-list,
.case-file {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 40px;
  align-items: stretch;
  padding: clamp(48px, 8vw, 88px) 0 34px;
}

.hero h1,
.case-header h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.35rem, 8vw, 5.8rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

.hero p:not(.eyebrow),
.case-note {
  max-width: 720px;
  color: #332f29;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-strong);
  text-decoration: none;
}

.hero-link {
  display: inline-flex;
  margin-left: 14px;
}

.paper-card {
  border: 1px solid var(--line-dark);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.18)),
    var(--paper-strong);
  background-size: 9px 100%, auto, auto;
  box-shadow: var(--shadow);
}

.hero__docket,
.metadata-panel {
  padding: 22px;
}

.hero__docket {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-height: 300px;
}

.hero__docket::before,
.metadata-panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(153, 141, 125, 0.38);
  pointer-events: none;
}

.metadata-panel {
  position: relative;
  overflow: hidden;
}

.stamp {
  display: inline-block;
  margin-bottom: 16px;
  padding: 6px 10px 5px;
  border: 2px solid var(--stamp);
  color: var(--stamp);
  font: 700 0.78rem/1 var(--mono);
  text-transform: uppercase;
  transform: rotate(-1.5deg);
}

.stamp-image {
  display: block;
  width: min(230px, 78%);
  height: auto;
  margin: 0 0 18px auto;
  transform: rotate(-4deg);
  mix-blend-mode: multiply;
  opacity: 0.92;
}

dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

dt {
  color: var(--muted);
  font: 0.68rem/1.35 var(--mono);
  text-transform: uppercase;
}

dd {
  margin: 2px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.case-list {
  padding: 22px 0 64px;
}

.section-heading {
  border-top: 2px solid var(--ink);
  padding-top: 18px;
}

.section-heading h2,
.artifact-toolbar h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  text-transform: uppercase;
}

.case-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.case-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
}

.case-card h3 {
  margin: 4px 0 8px;
  font-size: 1.4rem;
}

.case-card p {
  max-width: 720px;
  margin: 0;
  line-height: 1.55;
}

.about-page {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto 0;
}

.about-page {
  padding: clamp(22px, 4vw, 38px);
}

.about-page h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.96;
  text-transform: uppercase;
}

.about-copy {
  max-width: 780px;
  margin-top: 24px;
}

.about-copy p {
  margin: 0 0 1rem;
  color: #332f29;
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  line-height: 1.6;
}

.text-link {
  white-space: nowrap;
}

.case-file {
  padding: clamp(32px, 6vw, 60px) 0 72px;
}

.case-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  gap: 28px;
  align-items: start;
  padding: clamp(18px, 3vw, 30px);
}

.case-memo {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.36);
  padding: clamp(16px, 3vw, 24px);
  overflow: hidden;
}

.memo-lines {
  gap: 6px;
  margin: 10px 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.memo-lines div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
}

.memo-lines dt::after {
  content: ":";
}

.memo-lines dd {
  font: 0.82rem/1.35 var(--mono);
  overflow-wrap: anywhere;
}

.metadata-panel dd {
  font-size: 0.94rem;
}

.case-header--calm .case-note {
  max-width: 660px;
}

.artifact-shell {
  margin-top: 28px;
  padding: clamp(18px, 3vw, 28px);
}

.artifact-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.access-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line-dark);
  background:
    linear-gradient(90deg, rgba(141, 37, 32, 0.08), transparent 42%),
    linear-gradient(rgba(255, 255, 255, 0.32), rgba(231, 226, 218, 0.42)),
    rgba(231, 226, 218, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 240, 0.72),
    0 10px 24px rgba(37, 31, 24, 0.08);
  overflow: hidden;
}

.access-panel::before {
  content: "RESTRICTED";
  position: absolute;
  top: 50%;
  right: 22px;
  color: rgba(141, 37, 32, 0.14);
  font: 700 clamp(1rem, 3vw, 2rem)/1 var(--mono);
  letter-spacing: 0;
  transform: translateY(-50%) rotate(-1deg);
  pointer-events: none;
}

.access-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0 42%, rgba(255, 255, 255, 0.5) 50%, transparent 58% 100%);
  opacity: 0;
  transform: translateX(-42%);
  transition: opacity 180ms ease, transform 420ms ease;
  pointer-events: none;
}

.access-panel:hover::after,
.access-panel:focus-within::after {
  opacity: 0.42;
  transform: translateX(42%);
}

.access-panel > div {
  min-width: 0;
}

.access-panel.is-approved {
  border-style: solid;
  border-color: rgba(141, 37, 32, 0.55);
  background:
    linear-gradient(90deg, rgba(141, 37, 32, 0.08), transparent 40%),
    rgba(255, 250, 240, 0.78);
}

.access-panel.is-approved::before {
  content: "OPENED";
  color: rgba(141, 37, 32, 0.2);
}

.access-panel--calm::before {
  content: "LOGGED";
}

.access-question {
  position: relative;
  margin: 2px 0 0;
  max-width: 46ch;
  font: 700 0.95rem/1.45 var(--mono);
  overflow-wrap: anywhere;
}

.access-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  z-index: 1;
}

.access-actions button {
  min-height: 44px;
  border: 1px solid var(--ink);
  padding: 0 16px;
  background: var(--ink);
  color: var(--paper-strong);
  cursor: pointer;
  font: 700 0.8rem/1 var(--mono);
  text-transform: uppercase;
  box-shadow: 4px 4px 0 rgba(141, 37, 32, 0.24);
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.access-actions button::before {
  content: ">";
  margin-right: 8px;
  color: var(--stamp-soft);
}

.access-actions button:hover:not(:disabled),
.access-actions button:focus-visible {
  background: var(--stamp);
  color: #fffaf0;
  box-shadow: 2px 2px 0 rgba(23, 22, 20, 0.36);
  transform: translate(2px, 2px);
}

.access-actions button:disabled {
  border-color: var(--line-dark);
  color: var(--muted);
  cursor: default;
  transform: none;
  box-shadow: none;
}

.stamp-image--small {
  width: min(190px, 72%);
}

.artifact-frame {
  margin-top: 24px;
  padding: clamp(18px, 4vw, 34px);
  border-left: 4px solid var(--stamp);
  background:
    linear-gradient(rgba(255, 255, 255, 0.2), transparent),
    var(--paper-strong);
  box-shadow: inset 0 0 0 1px rgba(153, 141, 125, 0.22);
}

.artifact-frame.is-redacted {
  border-left-color: #5f5a52;
}

.artifact-frame.is-redacted .artifact-entry p {
  color: #25221d;
}

.artifact-frame.is-redacted .artifact-entry p::selection,
.artifact-frame.is-redacted .artifact-title::selection {
  background: var(--stamp-soft);
}

.artifact-title {
  margin: 0 0 24px;
  font: 700 1.18rem/1.3 var(--mono);
}

.artifact-entry {
  margin: 0 0 1.35rem;
}

.artifact-entry h3 {
  margin: 0 0 0.32rem;
  color: #6f201c;
  font: 700 1rem/1.4 var(--mono);
}

.artifact-entry p,
.artifact-title,
.loading {
  font-family: var(--mono);
}

.artifact-entry p {
  margin: 0;
  max-width: 92ch;
  font-size: clamp(0.9rem, 1.7vw, 1rem);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.local-note {
  margin: 16px 0 0;
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
  }

  .site-header,
  .hero,
  .case-list,
  .case-file,
  .about-page {
    width: calc(100% - 32px);
    max-width: calc(100% - 32px);
    overflow: hidden;
  }

  .site-header,
  .hero,
  .case-card,
  .artifact-toolbar,
  .access-panel {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
  }

  .site-header {
    gap: 14px;
    padding-top: 16px;
  }

  .access-panel {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .access-panel::before {
    top: 16px;
    right: 14px;
    transform: rotate(-1deg);
  }

  .access-actions button {
    width: 100%;
    min-height: 42px;
    text-align: left;
  }

  .header-docket {
    text-align: left;
  }

  .top-nav {
    align-self: stretch;
    justify-content: flex-start;
  }

  .hero,
  .case-header {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 30px;
  }

  .hero h1,
  .case-header h1 {
    max-width: 100%;
    font-size: clamp(1.32rem, 6.4vw, 1.75rem);
    line-height: 1;
    word-break: break-word;
  }

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

  .case-header--calm .case-note,
  .case-note,
  .hero p:not(.eyebrow) {
    width: 100%;
    max-width: 28ch;
    font-size: 1rem;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .wordmark {
    width: 100%;
  }

  .wordmark__crest {
    width: 50px;
    height: 50px;
  }

  .wordmark > span:last-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .wordmark strong {
    max-width: 24ch;
    font-size: 0.86rem;
    line-height: 1.15;
    overflow-wrap: normal;
  }

  .wordmark small {
    font-size: 0.68rem;
  }

  .case-card {
    gap: 16px;
    padding: 20px;
  }

  .hero-link {
    margin: 12px 0 0;
  }

  .button,
  .hero-link {
    max-width: 100%;
  }

  .access-actions {
    justify-content: flex-start;
  }

  .case-header {
    padding: 14px;
    overflow: hidden;
  }

  .case-memo {
    padding: 16px;
    max-width: 100%;
  }

  .case-memo .eyebrow {
    font-size: 0.66rem;
  }

  .memo-lines div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .memo-lines dd {
    max-width: 31ch;
    font-size: 0.78rem;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .stamp-image {
    width: min(190px, 74%);
    margin-left: 0;
  }

  .text-link {
    white-space: normal;
  }

  .artifact-shell {
    padding: 16px;
  }

  .artifact-frame {
    padding: 18px;
  }

  .artifact-entry p {
    font-size: 0.9rem;
    line-height: 1.58;
  }

}
