:root {
  --bg: #DCE5EC;
  --bg-deep: #CFDAE3;
  --card: rgba(255,255,255,0.45);
  --line: rgba(60,85,110,0.16);
  --width: 900px;
  --ink: #22303D;
  --ink-soft: #5A6B7A;
  --accent: #4E7294;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: linear-gradient(to bottom, #E4ECF2, var(--bg) 420px, var(--bg-deep));
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(78,114,148,0.4); }
a:hover { color: var(--ink); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- background: skyline and drifting clouds ---------- */
.skyline {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  height: clamp(220px, min(50vh, 34vw), 660px);
  z-index: 0;
  pointer-events: none;
  object-fit: cover;
  object-position: center bottom;
}

.clouds { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cloud {
  position: absolute;
  left: 0;
  width: var(--w);
  top: var(--y);
  opacity: var(--o, 0.75);
  animation: drift var(--t) linear infinite;
  animation-delay: var(--delay);
}
@keyframes drift {
  from { transform: translateX(-40vw); }
  to { transform: translateX(110vw); }
}

.page { position: relative; z-index: 1; }

/* ---------- snow toggle ---------- */
body { transition: background-color 1.2s ease; }
body::before {
  /* cooler, greyer wash over the sky while it snows */
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(180,192,204,0.55), rgba(220,228,236,0.2));
  opacity: 0;
  transition: opacity 1.2s ease;
}
body.snowing::before { opacity: 1; }

.snow { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity 1s ease; }
body.snowing .snow { opacity: 1; }
.snow i {
  position: absolute;
  top: -12px;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff;
  opacity: var(--o);
  filter: blur(var(--b));
  animation: snowfall var(--t) linear infinite, sway var(--sw) ease-in-out infinite alternate;
  animation-delay: var(--delay), var(--delay);
}
@keyframes snowfall { to { top: 102%; } }
@keyframes sway { from { translate: -14px 0; } to { translate: 14px 0; } }

.weather-btn {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 15px var(--sans);
  color: var(--ink);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(40,60,80,0.12);
  transition: background 200ms ease, transform 200ms ease;
}
.weather-btn:hover { background: #fff; transform: translateY(-2px); }
.weather-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

header {
  position: relative;
  max-width: var(--width);
  margin: 0 auto;
  padding: clamp(72px, 12vh, 120px) 16px 36px;
}
header h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin: 0;
}
header .tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2.6vw, 25px);
  color: var(--ink-soft);
  margin: 14px 0 0;
}

.contact { display: flex; gap: 10px; margin-top: 22px; }
.contact a {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  transition: background 200ms ease, color 200ms ease, transform 200ms ease;
}
.contact a:hover { background: #fff; color: var(--accent); transform: translateY(-2px); }
.contact svg { width: 18px; height: 18px; display: block; }
.contact .line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- quick links ---------- */
.quick {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  right: 16px;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(40,60,80,0.08);
}
.quick a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: background 200ms ease, color 200ms ease;
}
.quick a:hover { background: #fff; color: var(--accent); }
.quick a[aria-current="page"] { background: var(--ink); color: #fff; }

/* ---------- inner pages ---------- */
header .home {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--ink-soft);
  text-decoration: none;
}
header .home:hover { color: var(--ink); }
header.inner h1 { font-size: clamp(48px, 7vw, 76px); margin-top: 10px; }
.inner-page main > section:first-child { border-top: 1px solid var(--line); }

.soon {
  text-align: center;
  padding: 72px 0 96px;
}
.soon p {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(32px, 5vw, 48px);
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- content ---------- */
main { max-width: var(--width); margin: 0 auto; padding: 0 16px 56px; }
section { padding: 36px 0; border-top: 1px solid var(--line); }
h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 18px;
}
section p { margin: 0 0 14px; }
section p:last-child { margin-bottom: 0; }

.projects { display: grid; gap: 12px; }
.project {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 16px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: background 200ms ease, transform 200ms ease;
}
.project:hover { background: rgba(255,255,255,0.75); color: var(--ink); transform: translateY(-2px); }
.project strong { font-weight: 600; }
.project span { grid-column: 1; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.project::after { content: "↗"; grid-column: 2; grid-row: 1; color: var(--accent); transition: transform 200ms ease; }
.project:hover::after { transform: translate(2px, -2px); }

.jobs { list-style: none; margin: 0; padding: 0; }
.jobs li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.jobs li:last-child { border-bottom: 0; }
.jobs .when { color: var(--ink-soft); font-size: 15px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.jobs .role { display: block; font-weight: 600; }
.jobs .org { display: block; color: var(--ink-soft); }
.jobs .desc { display: block; font-size: 15px; color: var(--ink-soft); }

.skills { display: grid; gap: 16px; margin: 0; }
.skills div { display: grid; grid-template-columns: 170px 1fr; gap: 18px; }
.skills dt { color: var(--ink-soft); font-size: 15px; padding-top: 2px; }
.skills dd { margin: 0; }
.chip {
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}

.edu-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.edu .role { display: block; font-weight: 600; }
.edu .org { display: block; color: var(--ink-soft); }
.edu .when { color: var(--ink-soft); font-size: 15px; }
.edu strong { font-weight: 600; margin-right: 10px; }
.edu .gpa { margin: 14px 0 10px; }
.course { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.awards { list-style: none; margin: 0; padding: 0; }
.awards li { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.awards li:last-child { border-bottom: 0; }
.awards strong { font-weight: 600; }

footer {
  max-width: var(--width);
  margin: 0 auto;
  padding: 24px 16px 48px;
  color: var(--ink-soft);
  font-size: 14px;
  border-top: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
  .cloud { animation: none; transform: translateX(calc(var(--x, 20) * 1vw)); }
  .snow i { animation: none; top: var(--y); }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .jobs li { grid-template-columns: 1fr; gap: 2px; }
  .skills div { grid-template-columns: 1fr; gap: 6px; }
  .skills dt { padding-top: 0; }
  .quick { left: 16px; right: 16px; justify-content: space-between; }
  .quick a { padding: 6px 4px; font-size: 12px; }
  .project { padding: 16px; }
}
