/* ============================================================
   KAYLEE DINH — PORTFOLIO DESIGN SYSTEM v3
   Concept: warm, playful, hand-picked — after Rayo's e-commerce
   product-card energy (candy pastels, bouncy italic serif
   headlines, fully rounded pills and cards) instead of a stark
   grid. Same content, much friendlier room to sit in.
   ============================================================ */

:root {
  /* Color tokens */
  --cream: #fbf1e2;        /* page background — warm, not stark white */
  --surface: #fffdf8;      /* card surface */
  --ink: #2b1a10;          /* warm near-black text */
  --red: #cf4538;          /* primary — logo, buttons, key accents */
  --red-dark: #a83a2b;     /* hover / headline color */
  --pink: #ffb5bf;         /* soft pink block */
  --blue: #abcbd8;         /* soft blue block */
  --yellow: #ffd77c;       /* soft yellow block */
  --muted: #8b7a6b;        /* warm secondary text */
  --line: rgba(43, 26, 16, 0.12);
  --line-soft: rgba(43, 26, 16, 0.07);
  --shadow: 0 10px 26px rgba(43, 26, 16, 0.08);

  /* aliases kept so component CSS below reads clearly */
  --paper: var(--cream);
  --accent: var(--red);
  --accent-2: var(--red-dark);
  --light-blue: var(--blue);

  /* Type */
  --font-display: "Averia Serif Libre", "Iowan Old Style", Georgia, serif;
  --font-body: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Satoshi", sans-serif; /* labels, nav, buttons — bold weight does the work */

  /* Layout */
  --max: 1240px;
  --gutter: clamp(20px, 5vw, 64px);
  --nav-h: 80px;
  --radius: 28px;
  --radius-sm: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* Cute rotating loading indicator — shown as a background on any
   <img> until script.js marks it .loaded (or .no-loading-indicator
   opts it out). Self-contained SVG spinner, so no extra DOM nodes
   are needed and no layout is disturbed. */
img:not(.no-loading-indicator):not(.loaded) {
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Ccircle cx='25' cy='25' r='19' fill='none' stroke='%23ffd77c' stroke-width='6'/%3E%3Cpath d='M25 6 a19 19 0 0 1 19 19' fill='none' stroke='%23cf4538' stroke-width='6' stroke-linecap='round'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.85s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 26px 26px;
  min-height: 24px;
}
img.loaded { background: none; }
@media (prefers-reduced-motion: reduce) {
  img:not(.no-loading-indicator):not(.loaded) { background-image: none; }
}

::selection { background: var(--yellow); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Typography ---------- */
h1, h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--red-dark);
}
h3, h4 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "+";
  color: var(--red);
  font-weight: 800;
  font-size: 1.2em;
  line-height: 1;
}

.lede {
  font-size: clamp(17px, 1.6vw, 20px);
  color: var(--muted);
  max-width: 60ch;
}

/* ---------- Confetti divider (replaces the old checkerboard bar) ---------- */
.checker-divider {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: transparent;
}
.checker-divider::before,
.checker-divider::after { content: none; }
.checker-divider {
  background-image: radial-gradient(circle, var(--red) 3.5px, transparent 3.6px),
                     radial-gradient(circle, var(--yellow) 3.5px, transparent 3.6px),
                     radial-gradient(circle, var(--blue) 3.5px, transparent 3.6px);
  background-size: 54px 20px;
  background-position: 0 center, 18px center, 36px center;
  background-repeat: repeat-x;
  opacity: 0.9;
}

/* ---------- Nav ---------- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: color-mix(in srgb, var(--cream) 94%, transparent);
  backdrop-filter: blur(10px);
}
.site-nav .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  color: var(--red-dark);
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.brand .dot { color: var(--red); }

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0; padding: 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  background: var(--surface);
  border: 1.5px solid var(--red);
  border-radius: 100px;
}
.nav-links a {
  position: relative;
  padding: 9px 18px;
  border-radius: 100px;
  color: var(--ink);
  display: inline-block;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-links a:hover { background: var(--pink); }
.nav-links a[aria-current="page"] { background: var(--red); color: #fff; }

.nav-right { display: flex; align-items: center; gap: 14px; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 32px; height: 22px;
  position: relative;
}
.nav-toggle span {
  position: absolute; left: 0; right: 0; height: 2px;
  border-radius: 2px;
  background: var(--ink); transition: transform .25s ease, opacity .25s ease;
}
.nav-toggle span:nth-child(1){ top: 0; }
.nav-toggle span:nth-child(2){ top: 10px; }
.nav-toggle span:nth-child(3){ top: 20px; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: var(--nav-h); left: var(--gutter); right: var(--gutter);
    background: var(--surface);
    border: 1.5px solid var(--red);
    border-radius: var(--radius-sm);
    flex-direction: column;
    gap: 2px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    box-shadow: var(--shadow);
  }
  .nav-links.open { max-height: 320px; margin-top: 8px; padding: 8px; }
  .nav-links a { display: block; padding: 12px 16px; border-radius: var(--radius-sm); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: 100px;
  cursor: pointer;
  background: transparent;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease, box-shadow .2s ease;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px rgba(226, 80, 61, 0.28); }
.btn-primary:hover { background: var(--red-dark); transform: translateY(-2px); }
.btn-ghost { border-color: var(--red); color: var(--red-dark); }
.btn-ghost:hover { background: var(--pink); border-color: var(--pink); transform: translateY(-2px); }
.btn-arrow { transition: transform 0.25s ease; }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* ---------- Ledger stat strip (signature motif) — now candy-coloured pills ---------- */
.ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  border: none;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.ledger-cell {
  flex: 1 1 150px;
  padding: 26px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--pink);
}
.ledger-cell:nth-of-type(4n+2) { background: var(--blue); }
.ledger-cell:nth-of-type(4n+3) { background: var(--yellow); }
.ledger-cell:nth-of-type(4n+4) { background: var(--surface); border: 1.5px solid var(--red); }
.ledger-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(26px, 3.6vw, 38px);
  color: var(--red-dark);
}
.ledger-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.72;
  margin-top: 8px;
}

/* ---------- Sections ---------- */
section { padding: clamp(56px, 8vw, 110px) 0; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 44px;
  flex-wrap: wrap;
}

/* ---------- Hero ---------- */
.hero {
  padding-top: calc(var(--nav-h) + clamp(20px, 3.4vw, 48px));
  padding-bottom: 0;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 3vw, 32px);
  align-items: stretch;
  padding-bottom: clamp(24px, 3.4vw, 40px);
}
.hero-grid > * { height: 100%; }
.hero-grid > div:first-child {
  background: var(--pink);
  border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 32px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero h1 {
  font-size: clamp(30px, 4.2vw, 54px);
  margin-top: 10px;
}
.hero .role-line {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(12px, 1.2vw, 14px);
  color: var(--ink);
  margin-top: 14px;
  letter-spacing: 0.01em;
}
.hero .sub {
  margin-top: 12px;
  color: var(--muted);
  max-width: 46ch;
  font-size: 15px;
}
.hero-cta { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.hero-grid > div:first-child .btn-ghost { border-color: var(--red-dark); }
.hero-grid > div:first-child .btn-ghost:hover { background: var(--surface); border-color: var(--surface); }

/* Hero portrait box — a thick, chunky "matte frame" in rust-red
   (the board) holding a lighter inset cream card (the collage
   canvas), echoing Rayo's red-panel-with-white-icon-grid pairing.
   The cream canvas only takes the bottom ~70% of the box, on
   purpose — the bare red strip left at top is dedicated space for
   larger stickers, not just a margin. */
.hero-photo {
  position: relative;
  background: var(--red);
  border: 3px solid var(--red-dark);
  border-radius: var(--radius);
  padding: clamp(14px, 2vw, 24px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Stickers live in that bare red header strip. Sized and inset like
   the .card ::before/::after badges elsewhere on the site — a clear
   margin from every edge, never flush against the board or the
   cream canvas below. */
.board-sticker {
  position: absolute;
  z-index: 6;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(43, 26, 16, 0.3));
}
.board-sticker-1 { top: 16px; right: 20px; font-size: 30px; color: var(--yellow); transform: rotate(-10deg); }
.board-sticker-2 { top: 20px; right: 68px; font-size: 18px; color: var(--cream); transform: rotate(12deg); }
.board-sticker-3 { top: 54px; right: 22px; font-size: 15px; color: var(--pink); transform: rotate(-8deg); }
.board-sticker-text {
  top: 14px;
  left: 16px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(12px, 1.3vw, 14px);
  color: var(--red-dark);
  background: var(--cream);
  padding: 5px 13px 6px;
  border-radius: 100px;
  transform: rotate(-6deg);
  box-shadow: 0 3px 6px rgba(43, 26, 16, 0.28);
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease;
}
.board-sticker-text:hover { transform: rotate(-6deg) scale(1.06); }
.board-sticker-text:active { transform: rotate(-6deg) scale(0.96); }

/* The cream canvas: a scrapbook surface, not a centered photo frame.
   Children are free-positioned .collage-item elements. */
.hero-photo-inner {
  background: var(--cream);
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  min-height: clamp(240px, 22vw, 300px);
}

.collage-item {
  position: absolute;
  cursor: grab;
  user-select: none;
  touch-action: none;
  rotate: var(--base-rot, 0deg);
  animation: collage-wiggle 1.8s ease-in-out infinite;
  animation-delay: var(--wiggle-delay, 0s);
  filter: drop-shadow(0 8px 16px rgba(43, 26, 16, 0.28));
}
.collage-item img { pointer-events: none; width: 100%; height: 100%; object-fit: contain; }
.collage-item.dragging { cursor: grabbing; animation-play-state: paused; z-index: 20; filter: drop-shadow(0 12px 20px rgba(43, 26, 16, 0.35)); }

/* Applied briefly by JS while a sticker "dodges" the cursor, so the
   left/top hop animates instead of teleporting. Removed again on
   drag-start so real dragging still tracks the pointer 1:1. */
.collage-item.dodging { transition: left 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.32s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 15; }

.collage-photo { width: clamp(100px, 14vw, 145px); }
.collage-sticker-bow { width: clamp(50px, 6vw, 70px); }
.collage-sticker-button { width: clamp(34px, 4vw, 46px); animation: collage-spin 3.4s linear infinite; }
.collage-sticker-phone { width: clamp(44px, 5.4vw, 62px); }
.collage-sticker-camera { width: clamp(38px, 4.6vw, 52px); }
.collage-sticker-yakult { width: clamp(20px, 2.4vw, 28px); }

@keyframes collage-wiggle {
  0%, 100% { rotate: var(--base-rot, 0deg); }
  50% { rotate: calc(var(--base-rot, 0deg) + 7deg); }
}
@keyframes collage-spin {
  from { rotate: 0deg; }
  to { rotate: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  .collage-item { animation: none; }
}

/* ---------- Placeholder media blocks ---------- */
.ph {
  position: relative;
  background: var(--pink);
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  aspect-ratio: var(--ratio, 4/3);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  isolation: isolate;
}
.card .ph:nth-of-type(1) { border-radius: var(--radius) var(--radius) 0 0; }
.proj-grid .ph, .card-grid .ph {}
.card-grid .card:nth-of-type(4n+1) .ph,
.proj-grid .card:nth-of-type(4n+1) .ph { background: var(--pink); }
.card-grid .card:nth-of-type(4n+2) .ph,
.proj-grid .card:nth-of-type(4n+2) .ph { background: var(--blue); }
.card-grid .card:nth-of-type(4n+3) .ph,
.proj-grid .card:nth-of-type(4n+3) .ph { background: var(--yellow); }
.card-grid .card:nth-of-type(4n+4) .ph,
.proj-grid .card:nth-of-type(4n+4) .ph { background: #f6e4c7; }

.visuals-grid .ph { border-radius: var(--radius-sm); }
.visuals-grid .ph:nth-of-type(4n+1) { background: var(--pink); }
.visuals-grid .ph:nth-of-type(4n+2) { background: var(--blue); }
.visuals-grid .ph:nth-of-type(4n+3) { background: var(--yellow); }
.visuals-grid .ph:nth-of-type(4n+4) { background: #f6e4c7; }

.ph::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.5;
}
.ph::after { content: none; }
.ph-tag {
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  padding: 10px 14px;
  width: 100%;
}

/* decorative badge + heart, echoing the reference's product-card overlays */
.card { position: relative; }
.card::before {
  content: "\2726";
  position: absolute;
  top: 16px; left: 16px;
  z-index: 3;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(43,26,16,0.18);
}
.card::after {
  content: "\2661";
  position: absolute;
  top: 16px; right: 16px;
  z-index: 3;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--red);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(43,26,16,0.14);
}

/* Text-only card variant — no image, so skip the photo-overlay badges
   and swap in a coloured top edge as the visual accent instead. */
.card--text {
  border-top-width: 6px;
  border-top-style: solid;
  border-top-color: var(--pink);
}
.card--text:nth-child(4n+1) { border-top-color: var(--pink); }
.card--text:nth-child(4n+2) { border-top-color: var(--blue); }
.card--text:nth-child(4n+3) { border-top-color: var(--yellow); }
.card--text:nth-child(4n+4) { border-top-color: #f6e4c7; }
.card--text .card-body { padding-top: 52px; }

/* ---------- Featured / project cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  background: transparent;
  border: none;
}
.card {
  background: var(--surface);
  padding: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(43,26,16,0.14); }
.card-body { padding: 24px 26px 28px; flex: 1; display: flex; flex-direction: column; }
.card-field {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 10px;
}
.card h3 {
  font-size: 21px;
  margin-bottom: 8px;
}
.card p {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 18px;
  flex: 1;
}
.card-link {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  padding-top: 4px;
  transition: gap 0.2s ease, color 0.2s ease;
}
.card:hover .card-link { gap: 13px; color: var(--red); }

@media (max-width: 860px) {
  .card-grid { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
}

/* ---------- Projects index grid ---------- */
.proj-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  background: transparent;
  border: none;
}
@media (max-width: 980px) { .proj-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .proj-grid { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer {
  border-top: none;
  padding: clamp(40px, 6vw, 64px) 0 clamp(56px, 7vw, 80px);
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  background: var(--red);
  border-radius: var(--radius);
  padding: clamp(28px, 4vw, 40px) clamp(26px, 4vw, 44px);
}
.footer-links { display: flex; gap: 10px; font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; }
.footer-links a { padding: 8px 14px; border-radius: 100px; color: #fff; transition: background .2s ease; }
.footer-links a:hover { background: rgba(255,255,255,0.18); }
.footer-fine { color: rgba(255,255,255,0.78); font-size: 12.5px; font-family: var(--font-mono); }

/* ---------- Reveal-on-scroll ----------
   Visible by default (no-JS / JS-blocked safe). */
.reveal {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.pending { opacity: 0; transform: translateY(18px); }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- Utility: candy pill tags ---------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--pink);
  border: 1.5px solid var(--red);
  border-radius: 100px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tag:nth-of-type(3n+2) { background: var(--blue); }
.tag:nth-of-type(3n+3) { background: var(--yellow); }
.tag:hover { background: var(--red); color: #fff; }

hr.rule { border: none; border-top: 1px solid var(--line); margin: 0; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(30px, 6vw, 70px);
}
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.pill-toggle-wrap { display:flex; align-items:center; }

/* ---------- CTA colour-block panel (Rayo-style bold closing panels) ---------- */
.cta-panel {
  position: relative;
  background: var(--yellow);
  border-radius: var(--radius);
  padding: clamp(32px, 5vw, 56px) clamp(28px, 4vw, 48px);
}
.cta-panel h2 { color: var(--red-dark); }
.cta-panel .eyebrow { color: var(--red-dark); opacity: 0.75; }

/* ---------- Utility: tiny retro sparkle glyphs, sprinkled in corners ---------- */
.deco-sparkle {
  position: absolute;
  top: 14px; right: 20px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--red-dark);
  opacity: 0.7;
  pointer-events: none;
}
