/* ============================================================
   Li Binyu — personal profile site
   Sunny light theme · Syne + IBM Plex Mono + Karla
   ============================================================ */

:root {
  --bg: #fbf6ec;
  --paper: #ffffff;
  --panel: #fffdf7;
  --ink: #2b2313;
  --body: #4c4230;
  --muted: #87795d;
  --faint: #b5a98e;
  --line: rgba(80, 60, 25, 0.10);
  --line-strong: rgba(80, 60, 25, 0.22);
  --accent: #ff8a1e;
  --accent-deep: #d96500;
  --accent-soft: #ffe9cd;
  --on-accent: #331a00;
  --ok: #0f9d6a;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --display: "Syne", "Segoe UI", sans-serif;
  --body-font: "Karla", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1000px 620px at 88% -12%, rgba(255, 166, 56, 0.20), transparent 62%),
    radial-gradient(820px 520px at -8% 18%, rgba(74, 144, 255, 0.10), transparent 55%),
    linear-gradient(180deg, #fffdf7 0%, var(--bg) 60%);
  background-attachment: fixed;
  color: var(--body);
  font-family: var(--body-font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* faint engineering grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(80, 60, 25, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 60, 25, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 25%, transparent 82%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, black 25%, transparent 82%);
}

/* subtle grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent-soft); }

main { position: relative; z-index: 1; max-width: 900px; margin: 0 auto; padding: 0 24px 40px; }

a { color: var(--accent-deep); text-decoration-color: rgba(217, 101, 0, 0.4); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent-deep); }

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

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: var(--on-accent);
  padding: 6px 12px; font-family: var(--mono); font-size: 13px;
  border-radius: 4px; z-index: 20;
}
.skip:focus { left: 8px; }

/* ---------------- top bar ---------------- */
.topbar {
  position: relative; z-index: 5;
  max-width: 900px; margin: 0 auto;
  padding: 20px 24px 6px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.brand { font-family: var(--mono); font-size: 13.5px; letter-spacing: 0.03em; color: var(--muted); }

.langswitch { display: flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; background: var(--paper); box-shadow: 0 1px 0 rgba(80, 60, 25, 0.05); }
.lang-btn {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em;
  padding: 6px 14px; background: transparent; border: 0; cursor: pointer;
  color: var(--muted); transition: color 0.2s, background 0.2s;
}
.lang-btn:hover { color: var(--accent-deep); }
.lang-btn.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* ---------------- hero ---------------- */
.hero { padding: clamp(48px, 9vh, 96px) 0 clamp(36px, 6vh, 60px); position: relative; }

.kicker {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--accent-deep); margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.4rem, 6.4vw, 4rem);
  line-height: 1.02; letter-spacing: -0.015em;
  margin: 0 0 8px; color: var(--ink);
}

.role { font-family: var(--display); font-weight: 600; font-size: clamp(1.1rem, 2.7vw, 1.45rem); color: var(--ink); margin: 0 0 5px; }
.sub { color: var(--muted); font-size: 1rem; margin: 0 0 24px; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; }
.chip {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em;
  border: 1px solid rgba(80, 60, 25, 0.16); border-radius: 100px;
  padding: 6px 14px; color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
}
.chip a { color: var(--muted); text-decoration: none; }
.chip a:hover { color: var(--accent-deep); }
.chip-on { color: #0b7a51; border-color: rgba(15, 157, 106, 0.4); }
.chip-on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 8px; animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------------- sections ---------------- */
.block { margin-top: clamp(30px, 5.5vh, 56px); }

.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.sec-head-row { justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.sec-title { display: flex; align-items: baseline; gap: 14px; }
.sec-num { font-family: var(--mono); font-size: 12.5px; color: var(--accent-deep); }
.sec-head h2 {
  font-family: var(--display); font-weight: 700; font-size: 1.3rem;
  letter-spacing: 0.02em; margin: 0; text-transform: uppercase; color: var(--ink);
}
.sec-head h2::after { content: ""; display: inline-block; width: 38px; height: 1px; background: var(--line-strong); margin-left: 14px; vertical-align: middle; }

.lede { font-size: 1.05rem; color: var(--body); max-width: 68ch; margin: 0 0 16px; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.tags li {
  font-family: var(--mono); font-size: 12.5px;
  border: 1px dashed rgba(80, 60, 25, 0.28); color: var(--muted);
  padding: 4px 11px; border-radius: 5px; background: rgba(255, 255, 255, 0.5);
}

/* ---------------- timeline ---------------- */
.tl-actions { display: flex; gap: 8px; }
.tl-btn {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.05em;
  color: var(--muted); background: transparent; border: 1px solid var(--line-strong);
  border-radius: 7px; padding: 5px 12px; cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.tl-btn:hover { color: var(--accent-deep); border-color: var(--accent-deep); }

.timeline { list-style: none; margin: 0; padding: 6px 0 0; }

.t-item { position: relative; padding-left: 34px; }

/* vertical spine */
.t-item::before {
  content: ""; position: absolute; left: 9px; top: 26px; bottom: -16px;
  width: 1.5px; background: linear-gradient(var(--line-strong), rgba(80, 60, 25, 0.06));
}
.t-item:last-child::before { display: none; }

/* node dot */
.t-item::after {
  content: ""; position: absolute; left: 4px; top: 15px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--paper); border: 2.5px solid var(--faint);
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.t-item:hover::after { border-color: var(--accent); }
.t-item.open::after { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px rgba(255, 138, 30, 0.22); }

.t-item { margin-bottom: 14px; }

/* entry head = whole clickable row */
.t-head {
  display: flex; align-items: flex-start; gap: 16px; width: 100%;
  text-align: left; cursor: pointer; border: 1px solid rgba(80, 60, 25, 0.14);
  background: linear-gradient(180deg, #ffffff, #fffaf0);
  border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(80, 60, 25, 0.05);
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  font: inherit; color: inherit;
}
.t-head:hover { border-color: rgba(80, 60, 25, 0.3); transform: translateX(3px); box-shadow: 0 3px 10px rgba(80, 60, 25, 0.08); }
.t-item.open .t-head { border-color: rgba(255, 138, 30, 0.55); box-shadow: 0 3px 12px rgba(255, 138, 30, 0.12); }

.t-range {
  font-family: var(--mono); font-size: 12.5px; color: var(--accent-deep);
  letter-spacing: 0.08em; white-space: nowrap; padding-top: 2px; min-width: 74px;
}

.t-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.t-company { font-family: var(--display); font-weight: 700; font-size: 1.05rem; line-height: 1.25; color: var(--ink); }
.t-meta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); letter-spacing: 0.02em; }
.t-meta .t-loc { color: var(--faint); }

.t-icon {
  margin-left: auto; font-family: var(--mono); font-size: 18px; line-height: 1;
  color: var(--accent-deep); border: 1px solid rgba(217, 101, 0, 0.4); border-radius: 7px;
  padding: 2px 7px; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2), background 0.25s;
  flex: none;
}
.t-item.open .t-icon { transform: rotate(45deg); background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* animated expansion (grid-rows trick) */
.t-desc {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.t-desc-inner { overflow: hidden; }
.t-desc p {
  margin: 0; padding: 13px 18px 15px 0; color: var(--body);
  font-size: 1rem; max-width: 74ch;
}
.t-item.open .t-desc { grid-template-rows: 1fr; }

/* ---------------- footer ---------------- */
footer {
  position: relative; z-index: 1;
  max-width: 900px; margin: 64px auto 0; padding: 0 24px 36px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
}
footer p { font-family: var(--mono); font-size: 12.5px; color: var(--faint); margin: 14px 0 0; }
.foot-line { opacity: 0.8; }

/* ---------------- load-in motion ---------------- */
.hero > *, .block { opacity: 0; transform: translateY(14px); animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.hero > :nth-child(1) { animation-delay: 0.05s; }
.hero > :nth-child(2) { animation-delay: 0.12s; }
.hero > :nth-child(3) { animation-delay: 0.19s; }
.hero > :nth-child(4) { animation-delay: 0.26s; }
.hero > :nth-child(5) { animation-delay: 0.33s; }
.block:nth-of-type(1) { animation-delay: 0.45s; }
.block:nth-of-type(2) { animation-delay: 0.58s; }

@keyframes rise { to { opacity: 1; transform: none; } }

.timeline .t-item { opacity: 0; transform: translateY(10px); animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.timeline .t-item:nth-child(1) { animation-delay: 0.70s; }
.timeline .t-item:nth-child(2) { animation-delay: 0.80s; }
.timeline .t-item:nth-child(3) { animation-delay: 0.90s; }
.timeline .t-item:nth-child(4) { animation-delay: 1.00s; }

/* ---------------- responsive ---------------- */
@media (max-width: 620px) {
  .topbar { padding: 16px 16px 2px; }
  main { padding: 0 16px 26px; }
  footer { padding: 0 16px 26px; }
  .t-head { flex-wrap: wrap; gap: 8px 14px; }
  .t-range { min-width: 0; }
  .t-icon { margin-left: 0; }
  .sec-head-row { align-items: flex-start; flex-direction: column; }
  .tl-actions { width: 100%; }
}

/* ---------------- reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .hero > *, .block, .timeline .t-item { opacity: 1; transform: none; }
}
