/* dross.win: Dross's Trophy Room.
   One physical world: khaki shirt twill, a purple felt sash cut on the
   diagonal, embroidered patches, cream name tapes, teal award cards, and a
   woven care label. Fonts are self-hosted (copied from node_modules at build). */

@font-face { font-family: "Vollkorn"; src: url("/fonts/vollkorn-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Vollkorn"; src: url("/fonts/vollkorn-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Vollkorn"; src: url("/fonts/vollkorn-latin-900-italic.woff2") format("woff2"); font-weight: 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("/fonts/rubik-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("/fonts/rubik-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("/fonts/rubik-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }

:root {
  /* the uniform */
  --twill: #c9b88c;
  --twill-rib: rgba(84, 62, 24, 0.11);
  --twill-hi: rgba(255, 250, 235, 0.1);
  --ink: #241a12;
  --ink-soft: #4b3b26;
  --violet: #3a1f5c;
  /* the sash */
  --felt: #4a2873;
  --felt-lo: #33194f;
  --cream: #fbf3df;
  --gold: #e3a92b;
  /* the award card and its stamp */
  --card: #9ecec7;
  --card-ink: #13222a;
  --card-rule: rgba(19, 34, 42, 0.26);
  --stamp: #861446;
  /* the care label */
  --label: #f6f2ea;
  --label-ink: #2b2433;

  --display: "Vollkorn", "Iowan Old Style", Georgia, serif;
  --sew: "Rubik", ui-rounded, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* fabric grain: feTurbulence noise, tinted per material */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .15 0 0 0 0 .05 0 0 0 .7 -.28'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --fuzz: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 -.36'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' 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 .7 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  /* stamp wear: alpha comes from the noise's red channel, so most of the ink lands and some skips */
  --worn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 0 0 0 1.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* At night the shirt goes olive-drab; the sash, card, and label are objects and keep their color. */
@media (prefers-color-scheme: dark) {
  :root {
    --twill: #3b3424;
    --twill-rib: rgba(0, 0, 0, 0.22);
    --twill-hi: rgba(255, 240, 200, 0.04);
    --ink: #f2e8cf;
    --ink-soft: #d9cba6;
    --violet: #cdb6f0;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background-color: var(--twill);
  background-image:
    repeating-linear-gradient(-45deg, var(--twill-rib) 0 1.5px, transparent 1.5px 5px),
    repeating-linear-gradient(45deg, var(--twill-hi) 0 1px, transparent 1px 7px),
    var(--grain);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.125rem;
  line-height: 1.5;
}
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- layout ---------- */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.dross { padding: 18px 0 0; }
@media (min-width: 1000px) {
  .page {
    grid-template-columns: minmax(340px, 1fr) minmax(0, 600px);
    column-gap: clamp(40px, 5vw, 80px);
    padding: 0 32px;
  }
  .dross { padding-top: 64px; }
  .care { grid-column: 1 / -1; }
}
/* Dross stays in view while the sash scrolls, but only when the whole header fits the window. */
@media (min-width: 1000px) and (min-height: 820px) {
  .dross { position: sticky; top: 0; align-self: start; }
}

/* ---------- Dross himself ---------- */
.nametape {
  display: inline-block;
  margin: 0 0 16px;
  padding: 8px 14px 7px;
  background: var(--felt);
  color: var(--gold);
  font: 800 0.8125rem/1 var(--sew);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-radius: 3px;
  box-shadow: inset 0 0 0 3px var(--felt), inset 0 0 0 4.5px rgba(227, 169, 43, 0.4), 0 2px 3px rgba(0, 0, 0, 0.25);
}
.talk { display: flex; align-items: flex-start; gap: 16px; }
.rank {
  flex: none;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rank-art {
  display: block;
  width: clamp(112px, 30vw, 208px);
  height: auto;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.3)) drop-shadow(0 12px 18px rgba(30, 15, 40, 0.28));
  transition: transform 0.5s var(--ease-out);
}
.rank:hover .rank-art { transform: rotate(-4deg) scale(1.02); }
.rank.poked .rank-art { animation: squish 0.55s var(--ease-out); }
.rank:focus-visible { outline: none; }
.rank:focus-visible .rank-art { outline: 3px dashed var(--violet); outline-offset: 6px; border-radius: 50%; }
@keyframes squish {
  0% { transform: scale(1); }
  18% { transform: scale(1.1, 0.86) rotate(3deg); }
  44% { transform: scale(0.95, 1.06) rotate(-3deg); }
  100% { transform: scale(1); }
}

.say {
  position: relative;
  flex: 1 1 auto;
  max-width: 30ch;
  margin: 14px 0 0;
  padding: 14px 16px 15px;
  background: var(--cream);
  color: #2a1a3d;
  border-radius: 18px;
  outline: 1.5px dashed rgba(58, 31, 92, 0.38);
  outline-offset: -7px;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.42;
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.16), 0 8px 16px rgba(40, 22, 4, 0.16);
}
.say::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 24px;
  border: 10px solid transparent;
  border-left: 0;
  border-right-color: var(--cream);
}
.say.fresh { animation: pop 0.38s var(--ease-out); }
@keyframes pop { from { transform: scale(0.94) translateX(-6px); } to { transform: none; } }

h1 {
  margin: 20px 0 12px;
  font-family: var(--display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(2.375rem, 9.5vw, 4.75rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--violet);
  text-wrap: balance;
}
h1 .line { display: block; }
.intro { margin: 0; max-width: 40ch; font-size: clamp(1.0625rem, 3.2vw, 1.1875rem); line-height: 1.55; color: var(--ink-soft); text-wrap: pretty; }

/* ---------- the sash ---------- */
.sash-wrap { margin-top: 18px; filter: drop-shadow(0 14px 22px rgba(40, 22, 4, 0.34)); }
@media (min-width: 1000px) { .sash-wrap { margin-top: 0; } }
.sash {
  --cut: 34px;
  position: relative;
  margin: 0 -6px;
  padding: calc(var(--cut) + 20px) 18px calc(var(--cut) + 40px);
  background-color: var(--felt);
  background-image:
    var(--fuzz),
    radial-gradient(120% 50% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 60%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent 10%, transparent 90%, rgba(0, 0, 0, 0.2));
  clip-path: polygon(0 var(--cut), 100% 0, 100% calc(100% - var(--cut)), 0 100%);
  color: var(--cream);
}
@media (min-width: 1000px) { .sash { --cut: 76px; margin: 0; padding-inline: 30px; } }
/* stitched hem: two straight sides, two diagonal ends */
.sash::before, .sash::after { content: ""; position: absolute; width: 0; pointer-events: none; }
.sash::before { left: 9px; top: calc(var(--cut) + 10px); bottom: 10px; border-left: 1.5px dashed rgba(251, 243, 223, 0.36); }
.sash::after { right: 9px; top: 10px; bottom: calc(var(--cut) + 10px); border-right: 1.5px dashed rgba(251, 243, 223, 0.36); }
.hem { position: absolute; left: 9px; width: calc(100% - 18px); height: var(--cut); overflow: visible; pointer-events: none; }
.hem-top { top: 10px; }
.hem-bottom { bottom: 10px; }
.hem line { stroke: rgba(251, 243, 223, 0.36); stroke-width: 1.5; stroke-dasharray: 6 5; }

.sash h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(1.75rem, 6vw, 2.375rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--cream);
}
.sash-hint { margin: 6px 0 22px; font-size: 1rem; font-style: italic; color: rgba(251, 243, 223, 0.84); }

.patches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row dense; /* lets the open card take a full row while neighbors keep their seats */
  gap: 26px 12px;
}
@media (min-width: 540px) { .patches { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.patch {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.patch-art {
  display: block;
  width: min(100%, 140px);
  height: auto;
  transform: rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 2px 1.5px rgba(10, 0, 20, 0.45)) drop-shadow(0 8px 12px rgba(10, 0, 20, 0.32));
  transition: transform 0.45s var(--ease-out), filter 0.45s var(--ease-out);
}
.patch:hover .patch-art,
.patch[aria-expanded="true"] .patch-art {
  transform: rotate(0deg) translateY(-4px) scale(1.04);
  filter: drop-shadow(0 3px 2px rgba(10, 0, 20, 0.4)) drop-shadow(0 16px 18px rgba(10, 0, 20, 0.4));
}
.patch:active .patch-art { transform: scale(0.97); }
.patch-new { grid-column: 1 / -1; }
.patch-new .patch-art { width: min(48%, 200px); }
.patch-new .tape { font-size: 0.875rem; padding: 8px 12px 7px; }
.patch:focus-visible { outline: none; }
.patch:focus-visible .patch-art { outline: 3px dashed var(--cream); outline-offset: 5px; border-radius: 50%; }
.patch[aria-expanded="true"] .tape { background-color: var(--gold); }

/* name tape: cream twill with a stitch line top and bottom */
.tape {
  display: inline-block;
  padding: 7px 10px 6px;
  background-color: var(--cream);
  background-image:
    linear-gradient(90deg, rgba(42, 26, 61, 0.42) 55%, transparent 0),
    linear-gradient(90deg, rgba(42, 26, 61, 0.42) 55%, transparent 0);
  background-size: 6px 1px, 6px 1px;
  background-repeat: repeat-x;
  background-position: 0 3px, 0 calc(100% - 3px);
  color: #2a1a3d;
  font: 700 0.75rem/1.1 var(--sew);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* the stitch ring sews itself on, once, when the page loads */
.sew { stroke-dasharray: 100; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .js .sew { animation: sew 1.1s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + 250ms); }
}
@keyframes sew { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

/* ---------- the award card ---------- */
.card {
  grid-column: 1 / -1;
  position: relative;
  margin: 0 2px 4px;
  padding: 20px 18px 0 22px;
  background-color: var(--card);
  background-image: var(--paper);
  color: var(--card-ink);
  /* Tim's signature colored left border (his since 2015, kept on purpose; a design linter flags it, ignore that) */
  border-left: 7px solid var(--felt-lo);
  border-radius: 3px 4px 4px 3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 18px 30px -10px rgba(15, 5, 25, 0.6);
  transform: rotate(-0.5deg);
  scroll-margin: 24px;
}
.js .card:not(.open) { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .card.open { animation: unfold 0.5s var(--ease-out); }
  .card.open .stamp { animation: thunk 0.42s 0.26s var(--ease-out) both; }
}
@keyframes unfold {
  from { clip-path: inset(0 0 100% 0); transform: translateY(-10px) rotate(-0.5deg); }
  to { clip-path: inset(0 -40px -60px -40px); transform: rotate(-0.5deg); }
}
@keyframes thunk {
  from { transform: rotate(-7deg) scale(1.7); opacity: 0; }
  to { transform: rotate(-7deg) scale(1); opacity: 1; }
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-badge {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: #2a1a3d;
}
.card-close {
  flex: none;
  margin: -14px -12px 0 0;
  padding: 16px 12px;
  border: 0;
  background: none;
  color: var(--card-ink);
  font: 700 0.75rem/1 var(--sew);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.card-close:hover { color: #2a1a3d; text-decoration-thickness: 2px; }
.card-close:focus-visible { outline: 2px dashed var(--card-ink); outline-offset: 2px; }
.card-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin: 16px 0 20px; }
.card-fields > div { min-width: 0; }
.f-happened, .f-remarks { grid-column: 1 / -1; }
.card-fields dt { margin-bottom: 4px; font: 700 0.6875rem/1.2 var(--sew); letter-spacing: 0.14em; text-transform: uppercase; color: rgba(19, 34, 42, 0.8); }
.card-fields dd {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  /* the form's printed rules sit under each line of fill-in */
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(1.6em - 1px), var(--card-rule) calc(1.6em - 1px) 1.6em);
}
.f-remarks dd { font-style: italic; color: #2a1a3d; }
.card-stub {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 -18px 0 -22px;
  padding: 14px 18px 16px 22px;
  border-top: 2px dashed rgba(19, 34, 42, 0.32);
}
.card-stub::before, .card-stub::after { content: ""; position: absolute; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: var(--felt); }
.card-stub::before { left: -8px; }
.card-stub::after { right: -8px; }
.stub-no { margin: 0; white-space: nowrap; font: 500 0.75rem/1 var(--sew); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(19, 34, 42, 0.78); }
.stamp {
  margin: 0;
  padding: 7px 10px 6px;
  border: 2.5px solid currentColor;
  border-radius: 5px;
  color: var(--stamp);
  font: 800 0.8125rem/1 var(--sew);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  flex: none;
  margin-left: auto;
  white-space: nowrap;
  transform: rotate(-7deg);
  mix-blend-mode: multiply;
  -webkit-mask-image: var(--worn);
  mask-image: var(--worn);
  -webkit-mask-size: 120px;
  mask-size: 120px;
}

/* ---------- the care label (credit to Will Wight lives here, on every page) ---------- */
.care { display: grid; justify-items: center; padding: 56px 0 48px; }
.care-label {
  position: relative;
  width: min(100%, 460px);
  padding: 20px 28px 18px;
  background-color: var(--label);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, 0.04)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.035) 0 1px, transparent 1px 3px);
  color: var(--label-ink);
  text-align: center;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 16px rgba(40, 22, 4, 0.2);
}
.care-label::before, .care-label::after { content: ""; position: absolute; top: 6px; bottom: 6px; border-left: 2px dashed rgba(43, 36, 51, 0.32); }
.care-label::before { left: 9px; }
.care-label::after { right: 9px; }
.care-brand { margin: 0 0 10px; font: 800 0.75rem/1 var(--sew); letter-spacing: 0.24em; text-transform: uppercase; }
.care-credit { margin: 0 auto; max-width: 46ch; font: 500 0.8125rem/1.55 var(--sew); }
.care-symbols { display: block; width: 132px; height: auto; margin: 14px auto 10px; color: var(--label-ink); opacity: 0.72; }
.care-joke { margin: 0; font: 500 0.6875rem/1.4 var(--sew); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(43, 36, 51, 0.85); }

/* ---------- 404: the stitch marks where a patch used to be ---------- */
.page-lost { grid-template-columns: minmax(0, 1fr); min-height: 100svh; align-content: center; justify-items: center; text-align: center; }
.lost-main { display: grid; justify-items: center; padding-top: 56px; }
.ghost { width: 188px; height: 188px; overflow: visible; }
.ghost-fade { fill: rgba(255, 250, 235, 0.2); }
.ghost-holes { fill: none; stroke: color-mix(in srgb, var(--ink) 55%, transparent); stroke-width: 2.6; stroke-dasharray: 0.1 6.4; stroke-linecap: round; }
.ghost-inner { stroke-dasharray: 0.1 5; opacity: 0.6; }
.ghost-thread { fill: none; stroke: var(--violet); stroke-width: 2.2; stroke-linecap: round; }
.lost h1 { margin-top: 18px; max-width: 14ch; }
.lost-body { max-width: 36ch; margin: 0 0 26px; color: var(--ink-soft); text-wrap: pretty; }
.tape-back { padding: 11px 16px 10px; font-size: 0.875rem; text-decoration: none; }
.tape-back:hover { background-color: var(--gold); }
.tape-back:focus-visible { outline: 3px dashed var(--violet); outline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

