/* ===== Portfolio — public site ===== */
:root {
  --bg: #F3E3C3; --text: #3B2314; --muted: #6E4F35; --accent: #4A2412; --accent-text: #FBF3E4;
  --highlight: #9A4E1A; --card-rgb: 255,249,238; --card-a: .25; --blur: 14px;
  --hover: rgba(233,184,114,.55); --dim: 0;
  --font-heading: 'Fraunces', Georgia, serif; --font-body: 'Inter', system-ui, sans-serif;
}
:root {
  --glass: rgba(var(--card-rgb), var(--card-a));
  --line: color-mix(in srgb, var(--text) 22%, transparent);
  --line-soft: color-mix(in srgb, var(--text) 12%, transparent);
  --inner: color-mix(in srgb, var(--text) 6%, transparent);
  --ease: cubic-bezier(.22,.8,.24,1);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; transition: background-color .35s ease;
}
a { color: var(--highlight); }
a:hover { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
/* normal arrow over text (not the typing I-beam); links/buttons keep the hand, fields keep the I-beam */
body { cursor: default; }
a[href], button, summary, label[for], select { cursor: pointer; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, [contenteditable="true"] { cursor: text; }
img, video { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; line-height: 1.12; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* background */
.bg { position: fixed; inset: 0; z-index: -1; background: var(--bg); overflow: hidden; }
.bg-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-dim { position: absolute; inset: 0; background: rgba(0,0,0,var(--dim)); pointer-events: none; }

/* ===== Day / Night scene (Theme → Background → Day / Night) ===== */
/* registered so the day ↔ night colours fade instead of jumping */
@property --text { syntax: "<color>"; inherits: true; initial-value: #3B2314; }
@property --muted { syntax: "<color>"; inherits: true; initial-value: #6E4F35; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #4A2412; }
@property --accent-text { syntax: "<color>"; inherits: true; initial-value: #FBF3E4; }
@property --highlight { syntax: "<color>"; inherits: true; initial-value: #9A4E1A; }
@property --glass { syntax: "<color>"; inherits: true; initial-value: rgba(255,249,238,.25); }
@property --hover { syntax: "<color>"; inherits: true; initial-value: rgba(233,184,114,.55); }
@property --bg { syntax: "<color>"; inherits: true; initial-value: #F3E3C3; }
@property --dim { syntax: "<number>"; inherits: true; initial-value: 0; }
:root[data-mood] {
  transition: --text var(--mood-fade, 1.4s) ease var(--mood-delay, 0s), --muted var(--mood-fade, 1.4s) ease var(--mood-delay, 0s), --accent var(--mood-fade, 1.4s) ease var(--mood-delay, 0s),
    --accent-text var(--mood-fade, 1.4s) ease var(--mood-delay, 0s), --highlight var(--mood-fade, 1.4s) ease var(--mood-delay, 0s), --glass var(--mood-fade, 1.4s) ease var(--mood-delay, 0s),
    --hover var(--mood-fade, 1.4s) ease var(--mood-delay, 0s), --bg var(--mood-fade, 1.4s) ease var(--mood-delay, 0s), --dim var(--mood-fade, 1.4s) ease var(--mood-delay, 0s);
}
.scene {
  /* the box keeps the picture's shape and covers the screen, so the sun and moon stay on their spot */
  --ar: 1.7768; --fx: 50; --W: max(100vw, calc(100vh * var(--ar))); --H: max(100vh, calc(100vw / var(--ar)));
  --x0: clamp(calc(100vw - var(--W)), calc(50vw - var(--W) * var(--fx) / 100), 0px);
  position: absolute; left: var(--x0); top: calc(50% - var(--H) / 2); width: var(--W); height: var(--H);
  container-type: size; overflow: hidden;
}
@media (max-aspect-ratio: 1/1) { .scene { --fx: var(--mfx, 50); } }
.sc-img { position: absolute; inset: 0; background: var(--bg) center / 100% 100% no-repeat; }
/* a picture is only fetched once its rule applies: the current mood's first, the other after load (.ld) */
:root[data-mood="day"] .sc-day, .sc-day.ld { background-image: var(--day-img); }
:root[data-mood="night"] .sc-night, .sc-night.ld { background-image: var(--night-img); }
.sc-night { opacity: 0; will-change: opacity; }
:root[data-mood="night"] .sc-night { opacity: 1; }
.sc-dusk {
  position: absolute; inset: 0; opacity: 0; pointer-events: none;
  background: radial-gradient(ellipse 70% 55% at calc(var(--hx, 22) * 1%) calc(var(--hy, 64) * 1%), rgba(255,146,92,.55), rgba(255,180,120,.18) 45%, transparent 75%);
}
.sc-sky {
  position: absolute; inset: 0; pointer-events: none;
  -webkit-mask-image: var(--mask, none); mask-image: var(--mask, none);
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
}
.sc-body {
  position: absolute; left: 0; top: 0; aspect-ratio: 1; will-change: transform, opacity;
  transform: translate(calc(var(--x) * 1cqw - 50%), calc(var(--y) * 1cqh - 50%));
}
.sc-body img { width: 100%; height: 100%; max-width: none; }
.sc-sun { width: calc(var(--ss, 14) * 1cqw); --x: var(--sx, 70); --y: var(--sy, 52); }
/* soft pastel halo, like the sun painted in the picture */
.sc-sun::before {
  content: ""; position: absolute; inset: -70%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(255,246,214,.75) 0, rgba(255,232,170,.35) 28%, rgba(255,220,150,0) 62%);
}
.sc-moon { width: calc(var(--ms, 11) * 1cqw); --x: var(--hx, 22); --y: var(--hy, 64); opacity: 0; }
.sc-moon::before {
  content: ""; position: absolute; inset: -60%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(190,210,255,.32) 0, rgba(150,180,255,.12) 35%, transparent 62%);
}
:root[data-mood="night"] .sc-sun { --x: var(--hx, 22); --y: var(--hy, 64); opacity: 0; }
:root[data-mood="night"] .sc-moon { --x: var(--mx, 50); --y: var(--my, 19); opacity: 1; }
.sc-twinkle { position: absolute; inset: 0; opacity: 0; }
:root[data-mood="night"] .sc-twinkle { opacity: 1; }
.sc-twinkle i {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 6px 1px rgba(255,255,255,.8); opacity: .2;
  animation: twinkle var(--t, 3s) ease-in-out var(--dl, 0s) infinite;
}
:root[data-mood="day"] .sc-twinkle i { animation-play-state: paused; }
@keyframes twinkle { 0%, 100% { opacity: .15; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
/* while day ↔ night changes, the cards and text step aside so the whole scene can be watched
   (opacity only: a transform here would move the fixed scroll bar) */
:root[data-mood] main, :root[data-mood] .site-footer { transition: opacity .55s ease, visibility 0s 0s; }
:root.mood-show main, :root.mood-show .site-footer {
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .45s ease, visibility 0s .45s;
}
/* ☀️ / 🌙 button: shows what a click will bring */
.mood-btn { position: relative; overflow: hidden; }
.mood-btn > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: transform .6s var(--ease), opacity .4s ease; }
.mb-sun { transform: translateY(120%) rotate(-90deg); opacity: 0; }
:root[data-mood="night"] .mb-moon { transform: translateY(-120%) rotate(90deg); opacity: 0; }
:root[data-mood="night"] .mb-sun { transform: none; opacity: 1; color: #FFD98A; }

/* glass */
.glass {
  position: relative; background: var(--glass);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--line);
}
.glass.spot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.22), transparent 45%);
  opacity: 0; transition: opacity .3s ease;
}
.glass.spot:hover::after { opacity: 1; }

/* ===== hero ===== */
.hero {
  /* height = its content, so the details start right after the main card (no empty screen gap) */
  position: relative;
  padding: 24px 40px 8px 24px;
  display: grid; grid-template-columns: 184px minmax(0, 1fr);
  grid-template-rows: 64px auto; column-gap: 16px; row-gap: 16px;
}
.me-btn {
  grid-column: 1; grid-row: 1; height: 64px; padding: 0 6px; border-radius: 18px;
  display: flex; align-items: center; gap: 10px; text-align: left;
  border-color: transparent; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
  transition: background .3s ease, border-color .3s ease, transform .2s ease;
}
.me-btn[aria-pressed="true"] { background: var(--glass); border-color: var(--accent); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); }
.me-btn:hover { transform: translateY(-1px); }
.me-photo {
  width: 52px; height: 52px; flex: none; border-radius: 50%; overflow: hidden;
  border: 1.5px solid color-mix(in srgb, var(--text) 45%, transparent); background: var(--inner);
  display: flex; align-items: center; justify-content: center; color: var(--highlight);
}
.me-btn[aria-pressed="true"] .me-photo { border-color: var(--accent); }
.me-photo img, .me-photo video { width: 100%; height: 100%; object-fit: cover; }
/* small round avatar: zoom toward the face (anchored at the top so the hair isn't cut) — a full
   half-body photo squeezed into 52px left the face ~20px wide and looked broken */
.me-photo img { object-position: 50% 0%; transform: scale(1.4); transform-origin: 50% 4%; }
/* a separate icon image uploaded in Profile is already framed for the circle — show it as is */
.me-photo.own img { object-position: 50% 50%; transform: none; }
.me-name { font-family: var(--font-heading); font-weight: 600; font-size: 16px; line-height: 1.15; }

.catbar {
  grid-column: 2; grid-row: 1; height: 64px; border-radius: 18px; padding: 0 12px 0 16px;
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.cat-label { font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--muted); margin-right: 8px; flex: none; }
.cats { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 2px; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; flex: none;
  transition: background .25s ease, color .25s ease, border-color .25s ease, transform .15s ease;
}
.cat:hover { transform: translateY(-1px); border-color: var(--accent); }
.cat.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.cat-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: transparent;
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  transition: background .2s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--inner); color: var(--text); transform: translateY(-1px); }
.search { width: 0; overflow: hidden; transition: width .35s var(--ease); }
.search.open { width: 220px; }
.search input {
  width: 220px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--inner);
  padding: 0 12px; color: var(--text); font: inherit; font-size: 14px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

/* main card */
.main-card {
  grid-column: 2; grid-row: 2; border-radius: 20px; padding: 14px; min-height: 200px; overflow: hidden;
}
.view { display: flex; gap: 22px; height: 100%; }
.view[hidden] { display: none; }
.card-media {
  width: 240px; flex: none; border-radius: 14px; background: var(--inner); overflow: hidden; min-height: 172px;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.card-media > img, .card-media > video, .card-media > iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.card-media.fade > * { animation: mediaIn .5s var(--ease) both; }
/* profile photo opens full size in the image viewer */
.card-zoom { position: absolute; inset: 0; border-radius: inherit; }
.card-zoom img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--highlight);
  font-size: 13px; font-weight: 600; text-align: center; padding: 12px;
}
.card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.title-row { display: flex; align-items: baseline; gap: 14px; margin-top: 4px; min-width: 0; flex-wrap: wrap; row-gap: 2px; }
.card-title { font-size: 32px; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-weight: 500; font-size: 15px; color: var(--highlight); white-space: nowrap; }
.card-intro, .card-desc { margin: 6px 0 0; font-size: 14.5px; color: var(--text); max-width: 72ch; }
.card-intro p { margin: 0; }
.card-desc:empty { display: none; }
.link-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sq-btn {
  width: 44px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line-soft); background: var(--inner);
  display: inline-flex; align-items: center; justify-content: center; color: var(--highlight); overflow: hidden; padding: 0;
  transition: transform .2s var(--ease), border-color .2s ease;
}
.sq-btn:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent); }
.sq-btn.on { border: 2px solid var(--accent); }
.sq-btn img, .sq-btn video { width: 100%; height: 100%; object-fit: cover; }
.sq-btn:not(.on) img, .sq-btn:not(.on) video { opacity: .78; }
.small-muted { font-size: 12px; color: var(--muted); }
.card-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.foot-value { font-family: var(--font-heading); font-weight: 700; font-size: 22px; color: var(--highlight); }
.foot-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  height: 46px; padding: 0 22px; border-radius: 12px; font-size: 15px; font-weight: 700; text-decoration: none;
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; border: 1px solid transparent;
  transition: transform .2s var(--ease), box-shadow .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { color: var(--accent-text); box-shadow: 0 10px 24px -12px var(--accent); }
.btn-ghost { background: transparent; color: var(--text); border-color: color-mix(in srgb, var(--text) 45%, transparent); font-weight: 600; }
.btn-ghost:hover { color: var(--text); background: var(--inner); }
.btn[hidden] { display: none; }

/* project list */
.plist {
  /* taken out of the grid flow so it doesn't push the details down; it sits in the left gutter
     that .details leaves free (padding-left: 224px) */
  position: absolute; left: 24px; width: 184px; z-index: 2;
  top: calc(24px + 64px + 16px + clamp(16px, 13vh, 136px));
  height: min(420px, calc(100svh - 300px)); min-height: 260px;
  border-radius: 20px; padding: 14px 8px 8px; display: flex; flex-direction: column; gap: 6px;
}
/* desktop: scrolling down slides the list out to the left; scrolling up (anywhere) brings it back on screen;
   at the very top it sits in its own place (site.js toggles .tucked / .floating) */
@media (min-width: 861px) {
  .plist { transition: transform .6s var(--ease), opacity .45s ease, visibility 0s 0s; }
  .plist.tucked {
    transform: translateX(calc(-100% - 48px)); opacity: 0; visibility: hidden; pointer-events: none;
    transition: transform .6s var(--ease), opacity .45s ease .1s, visibility 0s .6s;
  }
  /* scrolling up anywhere: it comes back and stays on screen */
  .plist.floating { position: fixed; }
}
.plist-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 8px 4px; }
.plist-title { font-family: var(--font-heading); font-weight: 600; font-size: 16px; }
.plist-scroll {
  flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 16px 2px 16px 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.prow {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; text-align: left;
  transition: background .2s ease, border-color .2s ease, transform .2s var(--ease);
}
.prow:hover { background: var(--inner); transform: translateX(3px); }
.prow[aria-current="true"] { background: color-mix(in srgb, var(--text) 8%, transparent); border-color: var(--accent); }
.prow[hidden] { display: none; }
.prow.pop { animation: rowIn .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
.mono {
  width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--inner); overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 14px; color: var(--highlight);
  transition: transform .3s var(--ease);
}
.mono img { width: 100%; height: 100%; object-fit: cover; }
.prow:hover .mono { transform: rotate(-4deg) scale(1.05); }
.prow-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prow-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-cat { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist-empty { font-size: 13px; color: var(--muted); padding: 8px; margin: 0; }
/* mobile-only slide bar parts (shown in the ≤860px block) */
.plist-toggle, .plist-close, .plist-shade { display: none; }
.plist-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 24px; font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--line-soft); padding-top: 6px;
}

/* scroll indicator */
.scroll-ind {
  position: fixed; right: 14px; bottom: 40px; z-index: 5; width: 24px; height: min(360px, 40vh);
  display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted);
}
.scroll-word { font-size: 11px; font-weight: 600; letter-spacing: .18em; writing-mode: vertical-rl; }
.scroll-track { position: relative; width: 2px; flex: 1; border-radius: 1px; background: var(--line); overflow: hidden; }
.scroll-thumb { position: absolute; left: 0; top: 0; width: 2px; height: 28px; border-radius: 1px; background: var(--accent); transition: transform .1s linear; }
.scroll-ind svg { color: var(--text); animation: bob 1.8s ease-in-out infinite; }

/* ===== details ===== */
.details { padding: 24px 40px 80px 224px; max-width: 1440px; margin: 0 auto; scroll-margin-top: 16px; }
.dpanel[hidden] { display: none; }
.dpanel.show { animation: panelIn .55s var(--ease) both; }
.d-head { border-radius: 20px; padding: 22px 24px; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-end; }
.d-head-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.d-title { font-size: clamp(30px, 4vw, 48px); letter-spacing: -.01em; }
.d-desc { margin: 6px 0 0; max-width: 70ch; }
/* one project, several sides (Full Stack / Backend / DevOps): tabs switch which side is shown */
[data-part][hidden], .part-tabs[hidden] { display: none !important; }
.part-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.part-tab {
  min-height: 32px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: transparent; color: var(--text);
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .2s ease;
}
.part-tab:hover { transform: translateY(-1px); border-color: var(--accent); }
.part-tab.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.d-part-head { display: flex; flex-direction: column; gap: 4px; }
.d-part.show-part, .d-part-head.show-part { animation: partIn .45s var(--ease) both; }
@keyframes partIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.no-anim .d-part.show-part, .no-anim .d-part-head.show-part { animation: none; }
.d-links { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--inner); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600;
  transition: transform .2s var(--ease), border-color .2s ease;
}
a.chip:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.chip-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
a.chip-accent:hover { color: var(--accent-text); }
.chip-plain { background: transparent; font-weight: 500; }
.section-title { font-size: 26px; margin: 44px 0 14px; }
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; font-weight: 600; text-decoration: none; color: var(--text); font-size: 14px; }
.back-link:hover { color: var(--accent); }

.b { margin: 22px 0; }
.b-text {
  max-width: 860px; font-size: 17px; padding: 22px 26px; border-radius: 18px;
  background: var(--glass); backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--line-soft);
}
.rich h2 { font-size: 28px; margin: 1.1em 0 .4em; }
.rich h3 { font-size: 22px; margin: 1em 0 .35em; }
.rich h4 { font-size: 18px; margin: 1em 0 .3em; }
.rich > :first-child { margin-top: 0; }
.rich p { margin: 0 0 .8em; }
.rich ul, .rich ol { padding-left: 1.3em; margin: 0 0 .8em; }
.rich li { margin: .25em 0; }
.rich blockquote { margin: 1em 0; padding: 8px 16px; border-left: 3px solid var(--accent); background: var(--inner); border-radius: 0 10px 10px 0; }
.rich code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .9em; background: var(--inner); padding: 1px 6px; border-radius: 6px; }
.rich span[style*="background"] { padding: 0 .18em; border-radius: .25em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.b-media { margin-left: 0; margin-right: 0; }
.b-media img, .b-media video, .b-media iframe { width: 100%; border-radius: 16px; border: 0; background: var(--inner); }
.b-media iframe { aspect-ratio: 16 / 9; height: auto; }
.b-medium { max-width: 720px; }
.b-full img, .b-full video { max-height: 82vh; object-fit: contain; }
.b-cover img, .b-cover video { max-height: 62vh; object-fit: cover; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.zoom { padding: 0; border: 0; background: none; display: block; width: 100%; cursor: zoom-in; border-radius: 16px; overflow: hidden; }
.zoom img { transition: transform .6s var(--ease); }
.zoom:hover img { transform: scale(1.02); }

.grid-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.g-item { border-radius: 14px; overflow: hidden; background: var(--inner); }
.g-item img, .g-item video, .g-item iframe { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 0; border: 0; }
.g-item .zoom { border-radius: 0; }

.slider { position: relative; }
.slider-track {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; border-radius: 16px;
}
.slider-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; position: relative; border-radius: 16px; overflow: hidden; background: var(--inner); }
.slide img, .slide video, .slide iframe { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0; border: 0; }
.slide .zoom { border-radius: 0; }
.slide-cap { position: absolute; left: 12px; bottom: 12px; padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; }
.sl-btn {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.sl-prev { left: 10px; } .sl-next { right: 10px; }
.sl-dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.sl-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: width .3s var(--ease), background .3s; }
.sl-dots span.on { width: 22px; border-radius: 4px; background: var(--accent); }

/* picture viewer: big picture + a strip of small ones (media blocks next to each other) */
.b-viewer { margin-left: 0; margin-right: 0; }
.vw-stage {
  position: relative; display: grid; aspect-ratio: 16 / 10; max-height: 78vh; width: 100%;
  border-radius: 18px; overflow: hidden; background: var(--glass); border: 1px solid var(--line-soft);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur)); outline-offset: 3px;
}
.vw-slide {
  grid-area: 1 / 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: scale(1.015);
  transition: opacity .45s ease, transform .6s var(--ease), visibility 0s .45s;
}
.vw-slide.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .45s ease, transform .6s var(--ease), visibility 0s 0s; }
.vw-slide .zoom { width: 100%; height: 100%; border-radius: 0; display: flex; align-items: center; justify-content: center; }
.vw-slide img, .vw-slide video { width: 100%; height: 100%; object-fit: contain; border: 0; border-radius: 0; background: transparent; }
.vw-slide iframe { width: 100%; height: 100%; border: 0; }
.vw-cap {
  position: absolute; left: 14px; bottom: 14px; max-width: calc(100% - 120px); padding: 5px 12px; border-radius: 10px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 13px; pointer-events: none;
}
.vw-count {
  position: absolute; right: 14px; bottom: 14px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(0,0,0,.5); color: #fff; pointer-events: none; font-variant-numeric: tabular-nums;
}
.b-viewer .sl-btn { z-index: 2; opacity: .85; transition: opacity .2s ease, transform .2s ease; }
.vw-prev { left: 12px; } .vw-next { right: 12px; }
.b-viewer .sl-btn:hover { opacity: 1; }
.vw-thumbs {
  display: flex; gap: 10px; margin-top: 12px; padding: 4px 2px 6px; overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.vw-thumb {
  position: relative; flex: none; width: 104px; aspect-ratio: 4 / 3; padding: 0; border-radius: 12px; overflow: hidden;
  border: 2px solid transparent; background: var(--inner); opacity: .62; scroll-snap-align: start;
  transition: opacity .25s ease, border-color .25s ease, transform .2s ease;
}
.vw-thumb:hover { opacity: .9; transform: translateY(-2px); }
.vw-thumb.is-on { opacity: 1; border-color: var(--accent); }
.vw-thumb img, .vw-thumb video { width: 100%; height: 100%; object-fit: cover; border-radius: 0; border: 0; pointer-events: none; }
.vw-thumb .m-ico { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; color: var(--muted); }
.vw-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff;
  background: rgba(0,0,0,.25); pointer-events: none;
}
.vw-thumb:has(.m-ico) .vw-play { display: none; }

.pindex { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pcard { border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: transform .3s var(--ease); }
.pcard:hover { transform: translateY(-3px); }
.pcard-top { display: flex; gap: 12px; align-items: center; }
.pcard-name { font-weight: 700; }
.pcard-desc { margin: 0; font-size: 14px; }
.pcard-links { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.pcard-links .chip { min-height: 36px; font-size: 13px; }

.pn-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 40px; }
.pn { border-radius: 16px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); font-weight: 600; transition: transform .25s var(--ease); }
.pn:hover { color: var(--text); transform: translateY(-2px); }
.pn small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.pn-next { justify-content: flex-end; text-align: right; }

/* word hover */
.hw { border-radius: .22em; transition: background-color .18s ease, box-shadow .18s ease; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hw:hover, .hw.tap { background-color: var(--hover) !important; box-shadow: 0 0 0 .12em var(--hover); }

/* lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 92vh; overflow: visible; }
.lightbox::backdrop { background: rgba(10,6,3,.78); backdrop-filter: blur(4px); }
.lightbox img { max-width: 94vw; max-height: 84vh; border-radius: 14px; margin: 0 auto; }
.lightbox p { color: #f3ece2; text-align: center; margin: 10px 0 0; font-size: 14px; }
.lightbox[open] img { animation: zoomIn .35s var(--ease) both; }
.lb-close { position: fixed; top: 16px; right: 16px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; }

/* footer */
.site-footer {
  padding: 28px 40px 28px 224px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-soft); max-width: 1440px; margin: 0 auto;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* error page */
.error-wrap { min-height: 70vh; display: grid; place-items: center; padding: 24px; }
.error-card { border-radius: 20px; padding: 32px; max-width: 520px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.error-page .site-footer { padding-left: 40px; }

/* ===== motion ===== */
.rise { animation: rise .8s var(--ease) both; animation-delay: calc(var(--d, 0) * 90ms + 80ms); }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.swap-in > .card-info > * { animation: rise .5s var(--ease) both; }
.swap-in > .card-info > *:nth-child(2) { animation-delay: 40ms; }
.swap-in > .card-info > *:nth-child(3) { animation-delay: 80ms; }
.swap-in > .card-info > *:nth-child(4) { animation-delay: 120ms; }
.swap-in > .card-info > *:nth-child(5) { animation-delay: 160ms; }
.swap-in > .card-media { animation: mediaIn .55s var(--ease) both; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes mediaIn { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
@keyframes panelIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

.no-anim *, .no-anim *::before, .no-anim *::after { animation: none !important; transition: none !important; }
.no-anim .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ===== tablet ===== */
@media (max-width: 1100px) {
  .card-media { width: 200px; }
  .card-title { font-size: 28px; }
  .foot-value { font-size: 19px; }
  .scroll-ind { display: none; }
}

/* ===== mobile: same design, smaller; projects become a strip at the bottom ===== */
@media (max-width: 860px) {
  .hero { display: flex; flex-direction: column; padding: 12px 12px 14px; gap: 12px; min-height: 100svh; }
  .me-btn { order: 1; } .catbar { order: 2; } .plist-toggle { order: 3; } .main-card { order: 4; }
  .me-btn { grid-column: 1; grid-row: 1; height: 56px; width: max-content; max-width: 100%; }
  .me-photo { width: 44px; height: 44px; }
  .catbar { grid-column: 1; grid-row: 2; height: 56px; padding: 0 6px 0 8px; border-radius: 16px; }
  .cat-label { display: none; }
  .cats { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); padding-right: 20px; }
  .cat { height: 38px; padding: 0 14px; font-size: 13px; }
  .search.open { width: 150px; }
  .search input { width: 150px; }
  .cat-tools .icon-btn[href] { display: none; }
  .main-card { grid-column: 1; grid-row: 3; padding: 10px; border-radius: 18px; }
  .view { flex-direction: column; gap: 12px; }
  .card-media { width: 100%; min-height: 0; aspect-ratio: 16 / 10; }
  .card-media:has(.media-empty) { aspect-ratio: auto; height: 120px; }
  .card-title { font-size: 24px; white-space: normal; }
  .card-sub { font-size: 14px; }
  .foot-value { font-size: 18px; }
  .card-foot { gap: 12px; }
  .foot-actions { width: 100%; }
  .foot-actions .btn { flex: 1; justify-content: center; padding: 0 14px; }
  /* ☰ Projects button, under "All" */
  .plist-toggle {
    display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; height: 42px; margin-top: -4px;
    padding: 0 12px 0 10px; border-radius: 14px; color: var(--text); font-size: 14px; font-weight: 600;
    transition: transform .15s ease, border-color .2s ease;
  }
  .plist-toggle:active { transform: scale(.97); }
  .plist-toggle[aria-expanded="true"] { border-color: var(--accent); }
  .pt-count {
    min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--accent-text);
    font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  }

  /* project slide bar: comes in from the left, hides again after a project is picked */
  .plist {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 71; width: min(82vw, 320px); height: auto; min-height: 0; margin: 0;
    padding: calc(14px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
    border-radius: 0 22px 22px 0; border-left: 0;
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    transform: translateX(calc(-100% - 24px)); visibility: hidden;
    transition: transform .38s var(--ease), visibility 0s .38s;
  }
  .plist.rise { animation: none; }
  .plist.open {
    transform: none; visibility: visible; box-shadow: 18px 0 50px -24px rgba(0,0,0,.55);
    transition: transform .38s var(--ease), visibility 0s 0s;
  }
  .plist-head { align-items: center; gap: 8px; padding: 0 2px 6px 6px; }
  .plist-head .small-muted { margin-left: auto; }
  .plist-close { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; }
  .plist-scroll { padding: 10px 2px 16px 0; gap: 6px; overscroll-behavior: contain; }
  .prow { padding: 8px; border-color: var(--line-soft); }
  .prow:hover { transform: none; }
  .prow-name { font-size: 14px; }
  .plist-foot { display: none; }
  .plist-shade {
    display: block; position: fixed; inset: 0; z-index: 70; background: rgba(10,8,6,.42);
    opacity: 0; pointer-events: none; transition: opacity .3s ease;
  }
  .plist-shade.on { opacity: 1; pointer-events: auto; }
  body.drawer-open { overflow: hidden; }
  .details { padding: 20px 12px 56px; }
  .d-head { padding: 18px; }
  .section-title { font-size: 22px; margin-top: 32px; }
  .b-text { font-size: 16px; padding: 16px 16px; }
  .pn-nav { grid-template-columns: 1fr; }
  .site-footer { padding: 20px 12px 90px; }
  .slide img, .slide video, .slide iframe { aspect-ratio: 4 / 3; }
  .vw-stage { aspect-ratio: 4 / 3; border-radius: 14px; }
  .vw-thumb { width: 78px; border-radius: 10px; }
  .b-viewer .sl-btn { width: 38px; height: 38px; }
}

/* ===== "Play with Rafi" card (bottom-right, over the desk in the picture) ===== */
.play-card {
  position: fixed; right: 56px; bottom: 28px; z-index: 6; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px 12px 12px; border-radius: 20px; color: var(--text); text-align: left; cursor: pointer;
  box-shadow: 0 18px 40px -20px rgba(0,0,0,.45); animation: pcIn .8s var(--ease) 1.2s backwards;
  transition: transform .3s var(--ease), box-shadow .3s ease;
}
.play-card:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 24px 50px -20px rgba(0,0,0,.5); }
.play-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pc-icons { display: grid; grid-template-columns: repeat(2, 26px); gap: 4px; }
.pc-icons i {
  width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 15px; background: var(--inner); transition: transform .35s var(--ease);
}
.play-card:hover .pc-icons i:nth-child(1) { transform: translate(-2px, -2px) rotate(-8deg); }
.play-card:hover .pc-icons i:nth-child(2) { transform: translate(2px, -2px) rotate(10deg); }
.play-card:hover .pc-icons i:nth-child(3) { transform: translate(-2px, 2px) rotate(6deg); }
.play-card:hover .pc-icons i:nth-child(4) { transform: translate(2px, 2px) rotate(-10deg); }
.pc-text { display: flex; flex-direction: column; gap: 2px; }
.pc-text b { font-family: var(--font-heading); font-size: 16px; }
.pc-text small { font-size: 11.5px; color: var(--muted); }
.pc-mini { display: none; }
@keyframes pcIn { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) {
  .play-card { right: 14px; bottom: 16px; padding: 0; width: 56px; height: 56px; border-radius: 50%; justify-content: center; }
  .play-card .pc-icons, .play-card .pc-text { display: none; }
  .pc-mini { display: block; font-size: 26px; }
}

.play-dlg {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100svh - 24px); padding: 0; border: 1px solid var(--line-soft);
  border-radius: 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--text);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 30px 80px -30px rgba(0,0,0,.6);
}
.play-dlg[open] { animation: dlgIn .35s var(--ease) both; }
.play-dlg::backdrop { background: rgba(10,8,6,.45); backdrop-filter: blur(3px); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.play-dlg form { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.play-dlg h2 { margin: 0; font-family: var(--font-heading); font-size: 22px; padding-right: 36px; }
.play-dlg p { margin: 0; }
.pd-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--text); display: flex; align-items: center; justify-content: center; }
.pd-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pd-pick input { position: absolute; opacity: 0; pointer-events: none; }
.pd-pick span {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px;
  border: 1.5px solid var(--line); font-size: 13px; font-weight: 600; text-align: center; cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.pd-pick i { font-style: normal; font-size: 26px; line-height: 1; }
.pd-pick label:hover span { transform: translateY(-2px); }
.pd-pick input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pd-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pd-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pd-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.pd-fields small { font-weight: 400; color: var(--muted); }
.pd-fields .pd-wide { grid-column: 1 / -1; }
.pd-fields input, .pd-fields textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--inner); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; min-height: 42px; resize: vertical;
}
.pd-err { color: #c0392b; font-size: 14px; } .pd-ok { font-size: 14px; color: var(--highlight); }
.pd-err[hidden], .pd-ok[hidden] { display: none; }
.pd-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* CV download box (bot check) */
.cv-dlg { width: min(420px, calc(100vw - 32px)); }
.cv-in { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.cv-dlg h2 { display: flex; align-items: center; gap: 8px; }
.cv-ts { min-height: 65px; display: flex; justify-content: center; }
.cv-ts[hidden], .cv-dlg [hidden] { display: none !important; }
@media (max-width: 520px) {
  .pd-pick { grid-template-columns: repeat(2, 1fr); }
  .pd-fields { grid-template-columns: 1fr; }
}

/* first visits: note under the ☀️/🌙 button */
.mood-hint {
  position: absolute; z-index: 40; display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-text); box-shadow: 0 14px 30px -12px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(8px) scale(.96); transition: opacity .35s ease, transform .45s var(--ease);
  pointer-events: none;
}
.mood-hint.in { opacity: 1; transform: none; pointer-events: auto; animation: hintBob 2.2s ease-in-out .6s infinite; }
.mood-hint::before {
  content: ""; position: absolute; top: -6px; left: calc(var(--ax, 50%) - 7px); width: 14px; height: 14px;
  background: inherit; border-radius: 3px; transform: rotate(45deg);
}
.mh-text { position: relative; border: 0; background: transparent; color: inherit; font: inherit; font-size: 14px; font-weight: 600; padding: 6px 8px; cursor: pointer; white-space: nowrap; }
.mh-close { position: relative; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: inherit; font-size: 18px; line-height: 1; cursor: pointer; }
.mh-close:hover { background: rgba(255,255,255,.3); }
@keyframes hintBob { 50% { transform: translateY(4px); } }
.mood-btn.glow { animation: moodGlow 1.6s ease-in-out infinite; }
@keyframes moodGlow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 60% { box-shadow: 0 0 0 9px transparent; } }
@media (prefers-reduced-motion: reduce) { .mood-hint.in, .mood-btn.glow { animation: none; } }
