/* Card catalog look for /portfolio/ only. Loads after portfolio.css. */

/* Nanum Pen Script (OFL), cut down to Latin letters for the polaroid captions. */
@font-face { font-family: 'Nanum Pen'; src: url('/assets/fonts/nanum-pen-latin.woff2') format('woff2'); font-weight: 400; font-display: swap; }

.catalog {
  --wood: #1A1028;
  --brass: #C4A76E;
  --manila: #E2CDA0;
  --paper: #FBF7EE;
  --ink: #241735;
  --ink-mid: #3A2A4F;
  --ink-link: #5B21B6;
  --red-rule: #D9707A;
  --blue-rule: rgba(70, 110, 180, 0.28);
  --rule: 32px;
  --mono: 'Courier New', Courier, monospace;
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 23px);
}
.catalog::before { content: none; }
/* No stacking context, so the header gem can blend with the page. */
.catalog > * { z-index: auto; }
.catalog a:focus-visible { outline-color: var(--brass); }

/* Header gem: screen blend drops the image's black background. */
.catalog .site-link { padding: 0; border-radius: 0; }
.catalog .site-link:hover { background: none; }
.catalog .site-link img { width: 88px; height: 88px; border: 0; border-radius: 0; mix-blend-mode: screen; }

.catalog .crumb { font-family: var(--mono); font-weight: 400; letter-spacing: 0.04em; text-transform: none; font-size: 15px; color: var(--tint); }
.catalog .btn { border-radius: 4px; border: 2px solid var(--brass); color: var(--tint); }
.catalog .btn:hover { background: rgba(196, 167, 110, 0.14); color: var(--white); border-color: var(--brass); }
.catalog .btn-primary { background: var(--brass); color: var(--wood); }
.catalog .btn-primary:hover { background: #D1B680; color: var(--wood); }

.intro-catalog { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 40px; }
.intro-copy { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.intro-art { display: none; }

/* Each section is a manila folder: a tab on top, the cards inside. */
/* Own stacking context, so the clip's back layer sits under the folder but above the page. */
.guide-section { position: relative; z-index: 0; display: flex; flex-direction: column; }
/* Sits above the folder so the folder's shadow can't draw a seam under the tab. */
.guide { position: relative; z-index: 1; display: flex; margin-bottom: -2px; }
.guide-tab {
  position: relative; z-index: 0;
  max-width: calc(100% - 48px); margin: 0 0 0 24px; padding: 10px 26px 8px;
  color: var(--ink); text-align: center;
  font-family: var(--mono); font-weight: 700; font-size: 18px; letter-spacing: 0.04em; line-height: 1.3;
}
/* Perspective tilt gives the tab slanted sides while keeping rounded corners. */
.guide-tab::before {
  content: ""; position: absolute; inset: 0 0 -2px; z-index: -1;
  background: var(--manila); border-radius: 8px 8px 0 0;
  transform: perspective(60px) rotateX(5deg); transform-origin: bottom;
}
.guide-tab a { color: var(--ink-link); text-decoration: underline; text-underline-offset: 3px; }
.guide-tab a:focus-visible { outline-color: var(--ink-link); }
.folder {
  position: relative; display: flex; flex-direction: column; gap: 32px;
  padding: 36px 16px 28px; border-radius: 8px;
  background: var(--manila);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}
.folder-stain {
  background: url('/assets/portfolio/coffee-ring.svg') no-repeat right -30px bottom -50px / 400px auto, var(--manila);
}
/* Two layers: the back leg sits under the folder, the front loop on top. */
.folder-clip {
  position: absolute; top: -18px; left: var(--clip-drag, var(--clip-x)); z-index: 2;
  width: 36px; height: 88px;
  transform: rotate(calc(var(--clip-tilt, 0deg) + var(--clip-swing, 0deg))); transform-origin: 50% 18px;
  transition: transform 320ms ease;
  pointer-events: none;
}
.folder-clip-back { z-index: -1; }
/* The wire is the drag handle; the rest of the box lets clicks through to the cards. */
.clip-hit { pointer-events: stroke; cursor: grab; touch-action: none; }
.folder.is-dragging .folder-clip { transition: transform 80ms linear; }
.folder.is-dragging .clip-hit { cursor: grabbing; }

.entry { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 32px; }

/* Certification stamps. The mask punches the perforated edge: a grid of holes,
   filled back in everywhere except the outer band. */
.stamps { display: flex; flex-wrap: wrap; gap: 18px 16px; list-style: none; margin: 0; padding: 0; }
.stamps li { filter: drop-shadow(0 2px 2px rgba(70, 45, 15, 0.3)); }
.stamp {
  --stamp-holes: radial-gradient(circle 4px at 5px 5px, #0000 96%, #000) -5px -5px / 10px 10px round;
  --stamp-fill: linear-gradient(#000 0 0) 5px 5px / calc(100% - 10px) calc(100% - 10px) no-repeat;
  display: block; width: 232px; max-width: 100%; padding: 9px;
  background: #FBF8EF; color: var(--ink); text-decoration: none;
  -webkit-mask: var(--stamp-holes), var(--stamp-fill); mask: var(--stamp-holes), var(--stamp-fill);
  transform: rotate(var(--tilt, 0deg)); transition: transform 260ms ease;
}
.stamps .stamp::after { content: none; }
.stamp:hover, .stamp:focus-visible { transform: none; color: var(--ink); }
.stamp:focus-visible { outline: 3px solid var(--ink-link); outline-offset: -6px; }
/* Landscape stamp: the logo fills the left square, the text sits beside it. */
.stamp-art {
  display: flex; aspect-ratio: 2.2 / 1;
  background: var(--art); color: var(--art-ink); filter: saturate(0.82);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.stamp-art img { height: 100%; width: auto; aspect-ratio: 1; object-fit: cover; flex: none; }
.stamp-text { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 3px; padding: 18px 9px 8px 8px; }
.stamp-year { position: absolute; top: 4px; right: 7px; font-family: var(--body); font-size: 11px; }
.stamp-title { font-family: var(--body); font-size: 13px; line-height: 1.15; }
.stamp-issuer { font-family: var(--display); font-weight: 600; font-size: 9.5px; line-height: 1.2; letter-spacing: 0.06em; text-transform: uppercase; }
.stamp-bluedot { --art: #0336FF; --art-ink: #FFFFFF; }
.stamp-anthropic { --art: #D09B74; --art-ink: #191919; }
.stamp-uc { --art: #CFE1EA; --art-ink: #12355B; }
.stamp-uc img { mix-blend-mode: multiply; padding: 5px; box-sizing: border-box; }

/* Index card: title above the red rule, description on the blue lines. */
.card {
  position: relative; flex: 1 1 100%; max-width: 680px; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink); border-radius: 3px;
  box-shadow: 0 2px 6px rgba(70, 45, 15, 0.22);
}
.card-head { padding: 18px 26px 10px; border-bottom: 2px solid var(--red-rule); display: flex; flex-direction: column; gap: 4px; }
.card-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; font-family: var(--mono); font-size: 15px; color: var(--ink-mid); }
.card h3 { font-family: var(--mono); font-size: clamp(22px, 5.6vw, 28px); font-weight: 700; color: var(--ink); line-height: 1.15; letter-spacing: -0.01em; }
.card-body {
  flex: 1; padding: 0 26px 44px;
  background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--rule) - 1px), var(--blue-rule) calc(var(--rule) - 1px) var(--rule));
  font-family: var(--mono); font-size: 16px; line-height: var(--rule);
}
.card-body p { margin: 0; }
.card .stat { font-family: inherit; color: var(--ink); font-weight: 700; }
/* Only this link is clickable; padding grows the tap target without shifting the ruled lines. */
.card .more { display: inline-block; padding: 6px 0; margin: -6px 0; font-family: var(--mono); font-weight: 700; font-size: 16px; color: var(--ink-link); text-decoration: underline; text-underline-offset: 3px; }
.card .more:hover { color: var(--ink); }
.card .more:focus-visible { outline-color: var(--ink-link); }
/* Case study, live site and GitHub links, each on its own ruled line. */
.card-links { display: flex; flex-direction: column; align-items: flex-start; }
.card .gh { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: var(--rule); color: var(--ink-mid); }
.card .gh::after { content: none; }
.card .gh svg { width: 22px; height: 22px; fill: currentColor; }
.card .gh:hover { color: var(--ink-link); }
.card .gh:focus-visible { outline-color: var(--ink-link); }
.card-hole { position: absolute; left: 50%; bottom: 12px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--manila); }

/* Launch post: a polaroid and a typed slip. */
.clip { position: relative; flex: 1 1 300px; max-width: 360px; min-width: 0; }
.snap { position: relative; z-index: 1; margin: 0; padding: 12px 12px 40px; background: var(--white); transform: rotate(-2deg); box-shadow: 0 3px 8px rgba(70, 45, 15, 0.25); transition: transform 260ms ease; }
.snap img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.snap-wide img { aspect-ratio: auto; }
.snap-small { width: 72%; margin-inline: auto; }
/* Handwritten caption in the polaroid's bottom margin. */
.cap { font-family: 'Nanum Pen', 'Bradley Hand', cursive; color: #3A2A4F; }
.clip .snap { padding-bottom: 0; }
.clip .cap { display: block; height: 40px; line-height: 40px; text-align: center; font-size: 23px; }
/* Video polaroid: the photo links to the video on YouTube. */
.snap-video { position: relative; display: block; }
.snap .snap-video::after { content: none; }
.nowrap { white-space: nowrap; }
.play {
  position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
  background: rgba(36, 23, 53, 0.82); color: var(--white); border: 3px solid var(--white);
  transition: transform 160ms ease;
}
.play svg { width: 24px; height: 24px; margin-left: 3px; }
.snap-video:hover .play { transform: scale(1.08); }
.duration { position: absolute; right: 8px; bottom: 8px; padding: 1px 6px; border-radius: 3px; background: rgba(36, 23, 53, 0.85); color: var(--white); font-family: var(--mono); font-size: 13px; }
.snap-video:focus-visible { outline-color: var(--ink-link); }
.snap-player { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.entry:nth-of-type(even) .snap { transform: rotate(2deg); }
.clip:hover .snap, .clip:focus-within .snap { transform: none; }
.slip {
  position: relative; margin: -10px 12px 0; padding: 22px 18px 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 6px rgba(70, 45, 15, 0.22);
  display: flex; flex-direction: column; gap: 6px; font-size: 16px; line-height: 1.5;
}
.slip a { color: var(--ink-link); font-family: var(--display); font-weight: 600; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; align-self: flex-start; }
.slip a:hover { color: var(--ink); }
.slip a:focus-visible { outline-color: var(--ink-link); }

/* Article notes: a dated polaroid of the cover laid over a sticky note. */
.prints { display: grid; grid-template-columns: 1fr; gap: 28px; }
.prints > li { position: relative; z-index: 0; }
/* Curled corner: a shadow tucked under the bottom right of the note. */
.prints > li::after {
  content: ""; position: absolute; z-index: -1; right: 10px; bottom: 8px;
  width: 55%; height: 18px; transform: rotate(4deg);
  box-shadow: 0 10px 10px rgba(70, 45, 15, 0.28);
}
.print { display: flex; flex-direction: column; height: 100%; color: var(--ink); }
.print-snap {
  position: relative; z-index: 1; display: block; margin: 0 8px; padding: 10px 10px 0;
  background: var(--white); box-shadow: 0 3px 8px rgba(70, 45, 15, 0.25);
  transform: rotate(var(--snap-tilt, -2deg)); transition: transform 260ms ease;
}
.print-snap img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.print .cap { display: block; height: 36px; line-height: 36px; text-align: center; font-size: 21px; }
.print-note {
  flex: 1; display: flex; flex-direction: column; gap: 6px; margin-top: -10px; padding: 24px 16px 22px;
  background: linear-gradient(rgba(70, 45, 15, 0.05), transparent 18%), var(--note, #F1E39A);
  box-shadow: 0 1px 2px rgba(70, 45, 15, 0.2);
  transition: transform 260ms ease;
}
.prints > li:nth-child(1) .print { --note: #F1E39A; --tilt: -1.5deg; --snap-tilt: -2deg; }
.prints > li:nth-child(2) .print { --note: #EFC9CB; --tilt: 1.2deg; --snap-tilt: 2deg; }
.prints > li:nth-child(3) .print { --note: #CDDFEC; --tilt: -0.8deg; --snap-tilt: -1.5deg; }
.prints > li:nth-child(4) .print { --note: #D6E6BE; --tilt: 1.8deg; --snap-tilt: 2.5deg; }
.print:hover { color: var(--ink); }
/* On hover the polaroid straightens and the note tilts. */
.print:hover .print-snap, .print:focus-visible .print-snap { transform: none; }
.print:hover .print-note, .print:focus-visible .print-note { transform: rotate(var(--tilt, -1.5deg)); }
.print .name { font-family: var(--display); font-weight: 600; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.print .what { font-size: 15px; line-height: 1.45; color: var(--ink-mid); }
.print[target="_blank"]::after { content: none; }
.print[target="_blank"] .name::after {
  content: ""; display: inline-block; width: 0.72em; height: 0.72em; margin-left: 0.4em;
  background: currentColor;
  -webkit-mask: var(--ext-icon) no-repeat center / contain;
          mask: var(--ext-icon) no-repeat center / contain;
}

.catalog .foot { border-top-color: rgba(196, 167, 110, 0.35); }
.catalog .foot small { color: rgba(233, 217, 242, 0.75); }
.catalog .foot a { color: var(--tint); }

/* A label that wraps makes a taller tab; a longer perspective keeps the slant the same. */
@media (max-width: 639px) {
  .guide-tab { font-size: 16px; padding: 8px 20px 6px; }
  .guide-tab::before { transform: perspective(180px) rotateX(5deg); }
  .folder-clip { left: var(--clip-drag, calc(100% - 42px)); top: -14px; width: 28px; height: 68px; }
}
@media (min-width: 640px) {
  .folder { padding: 44px 32px 40px; }
  .prints { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .catalog { --rule: 34px; }
  /* 3 by 5 inch proportions; grows taller if the text needs it. */
  .card { flex: 1 1 560px; aspect-ratio: 5 / 3; }
  .card-head { padding: 22px 32px 12px; }
  .card-body { padding: 0 32px 48px; font-size: 17px; }
  .prints { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* A loose fan of polaroids; the one under the cursor straightens and comes to the top. */
  .intro-art { display: block; flex: 1 1 300px; position: relative; height: 310px; max-width: 320px; }
  .intro-art .snap { position: absolute; width: 150px; padding: 10px 10px 30px; transform: rotate(var(--tilt)); }
  .intro-art .snap img { aspect-ratio: 1; }
  .intro-art .snap { padding-bottom: 8px; }
  .intro-art .cap { display: block; padding-top: 4px; text-align: center; font-size: 19px; line-height: 1.1; }
  .intro-art .snap:hover { transform: none; z-index: 5; }
  /* Once the script turns the pile into a shuffle, it moves the photos itself. */
  .intro-art.is-pile { cursor: pointer; }
  .intro-art.is-pile .cap { white-space: nowrap; }
  .intro-art.is-pile .snap { left: 60px; top: 36px; width: 190px; transition: transform 420ms cubic-bezier(.2, .8, .2, 1); }
  .intro-art.is-pile .snap:hover { transform: var(--pose); z-index: auto; }
  .intro-art.is-pile:focus-visible { outline: 3px solid var(--brass); outline-offset: 6px; border-radius: 4px; }
  .snap-1 { left: 0; top: 8px; --tilt: -8deg; }
  .snap-2 { left: 150px; top: 0; --tilt: 6deg; }
  .snap-3 { left: 14px; top: 130px; --tilt: 5deg; }
  .snap-4 { left: 140px; top: 120px; --tilt: -3deg; }
  .snap-5 { left: 80px; top: 60px; --tilt: 2deg; }
}

/* Case study pages: facts on a ruled index card, screenshots as polaroids,
   the write-up on a plain cream sheet. */
.case-page .facts {
  --rule: 28px;
  margin: 0; padding: 18px 26px 10px;
  background:
    linear-gradient(var(--paper) 0 16px, var(--red-rule) 16px 18px, transparent 18px),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--rule) - 1px), var(--blue-rule) calc(var(--rule) - 1px) var(--rule)) 0 18px,
    var(--paper);
  color: var(--ink); border-radius: 3px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  line-height: var(--rule);
}
/* Grid so the label column sizes to the longest label on each page. */
/* No row gap, so every row lands on a ruled line. */
.case-page .facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 18px; align-items: start; }
.case-page .facts div { display: contents; }
.case-page .facts dt { position: relative; top: 1px; font-family: var(--mono); font-weight: 700; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--ink); }
.case-page .facts dd { margin: 0; min-width: 0; font-size: 16px; color: var(--ink); }
.case-page .facts a { color: var(--ink-link); }
.case-page .facts a:focus-visible { outline-color: var(--ink-link); }
.case-page .stat { font-family: inherit; font-weight: 700; color: var(--ink); }
.case-page .shot {
  align-self: center; max-width: 100%; margin: 0; padding: 12px 12px 14px;
  background: var(--white); transform: rotate(-1deg); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.case-page .prose .shot { transform: rotate(1deg); box-shadow: 0 3px 8px rgba(70, 45, 15, 0.25); }
.case-page .shot img { border: 0; border-radius: 0; }
.case-page .shot figcaption { padding-top: 8px; text-align: center; font-family: var(--mono); font-size: 14px; color: var(--ink-mid); }
.case-page .prose {
  padding: 26px 20px 30px; background: #FFFDF8; color: var(--ink);
  border-radius: 2px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.case-page .prose h2 { align-self: flex-start; padding-bottom: 6px; border-bottom: 2px solid var(--red-rule); font-family: var(--mono); font-weight: 700; color: var(--ink); }
.case-page .prose p, .case-page .prose li { color: var(--ink); }
.case-page .prose strong { font-weight: 600; color: var(--ink); }
.case-page .prose a { color: var(--ink-link); }
.case-page .prose a:focus-visible { outline-color: var(--ink-link); }
.case-page .prose .video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: #000; }
.case-page .prose li::before { background: var(--red-rule); }
.case-page .back { font-family: var(--mono); font-weight: 700; color: var(--tint); }

@media (min-width: 640px) {
  .case-page .prose { padding: 40px 48px 44px; }
}
@media (max-width: 639px) {
  .case-page .facts { grid-template-columns: minmax(0, 1fr); }
}
