/* ==========================================================
   Jesse's Homepage - styles
   Colours live at the top. Change them here and the whole
   site changes.
   ========================================================== */

:root {
  --bg: #FFF4DC;
  --paper: #FFFFFF;
  --ink: #1B1B3A;
  --soft: #4A4A6A;
  --shadow: #1B1B3A;
  --dots: rgba(27, 27, 58, .09);

  /* bright colours (always used with dark text on top) */
  --coral: #FF6B6B;
  --sun: #FFC83D;
  --lime: #C8F03C;
  --mint: #3DDBB0;
  --sky: #6FB6FF;
  --grape: #B79CFF;
  --on-bright: #1B1B3A;

  --court: #3E8EDE;
  --court-line: #FFFFFF;

  --r: 22px;
  --line: 3px;
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "Nunito", "Quicksand", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14142B;
    --paper: #22224A;
    --ink: #F6F2FF;
    --soft: #C3C0E0;
    --shadow: #000000;
    --dots: rgba(255, 255, 255, .07);
    --court: #2B5FA8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14142B;
  --paper: #22224A;
  --ink: #F6F2FF;
  --soft: #C3C0E0;
  --shadow: #000000;
  --dots: rgba(255, 255, 255, .07);
  --court: #2B5FA8;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dots) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 8px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--sun); color: var(--on-bright);
  padding: 10px 14px; border-radius: 12px; font-weight: 800;
  border: var(--line) solid var(--on-bright);
}
.skip:focus { top: 12px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 10px; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  width: min(1080px, calc(100% - 24px));
  margin: 10px auto 0;
  padding: 8px 10px;
  background: var(--paper);
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--shadow);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 900; font-size: 1.15rem; letter-spacing: -.02em; }
.logo-j {
  display: grid; place-items: center; width: 36px; height: 36px;
  background: var(--coral); color: var(--on-bright);
  border: var(--line) solid var(--ink); border-radius: 50%;
  transform: rotate(-8deg); transition: transform .25s;
}
.logo:hover .logo-j { transform: rotate(8deg) scale(1.08); }
.top nav { display: flex; gap: 2px; margin-left: auto; }
.top nav a {
  text-decoration: none; font-weight: 800; font-size: .95rem;
  padding: 8px 12px; border-radius: 999px;
}
.top nav a:hover { background: var(--lime); color: var(--on-bright); }
.theme-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  background: var(--sun); color: var(--on-bright);
  border: var(--line) solid var(--ink); border-radius: 50%;
  cursor: pointer; padding: 0;
}
.theme-btn svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn:hover { transform: rotate(20deg); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- layout ---------- */
main { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }
section { padding: 44px 0 12px; }
.grid { display: grid; gap: 22px; margin-top: 22px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(225px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

h2 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.1; letter-spacing: -.02em; }
.sticker {
  display: inline-block; padding: 8px 18px 10px;
  color: var(--on-bright);
  border: var(--line) solid var(--ink); border-radius: 16px;
  box-shadow: 5px 5px 0 var(--shadow);
  transform: rotate(-2deg);
  font-weight: 900;
}
.s-coral { background: var(--coral); }
.s-sky { background: var(--sky); transform: rotate(1.5deg); }
.s-lime { background: var(--lime); transform: rotate(-1.5deg); }
.section-intro { margin-top: 18px; color: var(--soft); font-size: 1.1rem; font-weight: 600; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 36px; align-items: center;
  padding-top: 48px;
}
.hello {
  display: inline-block; font-weight: 900; font-size: 1rem;
  background: var(--grape); color: var(--on-bright);
  border: var(--line) solid var(--ink); border-radius: 999px;
  padding: 3px 14px; transform: rotate(-4deg); margin-bottom: 14px;
}
h1 { font-size: clamp(2.7rem, 9vw, 5rem); line-height: 1; letter-spacing: -.04em; font-weight: 900; }
.name {
  position: relative; display: inline-block; white-space: nowrap;
  background: linear-gradient(transparent 62%, var(--lime) 62%, var(--lime) 92%, transparent 92%);
  padding: 0 .08em;
}
:root[data-theme="dark"] .name { background: linear-gradient(transparent 62%, #6E8F10 62%, #6E8F10 92%, transparent 92%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .name { background: linear-gradient(transparent 62%, #6E8F10 62%, #6E8F10 92%, transparent 92%); }
}
.lead { margin-top: 20px; font-size: clamp(1.1rem, 2.4vw, 1.3rem); max-width: 34ch; font-weight: 600; }
.hero-btns { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }

.btn {
  display: inline-block; text-decoration: none; font-weight: 900;
  padding: 11px 20px; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  border: var(--line) solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform .12s, box-shadow .12s;
}
.btn-main { background: var(--sun); color: var(--on-bright); }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--shadow); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }

/* mini tennis court */
.court {
  position: relative; aspect-ratio: 5 / 4; width: 100%; max-width: 460px; justify-self: end;
  background: var(--court);
  border: var(--line) solid var(--ink); border-radius: 28px;
  box-shadow: 8px 8px 0 var(--shadow);
  transform: rotate(2deg);
  overflow: hidden;
}
.court-lines {
  position: absolute; inset: 9% 8% 15%;
  border: 3px solid var(--court-line); opacity: .9;
  background:
    linear-gradient(var(--court-line), var(--court-line)) 50% 0 / 3px 100% no-repeat,
    linear-gradient(var(--court-line), var(--court-line)) 0 50% / 100% 3px no-repeat;
}
.deco { position: absolute; fill: none; stroke: #1B1B3A; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.deco-star { width: 44px; top: 9%; left: 8%; fill: var(--sun); animation: wobble 5s ease-in-out infinite; }
.deco-zig { width: 70px; right: 6%; bottom: 20%; stroke: #fff; stroke-width: 4; }
.ball {
  position: absolute; left: 50%; top: 42%; width: 30%; aspect-ratio: 1;
  margin: -15% 0 0 -15%;
  background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%;
  animation: idle 2.4s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ball svg { width: 100%; height: 100%; overflow: visible; }
.ball-body { fill: var(--lime); stroke: #1B1B3A; stroke-width: 4; }
.ball-seam { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; }
.ball.hit { animation: hit .55s cubic-bezier(.3, .7, .4, 1); }
.ball-shadow {
  position: absolute; left: 50%; top: 68%; width: 24%; height: 5%; margin-left: -12%;
  background: rgba(0, 0, 0, .25); border-radius: 50%;
  animation: shadow 2.4s ease-in-out infinite;
}
.rally {
  position: absolute; left: 0; right: 0; bottom: 3.5%; text-align: center;
  font-weight: 900; color: #fff; font-size: 1.05rem;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9%); } }
@keyframes shadow { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.82); opacity: .7; } }
@keyframes hit {
  0% { transform: translateY(0) scale(1.08, .9) rotate(0); }
  45% { transform: translateY(-75%) scale(.96, 1.05) rotate(200deg); }
  100% { transform: translateY(0) scale(1) rotate(360deg); }
}
@keyframes wobble { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(14deg) scale(1.1); } }

/* ---------- cards ---------- */
.card {
  position: relative;
  background: var(--paper);
  border: var(--line) solid var(--ink); border-radius: var(--r);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 18px 20px 22px;
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translate(-2px, -3px) rotate(-.6deg); box-shadow: 9px 10px 0 var(--shadow); }
.card:nth-child(even):hover { transform: translate(-2px, -3px) rotate(.6deg); }
.card h3 { font-size: 1.4rem; font-weight: 900; letter-spacing: -.02em; margin-top: 14px; }
.card p { margin-top: 6px; color: var(--soft); font-weight: 500; }

.art, .piano, .printer, .term {
  width: 100%; height: 132px;
  border: var(--line) solid var(--ink); border-radius: 16px;
}
.art { padding: 8px; }
.like-tennis .art { background: var(--mint); }
.like-fencing .art { background: var(--grape); }
.like-swim .art { background: var(--sun); }
.gears { background: var(--sky); }

/* drawing helpers for the little pictures (always dark outlines on bright tiles) */
.st, .st-thin, .st-fat { fill: none; stroke: #1B1B3A; stroke-linecap: round; stroke-linejoin: round; }
.st { stroke-width: 3; }
.st-thin { stroke-width: 1.8; }
.st-fat { stroke-width: 6; }
.f-ink { fill: #1B1B3A; }
.f-paper { fill: #fff; }
.f-lime { fill: var(--lime); }
.f-sun { fill: var(--sun); }
.f-coral { fill: var(--coral); }
.f-sky { fill: var(--sky); }
.f-mint { fill: var(--mint); }
.spark { stroke: #fff; stroke-width: 3; animation: spark 1.6s ease-in-out infinite; transform-origin: 60px 40px; }
.shine { stroke: #fff; stroke-width: 2.5; }
@keyframes spark { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.1); } }

.wave { fill: none; stroke-width: 6; stroke-linecap: round; }
.w1 { stroke: #1F6FE0; animation: wave 3s linear infinite; }
.w2 { stroke: #fff; animation: wave 4.5s linear infinite reverse; }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(40px); } }

/* piano */
.piano {
  position: relative; display: grid; grid-template-columns: repeat(8, 1fr);
  background: #1B1B3A; padding: 10px 8px 8px; gap: 3px; overflow: hidden;
}
.piano button { border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.wk { background: #fff; border-radius: 0 0 7px 7px; height: 100%; }
.wk:hover { background: #FFF0B8; }
.wk.down, .wk:active { background: var(--sun); transform: translateY(2px); }
.bk {
  position: absolute; top: 10px; width: 8%; height: 56%; margin-left: -4%;
  background: #1B1B3A; border-radius: 0 0 5px 5px;
  box-shadow: inset 0 -5px 0 #45457A;
}
.bk.down, .bk:active { background: var(--coral); box-shadow: none; }
.b1 { left: calc(8px + (100% - 16px) * .125); }
.b2 { left: calc(8px + (100% - 16px) * .25); }
.b4 { left: calc(8px + (100% - 16px) * .5); }
.b5 { left: calc(8px + (100% - 16px) * .625); }
.b6 { left: calc(8px + (100% - 16px) * .75); }
.piano button:focus-visible { outline: 3px solid var(--coral); outline-offset: -3px; z-index: 2; }

/* 3D printer */
.printer { position: relative; background: var(--coral); overflow: hidden; }
.rail { position: absolute; left: 10%; right: 10%; top: 20px; height: 5px; background: #1B1B3A; border-radius: 3px; }
.nozzle {
  position: absolute; top: 14px; left: 50%; width: 22px; height: 26px; margin-left: -11px;
  background: #fff; border: 3px solid #1B1B3A; border-radius: 5px 5px 9px 9px;
  animation: nozzle 1.3s ease-in-out infinite alternate;
}
.nozzle::after {
  content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -4px;
  border: 4px solid transparent; border-top: 7px solid #1B1B3A; border-bottom: 0;
}
.bed { position: absolute; left: 18%; right: 18%; bottom: 12px; height: 7px; background: #1B1B3A; border-radius: 4px; }
.layers {
  position: absolute; left: 0; right: 0; bottom: 19px;
  display: flex; flex-direction: column-reverse; align-items: center;
}
.layers i {
  display: block; height: 10px; background: var(--lime);
  border: 2px solid #1B1B3A; border-radius: 4px; margin-top: -2px;
  animation: layer 8s ease-out infinite backwards;
}
.layers i:nth-child(1) { width: 78px; animation-delay: 0s; }
.layers i:nth-child(2) { width: 70px; animation-delay: .9s; }
.layers i:nth-child(3) { width: 58px; animation-delay: 1.8s; background: var(--sun); }
.layers i:nth-child(4) { width: 46px; animation-delay: 2.7s; }
.layers i:nth-child(5) { width: 32px; animation-delay: 3.6s; background: var(--sun); }
.layers i:nth-child(6) { width: 18px; animation-delay: 4.5s; }
@keyframes nozzle { from { transform: translateX(-42px); } to { transform: translateX(42px); } }
@keyframes layer {
  0% { opacity: 0; transform: scaleX(0); }
  8% { opacity: 1; transform: scaleX(1); }
  90% { opacity: 1; transform: scaleX(1); }
  96%, 100% { opacity: 0; transform: scaleX(1); }
}

/* chat / terminal */
.term { background: #1B1B3A; color: #F6F2FF; font-family: var(--mono); font-size: .8rem; padding: 0 12px; overflow: hidden; }
.term-bar { display: flex; gap: 6px; padding: 10px 0 6px; }
.term-bar b { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); }
.term-bar b:nth-child(2) { background: var(--sun); }
.term-bar b:nth-child(3) { background: var(--mint); }
.card .term p { color: #F6F2FF; margin-top: 4px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.who { display: inline-block; min-width: 2.2em; font-weight: 800; }
.who.me { color: var(--lime); }
.who.ai { color: var(--sky); }
.cursor { display: inline-block; width: .55em; height: 1em; margin-left: 3px; vertical-align: -2px; background: var(--lime); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* gears */
.gear { transform-box: fill-box; transform-origin: center; }
.teeth { fill: none; stroke: #1B1B3A; stroke-width: 9; stroke-dasharray: 1 1; }
.g1 { animation: spin 10s linear infinite; }
.g2 { animation: spin 7s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- project cards ---------- */
.project { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.project-top {
  display: grid; place-items: center; height: 150px;
  border-bottom: var(--line) solid var(--ink);
  font-size: 4.2rem; line-height: 1;
  background-color: var(--tile, var(--sun));
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, .35) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .35) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, .35) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .35) 75%);
  background-size: 36px 36px; background-position: 0 0, 18px 18px;
}
.project-top span { filter: drop-shadow(3px 4px 0 rgba(27, 27, 58, .35)); transition: transform .25s; }
.project:hover .project-top span { transform: rotate(-12deg) scale(1.15); }
.project-top.has-image { height: auto; aspect-ratio: 3 / 1; background-image: none; }
.project-top.has-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.project-body { display: flex; flex-direction: column; flex: 1; padding: 16px 20px 22px; }
.project-num { font-family: var(--mono); font-size: .8rem; font-weight: 700; color: var(--soft); letter-spacing: .06em; }
.card.project h3 { margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.tags li {
  font-size: .78rem; font-weight: 800; padding: 2px 10px; border-radius: 999px;
  border: 2px solid var(--ink);
}
.project .btn { align-self: flex-start; margin-top: 18px; }
.project-body .spacer { flex: 1; }
.tile-coral { --tile: var(--coral); }
.tile-sun { --tile: var(--sun); }
.tile-lime { --tile: var(--lime); }
.tile-mint { --tile: var(--mint); }
.tile-sky { --tile: var(--sky); }
.tile-grape { --tile: var(--grape); }

.soon { border-style: dashed; box-shadow: none; background: transparent; }
.soon:hover { box-shadow: none; }
.soon .project-top { background: transparent; border-bottom-style: dashed; color: var(--ink); }
.soon .project-top span { animation: wobble 4s ease-in-out infinite; filter: none; }

/* ---------- footer, toast, confetti ---------- */
footer { text-align: center; padding: 56px 16px 44px; font-weight: 700; }
footer .tiny { margin-top: 6px; font-size: .9rem; color: var(--soft); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 40;
  transform: translate(-50%, 150%);
  background: var(--sun); color: var(--on-bright); font-weight: 900; text-align: center;
  padding: 12px 20px; border: var(--line) solid #1B1B3A; border-radius: 16px;
  box-shadow: 5px 5px 0 var(--shadow);
  width: max-content; max-width: calc(100% - 32px); visibility: hidden;
  transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), visibility 0s .35s;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .35s cubic-bezier(.3, 1.4, .5, 1); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translate(var(--dx, 0), 110vh) rotate(var(--rot, 720deg)); }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 30px; padding-top: 34px; }
  .court { justify-self: center; max-width: 380px; }
  .lead { max-width: none; }
  section { padding-top: 36px; }
}
@media (max-width: 430px) {
  .logo-text { display: none; }
  .top nav a { padding: 8px 9px; font-size: .9rem; }
  .top nav { margin-left: auto; }
}

/* ---------- people who prefer less movement ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card:hover, .btn:hover { transform: none; }
}
