/* ============================================================
   LPB Portfolio
   Themes: dark (default), light
   ============================================================ */

:root {
  --font-sans: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Satoshi", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Satoshi", ui-monospace, "SF Mono", monospace;

  --r: 12px;
  --r-sm: 8px;

  --max-w: 1280px;
  --gap: 14px;
  --pad: 22px;

  --t-color: 220ms ease;
}

/* ---------- Themes ---------- */
[data-theme="dark"] {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #767676;
  --muted-2: #4a4a4a;
  --card: #0e0e0e;
  --card-2: #161616;
  --border: #1d1d1d;
  --border-2: #262626;
  --accent: #6cf26c;
  --hover: #1f1f1f;
  --pill-bg: #1a1a1a;
  --pill-fg: #ffffff;
  --tag-shadow: 0 6px 18px rgba(0,0,0,.35);
  --avatar-ring: linear-gradient(135deg,#ff5b8a,#ffb347,#7b9eff);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3efe9;
  --fg: #111111;
  --muted: #6e6a64;
  --muted-2: #b6b1a8;
  --card: #ffffff;
  --card-2: #faf7f2;
  --border: #e6e0d6;
  --border-2: #d9d2c4;
  --accent: #1f9d3a;
  --hover: #f0ebe2;
  --pill-bg: #ffffff;
  --pill-fg: #111111;
  --tag-shadow: 0 6px 18px rgba(40,30,10,.10);
  --avatar-ring: linear-gradient(135deg,#ff5b8a,#ffb347,#7b9eff);
  color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--t-color), color var(--t-color);
}

body { height: 100vh; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

img { display: block; max-width: 100%; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }

.sep { color: var(--muted); margin: 0 .25em; font-weight: 400; }
.muted { color: var(--muted); }

/* ---------- Theme Switcher ---------- */
.theme-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--pill-bg);
  color: var(--pill-fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  transition: background var(--t-color), color var(--t-color), border-color var(--t-color);
}

.theme-switcher button {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: color var(--t-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-switcher button svg { width: 14px; height: 14px; flex: 0 0 auto; }

.theme-switcher .thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: var(--fg);
  border-radius: 999px;
  transition: transform .28s cubic-bezier(.5,1.4,.4,1), background var(--t-color), width .28s ease, left .28s ease;
  z-index: 0;
  pointer-events: none;
}

.theme-switcher button[aria-current="true"] { color: var(--bg); }

/* ---------- Layout ---------- */
.layout {
  max-width: var(--max-w);
  height: 100vh;
  margin: 0 auto;
  padding: 18px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 0;
  flex: 0 0 auto;
}

/* ---------- Bio ---------- */
.bio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 6px;
}
.bio__left { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  padding: 2px;
  background: var(--avatar-ring);
}
.bio h1 { font-size: 18px; line-height: 1.1; }
.bio p { color: var(--muted); font-size: 14px; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr 1.1fr;
  gap: var(--gap);
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
}

/* card flex distribution within columns (locked-viewport bento) */
.col--1 .card--experience { flex: 2.4; min-height: 0; }
.col--1 .card--kindwords  { flex: 1;   min-height: 0; }
.col--2 .card--work       { flex: 1;   min-height: 0; }
.col--3 .card--projects   { flex: 1.6; min-height: 0; }
.col--3 .card--education  { flex: 1;   min-height: 0; }

.row {
  display: grid;
  gap: var(--gap);
  flex: 0 0 auto;
}

.row--top { grid-template-columns: 1fr 1fr; height: 200px; }
.row--bot { grid-template-columns: 1fr 1fr; height: 210px; }

/* ---------- Card base ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 18px;
  transition: background var(--t-color), border-color var(--t-color), box-shadow var(--t-color);
  overflow: hidden;
}

[data-theme="light"] .card {
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 500 12px/1 var(--font-sans);
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin: -2px 0 0;
}

.card__action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 500 12px/1 var(--font-sans);
  letter-spacing: .14em;
  cursor: pointer;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  text-transform: uppercase;
  transition: color var(--t-color);
}
.card__action:hover { color: var(--fg); }
.card__action svg {
  width: 10px;
  height: 10px;
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity .18s ease, transform .18s ease;
}
.card__action:hover svg {
  opacity: 1;
  transform: translate(0, 0);
}

/* ---------- Experience ---------- */
.card--experience { position: relative; }
.card--experience .experience {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.experience {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.experience h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -.005em;
}
.experience h3 em { font-style: italic; color: var(--muted); font-weight: 500; }
.experience p { color: var(--fg); font-size: 14px; line-height: 1.55; }
.experience .meta { color: var(--muted); margin-top: 4px; }

/* ---------- Kind Words ---------- */
.card--kindwords blockquote {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.card--kindwords blockquote footer { display: flex; flex-direction: column; gap: 2px; font-style: normal; }
.card--kindwords blockquote footer strong { font-weight: 600; }
.card--kindwords blockquote footer span { color: var(--muted); }

/* ---------- Time / Clock ---------- */
.card--time { gap: 10px; }
.clock {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 0;
}
.clock svg {
  width: 100%;
  height: 100%;
  max-width: 160px;
  max-height: 160px;
}
.clock__face { fill: none; stroke: var(--border-2); stroke-width: 1.5; }
.clock__hand { stroke: var(--fg); stroke-linecap: round; }
.clock__hand--h { stroke-width: 5; }
.clock__hand--m { stroke-width: 4; }
.clock__hand--s { stroke-width: 1.4; stroke: var(--fg); }
.clock__center { fill: var(--fg); }

.clock__ticks line { stroke: var(--fg); stroke-linecap: round; }
.clock__ticks .tick--h { stroke-width: 1.5; }
.clock__ticks .tick--m { stroke-width: 0.8; opacity: .7; }

/* ---------- Mode ---------- */
.card--mode { gap: 14px; justify-content: flex-start; }
.status-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.mode-line {
  font-size: 14px;
  color: var(--fg);
  line-height: 1.4;
}

/* ---------- Work / Tags ---------- */
.work-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}
.tag {
  position: absolute;
  left: var(--x); top: var(--y);
  background: var(--tag-bg, #fff);
  color: var(--tag-fg, #1a1a1a);
  padding: 8px 14px;
  border-radius: 10px;
  font: 600 11px/1 var(--font-sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--tag-shadow);
  animation-delay: var(--d, 0s);
  transform-origin: center center;
  will-change: transform;
  transition: filter .2s ease, box-shadow .2s ease;
}
.tag:hover { filter: brightness(1.05); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
[data-theme="light"] .tag:hover { box-shadow: 0 4px 14px rgba(40,30,10,.14); }
.tag:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.tag .tag__pin {
  position: absolute;
  width: 11px;
  height: 7px;
  bottom: -6px;
  left: 14px;
  fill: var(--tag-bg, #fff);
  display: block;
  pointer-events: none;
}

.tag--orange { --tag-bg: #f8b67a; --tag-fg: #2a1505; }
.tag--purple { --tag-bg: #c8a4ff; --tag-fg: #1a0a3a; }
.tag--pink   { --tag-bg: #ffb1c1; --tag-fg: #3a0a18; }
.tag--white  { --tag-bg: #f1ece4; --tag-fg: #1a1a1a; }
.tag--blue   { --tag-bg: #a4c2ff; --tag-fg: #0a1a3a; }
.tag--green  { --tag-bg: #b2e2b8; --tag-fg: #0a3a18; }

/* Figma-cursor style drift: 3 distinct paths, assigned by nth-child */
@keyframes drift-a {
  0%   { transform: translate(0, 0)         rotate(-1deg); }
  25%  { transform: translate(14px, -10px)  rotate(2deg); }
  50%  { transform: translate(-6px, 8px)    rotate(-2deg); }
  75%  { transform: translate(10px, 4px)    rotate(1deg); }
  100% { transform: translate(0, 0)         rotate(-1deg); }
}
@keyframes drift-b {
  0%   { transform: translate(0, 0)         rotate(2deg); }
  25%  { transform: translate(-12px, 6px)   rotate(-1deg); }
  50%  { transform: translate(8px, -12px)   rotate(2deg); }
  75%  { transform: translate(-4px, 10px)   rotate(-2deg); }
  100% { transform: translate(0, 0)         rotate(2deg); }
}
@keyframes drift-c {
  0%   { transform: translate(0, 0)         rotate(0deg); }
  25%  { transform: translate(6px, 12px)    rotate(2deg); }
  50%  { transform: translate(-14px, -4px)  rotate(-2deg); }
  75%  { transform: translate(4px, -10px)   rotate(1deg); }
  100% { transform: translate(0, 0)         rotate(0deg); }
}

.tag:nth-child(1) { animation: drift-a 22s ease-in-out infinite; transform-origin: left top; }
.tag:nth-child(2) { animation: drift-b 26s ease-in-out infinite; }
.tag:nth-child(3) { animation: drift-c 24s ease-in-out infinite; }
.tag:nth-child(4) { animation: drift-a 28s ease-in-out infinite reverse; }
.tag:nth-child(5) { animation: drift-b 20s ease-in-out infinite reverse; }
.tag:nth-child(6) { animation: drift-c 30s ease-in-out infinite; }

/* pin variations by index for visual variety */
.tag:nth-child(2) .tag__pin { top: -6px; right: 14px; left: auto; bottom: auto; transform: rotate(180deg); }
.tag:nth-child(3) .tag__pin { top: -6px; left: 16px; bottom: auto; transform: rotate(180deg); }
.tag:nth-child(4) .tag__pin { bottom: -6px; right: 16px; left: auto; }
.tag:nth-child(5) .tag__pin { top: -6px; left: 14px; bottom: auto; transform: rotate(180deg); }
.tag:nth-child(6) .tag__pin { top: -6px; left: 18px; bottom: auto; transform: rotate(180deg); }

/* ---------- Years ---------- */
.card--years { align-items: stretch; }
.years-num {
  flex: 1;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(64px, 8vw, 96px);
  line-height: 1;
  letter-spacing: -.04em;
}

/* ---------- CTAs ---------- */
.card--ctas { gap: 12px; }
.ctas { display: flex; flex-direction: column; gap: 8px; }
.cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--t-color), border-color var(--t-color), transform .15s ease;
}
.cta svg { width: 12px; height: 12px; color: var(--muted); }
.cta:hover { background: var(--hover); }
.cta:hover svg { color: var(--fg); }

/* ---------- Projects ---------- */
.card--projects .projects {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.projects__link {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: flex-start;
  color: inherit;
  border-radius: var(--r-sm);
  transition: opacity .2s ease;
}
.projects__link:hover { opacity: .82; }
.projects li img {
  width: 56px; height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--card-2);
  border: 1px solid var(--border);
}
.projects h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.35; }
.projects p { color: var(--fg); font-size: 14px; line-height: 1.5; }

/* ---------- Education ---------- */
.card--education .education {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.education {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.education li { padding: 4px 0; }
.education h3 { font-size: 14px; font-weight: 600; margin-bottom: 2px; line-height: 1.35; }
.education p { color: var(--muted); font-size: 14px; }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6px;
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}
.foot strong { color: var(--fg); font-weight: 600; }

/* ---------- Scrollable card content ---------- */
.card--experience .experience::-webkit-scrollbar,
.card--kindwords blockquote::-webkit-scrollbar,
.card--projects .projects::-webkit-scrollbar,
.card--education .education::-webkit-scrollbar { width: 6px; }
.card--experience .experience::-webkit-scrollbar-thumb,
.card--kindwords blockquote::-webkit-scrollbar-thumb,
.card--projects .projects::-webkit-scrollbar-thumb,
.card--education .education::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}
.card--experience .experience,
.card--kindwords blockquote,
.card--projects .projects,
.card--education .education {
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
  --fade-h: 110px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - var(--fade-h)), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - var(--fade-h)), transparent 100%);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  html, body { overflow: auto; height: auto; }
  body { height: auto; }
  .layout { height: auto; min-height: 100vh; padding: 18px 18px 12px; }

  /* Flatten nested .col / .row so cards become direct grid children */
  .grid {
    flex: 0 0 auto;
    min-height: 0;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: row;
  }
  .col, .row { display: contents; }

  /* Mobile order: time|mode, experience, work, kindwords, projects, education, years|ctas */
  .card--time       { order: 1; }
  .card--mode       { order: 2; }
  .card--experience { order: 3; grid-column: 1 / -1; }
  .card--work       { order: 4; grid-column: 1 / -1; }
  .card--kindwords  { order: 5; grid-column: 1 / -1; }
  .card--projects   { order: 6; grid-column: 1 / -1; }
  .card--education  { order: 7; grid-column: 1 / -1; }
  .card--years      { order: 8; }
  .card--ctas       { order: 9; }

  /* Fixed-ish heights so internal scroll + bottom fade still works */
  .card--time, .card--mode { flex: 0 0 auto; height: 160px; }
  .card--experience        { flex: 0 0 auto; height: 560px; }
  .card--work              { flex: 0 0 auto; height: 400px; }
  .card--kindwords         { flex: 0 0 auto; height: 420px; }
  .card--projects          { flex: 0 0 auto; height: 520px; }
  .card--education         { flex: 0 0 auto; height: 420px; }
  .card--years, .card--ctas{ flex: 0 0 auto; height: 220px; }

  .work-stage { min-height: 280px; }
  .clock svg  { max-width: 96px; max-height: 96px; }
}

@media (max-width: 480px) {
  .card { padding: 18px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .tag { animation: none; }
  * { transition: none !important; }
}
