/* Rat Park — the file.
   Black desk, dull manila folders, typed paper. Red is ink only. */

:root {
  --desk: #0b0b0a;
  --ink: #141312;
  --paper: #ece6da;
  --manila: #bcb08f;
  --manila-back: #9f9476;
  --manila-edge: #8c8266;
  --red: #b33227;
  --dim: #9d978b;
  --type: "Courier New", Courier, "Nimbus Mono PS", "Liberation Mono", ui-monospace, monospace;
  --gutter: 16px;
  --max: 760px;
}
@media (min-width: 48rem) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--desk);
  color: var(--paper);
  font: 400 1rem/1.6 var(--type);
  overflow-x: hidden;
}
/* xerox grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
::selection { background: var(--red); color: var(--paper); }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 60;
  background: var(--paper); color: var(--ink); padding: 8px 12px;
}
.skip:focus { left: 8px; }

.vh {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- desk ---------- */

.desk {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px var(--gutter) 40px;
}

/* the big logo, same size and place on every page */
.masthead { display: block; max-width: 520px; margin: 8px auto 26px; }
.masthead img { width: 100%; }
a.masthead:hover { opacity: .9; }

/* ---------- folder ---------- */

.folder { position: relative; margin-top: 8px; }

.tabs ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0 0 0 10px;
  list-style: none;
}
.tabs li { flex: 0 1 auto; min-width: 0; }
.tabs a {
  display: block;
  position: relative;
  padding: 10px 12px 8px;
  min-height: 40px;
  background: var(--manila-back);
  color: var(--ink);
  font: 700 .72rem/1.5 var(--type);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 6px 6px 0 0;
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 100%, 0 100%);
  transform: translateY(3px);
}
.tabs a:hover { background: var(--manila); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--manila); transform: none; }
@media (min-width: 30rem) {
  .tabs a { padding: 10px 18px 8px; font-size: .8rem; }
}

.folder__body {
  position: relative;
  background: var(--manila);
  color: var(--ink);
  padding: 22px 16px 28px;
  border-radius: 0 3px 3px 3px;
  box-shadow: inset 0 0 0 1px var(--manila-edge), inset 0 0 60px rgba(60, 50, 30, .25), 0 18px 40px rgba(0, 0, 0, .6);
  background-image:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .025) 0 1px, transparent 1px 7px),
    radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .12), transparent 60%);
}
@media (min-width: 48rem) { .folder__body { padding: 36px 40px 44px; } }

/* folder label */
.label {
  display: inline-block;
  background: var(--paper);
  color: var(--ink);
  padding: 6px 12px 5px;
  font: 700 .8rem/1.4 var(--type);
  letter-spacing: .12em;
  text-transform: uppercase;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .25);
  transform: rotate(-.6deg);
}

/* ---------- paper ---------- */

.sheet {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  padding: 30px 18px 26px;
  margin: 18px 0 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 18px rgba(40, 30, 10, .25);
  transform: rotate(.35deg);
}
.sheet + .sheet { transform: rotate(-.4deg); margin-top: 26px; }
@media (min-width: 48rem) { .sheet { padding: 40px 44px 36px; } }

/* paper clip */
.clip::before {
  content: "";
  position: absolute;
  top: -18px;
  right: 28px;
  width: 22px;
  height: 64px;
  z-index: 2;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 64'%3E%3Cpath d='M6 20V9a5 5 0 0 1 10 0v42a8 8 0 0 1-16 0V14' fill='none' stroke='%23d9d6cf' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M6 20V9a5 5 0 0 1 10 0v42a8 8 0 0 1-16 0V14' fill='none' stroke='%23000' stroke-opacity='.25' stroke-width='2.2' stroke-linecap='round' transform='translate(1 1)'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* photo print */
.print {
  position: relative;
  margin: 0;
  background: var(--paper);
  padding: 10px 10px 12px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, .35), 0 14px 26px rgba(0, 0, 0, .35);
  transform: rotate(-1.2deg);
}
.print img { width: 100%; }
.print figcaption {
  margin-top: 10px;
  font: 400 .75rem/1.4 var(--type);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #5b574f;
}

/* ---------- typed text ---------- */

h1, h2, h3 { font-family: var(--type); font-weight: 700; line-height: 1.2; margin: 0; }
.sheet h2 {
  font-size: .8rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 30px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(20, 19, 18, .35);
}
.sheet h2:first-of-type { margin-top: 0; }
.sheet p { margin: 0 0 14px; max-width: 62ch; }
.sheet a:hover { color: var(--red); }

.page-title {
  font-size: 1.35rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 16px 0 0;
}

/* record fields */
.fields { margin: 0; display: grid; gap: 10px 20px; }
.fields div { display: grid; gap: 1px; }
.fields dt {
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #5b574f;
}
.fields dd { margin: 0; font-weight: 700; }
@media (min-width: 40rem) {
  .fields div { grid-template-columns: 11.5rem 1fr; gap: 16px; align-items: baseline; }
}

.tracks { margin: 0; padding: 0 0 0 2.2em; }
.tracks li { padding: 2px 0; }
.tracks small { font-size: .82em; color: #5b574f; }
.tracks + p { margin-top: 14px; }
.sheet .sub { font-size: 1rem; margin: 22px 0 6px; }
.sheet h2 + .sub { margin-top: 0; }
.sheet .print { max-width: 460px; margin: 6px auto 0; }

/* red ink: handwritten-feeling underline, used sparingly */
.ink {
  background: linear-gradient(transparent 62%, rgba(179, 50, 39, .28) 62%, rgba(179, 50, 39, .28) 88%, transparent 88%);
  padding: 0 2px;
}

.exhibit {
  margin: 22px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--red);
  background: rgba(20, 19, 18, .04);
}
.exhibit p { margin: 0; }
.exhibit cite { display: block; margin-top: 8px; font-style: normal; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: #5b574f; }

.qa dt { font-weight: 700; margin-top: 16px; }
.qa dd { margin: 4px 0 0; }

/* ---------- home ---------- */

.home .print { max-width: 420px; margin: 10px auto 0; }
.home .case-card { margin-top: 26px; }
@media (min-width: 48rem) {
  .home .folder__body { display: grid; grid-template-columns: 320px 1fr; gap: 40px; align-items: end; }
  .home .print { margin: 0; }
  .home .case-card { margin: 0 0 8px; }
}
.case { list-style: none; margin: 18px 0 0; padding: 0; max-width: 360px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.case li { padding: 3px 0; border-bottom: 1px dashed rgba(20, 19, 18, .35); }
.case span { color: #4a463f; }

/* ---------- contact ---------- */

.channels { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.channels li { display: grid; gap: 2px; }
.channels span { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: #5b574f; }
.channels a { font-size: 1.1rem; font-weight: 700; word-break: break-all; }

/* ---------- rat files ---------- */

.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: grid; grid-template-columns: 4.2rem 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed rgba(20, 19, 18, .35); }
.file-list .no { color: #5b574f; }
.file-list .pending { color: #5b574f; }

.stamp {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ---------- footer ---------- */

.site-foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px var(--gutter) 40px;
  color: var(--dim);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.site-foot p { margin: 0 0 6px; }
.site-foot a { color: var(--dim); }
.site-foot a:hover { color: var(--paper); }

/* ---------- page turn between tabs ----------
   Cross-document view transitions. The logo and tabs hold still while the
   folder's page turns on its left edge like a book page. Moving right through
   the tabs turns the page forward; moving left turns it back (js/flip.js sets
   the direction). Browsers without support just load the page normally. */

@view-transition { navigation: auto; }

.masthead { view-transition-name: masthead; }
.tabs { view-transition-name: tabs; }
.folder__body { view-transition-name: sheet; }

::view-transition-old(root),
::view-transition-new(root) { animation: none; }

/* the page is swapped in place: no resizing or sliding */
::view-transition-group(sheet) { animation: none; }
::view-transition-image-pair(sheet) { isolation: auto; perspective: 2400px; }

::view-transition-old(sheet),
::view-transition-new(sheet) {
  mix-blend-mode: normal;
  transform-origin: 0 50%;
  backface-visibility: hidden;
  animation-duration: .9s;
  animation-timing-function: cubic-bezier(.42, .02, .28, 1);
  animation-fill-mode: both;
}

/* forward: the current page lifts from the right and turns over the left edge,
   uncovering the next page underneath */
::view-transition-old(sheet) { z-index: 2; animation-name: page-turn-away; }
::view-transition-new(sheet) { z-index: 1; animation-name: page-uncover; }

/* back: the previous page turns back over from the left and lays down on top */
html:active-view-transition-type(back)::view-transition-old(sheet) { z-index: 1; animation-name: page-cover; }
html:active-view-transition-type(back)::view-transition-new(sheet) { z-index: 2; animation-name: page-turn-back; }

@keyframes page-turn-away {
  0%   { transform: rotateY(0deg); filter: brightness(1); }
  50%  { filter: brightness(.82); }
  100% { transform: rotateY(-180deg); filter: brightness(.6); }
}
@keyframes page-turn-back {
  0%   { transform: rotateY(-180deg); filter: brightness(.6); }
  50%  { filter: brightness(.82); }
  100% { transform: rotateY(0deg); filter: brightness(1); }
}
/* the page underneath sits in the shadow of the turning page */
@keyframes page-uncover {
  0%   { filter: brightness(.55); }
  100% { filter: brightness(1); }
}
@keyframes page-cover {
  0%   { filter: brightness(1); }
  100% { filter: brightness(.55); }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
