/* ============ Design tokens ============ */
:root {
  --bg: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-text: #fff;
  --hairline: rgba(0, 0, 0, .1);

  /* Glass */
  --glass-tint: rgba(255, 255, 255, .55);
  --glass-sheen: rgba(255, 255, 255, .45);
  --glass-edge: rgba(255, 255, 255, .75);
  --glass-shadow: rgba(0, 0, 0, .08);
  --glass-blur: blur(20px) saturate(180%);

  /* Background colour blobs */
  --blob-1: #b9e6ff;
  --blob-2: #ffd3e8;
  --blob-3: #d9f7d0;
  --blob-4: #e3dcff;
  --glass-tint-strong: rgba(255, 255, 255, .78);
  --glow: rgba(255, 255, 255, .55);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --radius-lg: 28px;
  --radius-md: 18px;
  --max: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

/* Dark colours: when the device is in dark mode (unless the visitor switched to light), or when they switched to dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --accent: #2997ff;
    --hairline: rgba(255, 255, 255, .14);
    --glass-tint: rgba(36, 36, 40, .55);
    --glass-sheen: rgba(255, 255, 255, .08);
    --glass-edge: rgba(255, 255, 255, .14);
    --glass-shadow: rgba(0, 0, 0, .5);
    --blob-1: #0b3a5c;
    --blob-2: #4a1a3a;
    --blob-3: #163d2a;
    --blob-4: #2a1f5c;
    --glass-tint-strong: rgba(30, 30, 34, .82);
    --glow: rgba(255, 255, 255, .14);
  }
}
:root[data-theme="dark"] {
    --bg: #000;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --accent: #2997ff;
    --hairline: rgba(255, 255, 255, .14);
    --glass-tint: rgba(36, 36, 40, .55);
    --glass-sheen: rgba(255, 255, 255, .08);
    --glass-edge: rgba(255, 255, 255, .14);
    --glass-shadow: rgba(0, 0, 0, .5);
    --blob-1: #0b3a5c;
    --blob-2: #4a1a3a;
    --blob-3: #163d2a;
    --blob-4: #2a1f5c;
    --glass-tint-strong: rgba(30, 30, 34, .82);
    --glow: rgba(255, 255, 255, .14);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  /* The drifting colour layers are wider than the screen; never let them cause sideways scrolling */
  overflow-x: clip;
}
/* Soft colour wash behind the glass (fixed layers, cheap to scroll).
   The layers are much bigger than the screen so their edges never swing into view while they drift and turn,
   even on ultra-wide monitors. Blob positions are worked out so they sit in the same places on screen. */
body::before {
  content: ""; position: fixed; inset: -35%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(28.24% 24.71% at 25.29% 21.76%, var(--blob-1), transparent 70%),
    radial-gradient(24.71% 24.71% at 78.24% 35.88%, var(--blob-2), transparent 70%),
    radial-gradient(28.24% 28.24% at 50% 81.76%, var(--blob-3), transparent 70%);
  opacity: .9;
  animation: drift-a 26s ease-in-out infinite alternate;
  will-change: transform;
}
/* Second, slower layer drifting the other way for a liquid feel */
body::after {
  content: ""; position: fixed; inset: -35%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(22.94% 22.94% at 69.12% 69.12%, var(--blob-4), transparent 70%),
    radial-gradient(19.12% 19.12% at 30.88% 53.82%, var(--blob-2), transparent 70%);
  opacity: .6;
  animation: drift-b 38s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes drift-a {
  50% { transform: translate3d(2.82%, 2.12%, 0) rotate(8deg) scale(1.08); }
  100% { transform: translate3d(-2.12%, 3.53%, 0) rotate(-6deg) scale(1.03); }
}
@keyframes drift-b {
  50% { transform: translate3d(-3.82%, -2.29%, 0) rotate(-10deg) scale(1.1); }
  100% { transform: translate3d(2.29%, -4.59%, 0) rotate(6deg) scale(.96); }
}
img { max-width: 100%; display: block; }
img[hidden] { display: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
ul { list-style: none; margin: 0; padding: 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;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--bg); color: var(--text); padding: 8px 12px; border-radius: 8px;
}
.skip-link:focus { left: 12px; top: 12px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ============ Liquid glass ============ */
.glass {
  background:
    linear-gradient(135deg, var(--glass-sheen), transparent 45%),
    linear-gradient(var(--glass-tint), var(--glass-tint));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),
    0 10px 30px -8px var(--glass-shadow);
}
/* Browsers without blur, or users who asked for less transparency, get a solid surface */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass-tint: rgba(255, 255, 255, .92); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glass-tint: rgba(28, 28, 30, .95); } }
  :root[data-theme="dark"] { --glass-tint: rgba(28, 28, 30, .95); }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass-tint: rgba(255, 255, 255, .95); }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glass-tint: rgba(28, 28, 30, .97); } }
  :root[data-theme="dark"] { --glass-tint: rgba(28, 28, 30, .97); }
}

/* ============ Nav ============ */
.site-header { position: sticky; top: 0; z-index: 50; padding: 12px 12px 0; }
.nav {
  max-width: 880px; margin: 0 auto; height: 52px; padding: 0 10px 0 12px; gap: 6px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 999px;
}
.brand { flex: none; display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text); font-weight: 600; font-size: 16px; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 50%; }
.nav-links { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nav-links > li > a {
  display: inline-flex; align-items: center; gap: 5px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  color: var(--text); font: 500 14px var(--font); white-space: nowrap;
  transition: background-color .2s;
}
.nav-links > li > a:hover { background: var(--hairline); text-decoration: none; }
.nav-links > li > a[aria-current="page"] { background: var(--hairline); }

/* ============ Hero ============ */
.hero { text-align: center; padding: 72px 24px 56px; }
.avatar {
  width: 160px; height: 160px; margin: 0 auto 28px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 6px var(--glass-edge), 0 20px 50px -12px var(--glass-shadow);
}
.hero h1 {
  margin: 0; font-size: clamp(48px, 9vw, 96px); font-weight: 700;
  line-height: 1.02; letter-spacing: -.035em;
}
.tagline { margin: 14px auto 0; max-width: 40ch; text-wrap: balance; font-size: clamp(19px, 2.4vw, 26px); line-height: 1.3; color: var(--muted); }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 36px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px;
  color: var(--text); font-size: 16px; font-weight: 500;
  transition: transform .2s ease, box-shadow .2s ease;
}
.pill:hover { text-decoration: none; transform: translateY(-1px) scale(1.02); }
.pill:active { transform: scale(.98); }
.pill svg { width: 20px; height: 20px; flex: none; }
.pill-primary { background: var(--accent); color: var(--accent-text); border: 1px solid transparent; box-shadow: 0 8px 24px -8px var(--accent); }

/* ============ Sections ============ */
.section { padding: 56px 24px; }
.section-title { margin: 0; text-align: center; font-size: clamp(34px, 5vw, 56px); font-weight: 700; letter-spacing: -.03em; line-height: 1.07; }
.section-sub { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 19px; }

/* Instagram + Spotify side by side */
.feed-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 36px; }
@media (min-width: 860px) {
  .feed-grid { grid-template-columns: 1fr 1fr; align-items: stretch; }
}
.panel { border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; min-width: 0; }
.panel h3 { margin: 2px 6px 14px; font-size: 15px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ig-grid { display: flex; justify-content: center; flex: 1; }
.ig-grid .instagram-media {
  margin: 0 !important; min-width: 0 !important; width: 100% !important; max-width: 540px !important;
  min-height: 200px; border-radius: 14px !important; border: 0 !important; background: #fff;
}
.ig-grid iframe { border-radius: 14px !important; }
.spotify { border: 0; border-radius: 14px; display: block; width: 100%; flex: 1 1 auto; min-height: 452px; }

/* About */
.about { padding-top: 24px; }
.panel.about-card { max-width: 760px; margin: 0 auto; padding: 28px 32px; font-size: 19px; line-height: 1.6; }
.about-card p { margin: 0; }
.about-card p + p { margin-top: 14px; }
.about-card strong { font-weight: 600; }
@media (max-width: 600px) { .panel.about-card { padding: 20px; font-size: 17px; } }

/* Projects grid on home page */
.projects-grid {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  max-width: 760px; margin: 28px auto 0;
}
@media (min-width: 680px) {
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.embed-fallback { margin: 12px 6px 2px; font-size: 14px; color: var(--muted); }
.embed-error { display: none; }
.embed-failed .embed-error { display: inline; }
.embed-failed .spotify { min-height: 0; height: 0; flex: 0 0 0; }

/* ============ Gallery ============ */
.carousel { position: relative; margin-top: 36px; padding: 8px; border-radius: var(--radius-lg); }
.track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  overscroll-behavior-x: contain; border-radius: 20px; background: var(--hairline);
}
.track::-webkit-scrollbar { display: none; }
.track figure {
  flex: 0 0 100%; margin: 0; scroll-snap-align: center; aspect-ratio: 16 / 9;
  position: relative; overflow: hidden;
  content-visibility: auto; /* photos further along aren't drawn (or downloaded) until you swipe near them */
}
.track img { position: relative; width: 100%; height: 100%; object-fit: cover; }
/* Tall photos: shown whole, on a soft blurred copy of themselves instead of being cropped */
.track figure.portrait::before {
  content: ""; position: absolute; inset: -40px;
  background: var(--photo) center / cover no-repeat;
  filter: blur(28px) saturate(1.2) brightness(.85);
}
.track video { position: relative; display: block; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.track figure.portrait img, .track figure.portrait video { object-fit: contain; }
.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--text);
}
.nav-btn svg { width: 20px; height: 20px; }
.carousel.single .nav-btn { display: none; }
.dots[hidden] { display: none; }
.prev { left: 20px; }
.next { right: 20px; }
.dots { display: flex; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
/* 24px tap area with an 8px dot in the middle */
.dots button {
  width: 24px; height: 24px; border: 0; padding: 0; cursor: pointer;
  background: radial-gradient(circle, var(--hairline) 4px, transparent 4.5px);
}
.dots button[aria-current="true"] { background: radial-gradient(circle, var(--text) 4px, transparent 4.5px); }
.dots button[hidden] { display: none; }

/* ============ Top bar tools: light/dark switch + widgets ============ */
.nav-tools { flex: none; display: flex; align-items: center; gap: 4px; margin-left: 0; padding-left: 8px; border-left: 1px solid var(--hairline); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: none; color: var(--text);
  transition: background-color .2s, transform .2s var(--ease);
}
.icon-btn:hover, .widgets-btn[aria-expanded="true"] { background: var(--hairline); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 19px; height: 19px; grid-area: 1 / 1; transition: transform .5s var(--ease), opacity .3s; }
/* Sun in light mode, moon in dark mode, spinning between them */
.theme-btn .i-moon { opacity: 0; transform: rotate(-90deg) scale(.5); }
.theme-btn.is-dark .i-sun { opacity: 0; transform: rotate(90deg) scale(.5); }
.theme-btn.is-dark .i-moon { opacity: 1; transform: none; }
/* The circular theme reveal replaces the normal page cross-fade */
:root.theme-vt::view-transition-old(root),
:root.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Widgets panel */
.widgets {
  position: fixed; z-index: 55; width: 360px; max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); overflow-y: auto; overscroll-behavior: contain;
  padding: 10px; border-radius: 26px; display: grid; gap: 10px;
  --glass-tint: var(--glass-tint-strong);
  opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: top right;
  transition: opacity .25s var(--ease), transform .35s var(--ease);
  scrollbar-width: thin;
}
.widgets.open { opacity: 1; transform: none; }
.widget { padding: 14px 16px; border-radius: 18px; background: var(--hairline); }
.w-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.w-title { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.w-link { display: inline-flex; align-items: center; min-height: 32px; border: 0; background: none; padding: 0 4px; margin: -6px -4px; border-radius: 8px; font: 500 13px var(--font); color: var(--accent); cursor: pointer; }
.w-link:hover { background: var(--hairline); text-decoration: none; }
.w-muted { margin: 0; color: var(--muted); font-size: 14px; }

/* Clock */
.w-clock { text-align: center; padding: 18px 16px; }
.w-time { font-size: 46px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.w-sec { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 6px; vertical-align: top; }
.w-date { margin-top: 8px; font-size: 15px; font-weight: 500; }
.w-zone { margin-top: 2px; font-size: 12px; color: var(--muted); }

/* Weather */
.w-now { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; }
.w-big-emoji { font-size: 38px; line-height: 1; }
.w-temp { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.w-desc { display: flex; flex-direction: column; font-size: 15px; font-weight: 500; line-height: 1.3; }
.w-desc small { font-size: 12px; font-weight: 400; color: var(--muted); }
.w-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 14px; text-align: center; font-size: 12px; }
.w-days li { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.w-days b { color: var(--text); font-weight: 600; }
.w-emoji { font-size: 20px; }

/* Spotify */
.w-music { padding-bottom: 12px; }
.w-spotify { display: block; width: 100%; height: 152px; border: 0; border-radius: 12px; }

/* Calendar */
.w-cal .w-head { margin-bottom: 6px; }
.w-cal .cal-title { min-height: 36px; padding: 0 8px; border-radius: 10px; border: 0; background: none; cursor: pointer; font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); }
.cal-nav {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; cursor: pointer;
  color: var(--text); font-size: 20px; line-height: 1;
}
.cal-nav:hover { background: var(--hairline); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.cal-dow { text-decoration: none; cursor: default; padding: 4px 0; font-size: 11px; font-weight: 600; color: var(--muted); }
.cal-day { cursor: default; display: grid; place-items: center; height: 32px; border-radius: 50%; }
.cal-day.is-today { background: var(--accent); color: var(--accent-text); font-weight: 700; }

/* Medium widths: drop the in-page shortcuts (Latest, Gallery) so the bar never overlaps */
@media (max-width: 820px) {
  .nav-links li:has(> a[href^="#"]) { display: none; }
}
@media (max-width: 600px) {
  .brand span { display: none; }
  /* The avatar already links home, so the "Home" text makes room for Last Ferry */
  .nav-links li:has(> .nav-home) { display: none; }
  .nav-tools { margin-left: 2px; padding-left: 4px; }
  .icon-btn { width: 38px; height: 38px; }
  .widgets { left: 8px; right: 8px; width: auto; max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); }
}

/* ============ Link list page (/linklist) ============ */
.linklist { max-width: 560px; margin: 0 auto; padding: 40px 20px 24px; }
.linklist-head { text-align: center; margin-bottom: 12px; }
.linklist-avatar {
  width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%;
  box-shadow: 0 0 0 5px var(--glass-edge), 0 16px 40px -12px var(--glass-shadow);
  animation: pop-in .9s var(--ease) both;
}
.linklist-head h1 { margin: 0; font-size: clamp(40px, 8vw, 56px); letter-spacing: -.035em; line-height: 1.05; animation: rise .8s var(--ease) .1s both; }
.linklist-head p { margin: 8px 0 0; color: var(--muted); font-size: 18px; animation: rise .8s var(--ease) .18s both; }
.linklist-group {
  margin: 28px 6px 10px; font-size: 13px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
}
.link-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; } /* minmax(0) lets long handles shorten with "…" instead of widening the page */
.link-rows li { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms + .2s); }
.link-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px 12px 12px; border-radius: 20px; color: var(--text);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.link-row:hover { text-decoration: none; transform: translateY(-2px) scale(1.01); }
.link-row:active { transform: scale(.98); }
.link-icon {
  flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--c, var(--accent)); color: #fff;
}
.link-icon svg { width: 22px; height: 22px; }
.link-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.link-text strong { font-size: 17px; font-weight: 600; }
.link-text small { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-arrow { color: var(--muted); font-size: 18px; transition: transform .25s var(--ease); }
.link-row:hover .link-arrow { transform: translate(2px, -2px); }
.link-row-primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 10px 28px -10px var(--accent); }
.link-row-primary .link-icon { background: rgba(255, 255, 255, .2); }
.link-row-primary .link-text small, .link-row-primary .link-arrow { color: rgba(255, 255, 255, .8); }

/* ============ Ads ============ */
/* Each placement is a labelled glass card with reserved space, so nothing jumps when an ad loads */
.ad-slot { margin: 8px auto; }
.ad-card {
  position: relative; display: flex; flex-direction: column;
  min-height: 150px; padding: 10px 12px 12px; border-radius: 22px; text-align: center;
}
.ad-label {
  align-self: flex-start; margin: 0 4px 8px;
  font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.ad-card ins { width: 100%; min-height: 100px; }
/* Shown until Google fills the slot with an ad */
.ad-placeholder {
  position: absolute; inset: 34px 12px 12px; display: grid; place-items: center; pointer-events: none;
  border: 1.5px dashed var(--hairline); border-radius: 14px; color: var(--muted); font-size: 14px;
}
.ad-card:has(ins[data-ad-status="filled"]) .ad-placeholder { display: none; }
/* No ad to show: keep the placement compact instead of a tall empty box */
.ad-card ins[data-ad-status="unfilled"] { height: 100px !important; overflow: hidden; }
/* Google leaves an empty white frame behind when there's no ad; hide it so the "Ad space" outline shows */
.ad-card ins[data-ad-status="unfilled"] > * { display: none !important; }
@media (max-width: 600px) { .ad-card { min-height: 120px; border-radius: 18px; } }

/* ============ Footer ============ */
.site-footer { margin-top: 40px; padding-bottom: 64px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 13px; } /* room for the floating clock and back-to-top button */
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 22px; padding-bottom: 32px; }
.footer-inner p { margin: 0; }
.footer-inner ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.footer-inner a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; color: var(--muted); }

/* ============ Text pages (privacy, 404) ============ */
.page { max-width: 780px; margin: 40px auto; padding: 40px; border-radius: var(--radius-lg); }
.page h1 { margin: 0 0 8px; font-size: clamp(34px, 5vw, 48px); letter-spacing: -.03em; line-height: 1.1; }
.page h2 { margin: 32px 0 8px; font-size: 21px; }
.page p { color: var(--text); }
.page .meta { color: var(--muted); margin-top: 0; }

/* ============ Motion ============ */

/* Smooth cross-fade between pages, including when going Back (supporting browsers) */
/* (Don't give glass elements their own view-transition-name: it stops their blur from seeing the page behind) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .35s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .45s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: scale(.98); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: scale(1.02); filter: blur(4px); } }

/* Hero entrance on page load */
@keyframes rise { from { opacity: .01; transform: translateY(24px) scale(.97); filter: blur(8px); } }
@keyframes pop-in { from { opacity: .01; transform: scale(.6) rotate(-8deg); } }
.hero .avatar { animation: pop-in 1s var(--ease) .05s both; }
.hero h1 { animation: rise .9s var(--ease) .15s both, sheen 9s linear 1.2s infinite; }
.hero .tagline { animation: rise .9s var(--ease) .28s both; }
/* Animate the glass buttons themselves (animating a wrapper would switch off the blur mid-animation) */
.hero .socials .pill { animation: rise .8s var(--ease) both; }
.hero .socials li:nth-child(1) .pill { animation-delay: .42s; }
.hero .socials li:nth-child(2) .pill { animation-delay: .5s; }
.hero .socials li:nth-child(3) .pill { animation-delay: .58s; }
.nav { animation: rise .8s var(--ease) both; }

/* A slow colour sweep across the name */
.hero h1 {
  background: linear-gradient(100deg, var(--text) 35%, #0a84ff 45%, #bf5af2 50%, #ff375f 55%, var(--text) 65%);
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  /* Room for the tail of letters like "g", which would otherwise fall outside the painted area */
  padding-bottom: .14em; margin-bottom: -.14em;
}
@keyframes sheen {
  0%, 55% { background-position: 100% 0; }
  100% { background-position: 0% 0; }
}

/* Fade-and-rise. Things on the first screen play it straight away in CSS, so they never wait for a script;
   main.js marks the ones further down "wait" and adds "in" as each scrolls into view. */
.js [data-reveal] { animation: reveal 1s var(--ease) var(--d, 0s) both; }
@keyframes reveal { from { opacity: .01; transform: translateY(40px) scale(.97); } }
.js [data-reveal].wait {
  animation: none;
  opacity: 0;
  transform: translateY(40px) scale(.97);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  transition-delay: var(--d, 0s);
}
.js [data-reveal].wait.in { opacity: 1; transform: none; }

/* Nav firms up once you scroll */
.nav { transition: box-shadow .4s var(--ease), background .4s var(--ease); }
.site-header.scrolled .nav {
  --glass-tint: var(--glass-tint-strong);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 14px 40px -12px var(--glass-shadow);
}

/* Reading progress bar */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; pointer-events: none;
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, #0a84ff, #bf5af2, #ff375f);
}

/* Liquid highlight that follows the pointer on glass controls */
.glow { position: relative; }
.glow::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 65%);
  opacity: 0; transition: opacity .35s;
}
@media (hover: hover) { .glow:hover::after { opacity: 1; } }

/* Scroll-linked effects (Chrome/Edge/Safari 26+; other browsers simply skip them) */
@supports (animation-timeline: view()) {
  .hero-intro {
    animation: hero-out linear both;
    animation-timeline: view();
    animation-range: exit -10% exit 90%;
  }
  @keyframes hero-out { to { opacity: 0; transform: translateY(-60px) scale(.88); filter: blur(6px); } }

  .carousel { view-timeline: --gallery block; }
  .track img {
    animation: img-zoom linear both;
    animation-timeline: --gallery;
    animation-range: entry 0% cover 55%;
  }
  @keyframes img-zoom { from { transform: scale(1.2); } }
}

/* ============ Clock overlay ============ */
.clock {
  position: fixed; left: 16px; bottom: 16px; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px; border-radius: 999px;
  color: var(--text); font: 600 15px/1.15 var(--font); cursor: pointer;
  font-variant-numeric: tabular-nums;
  animation: rise .9s var(--ease) .9s both;
  transition: padding .4s var(--ease), transform .2s var(--ease);
}
.clock:active { transform: scale(.96); }
.clock-face {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--hairline), inset 0 2px 6px var(--glass-shadow);
}
/* 12 hour marks */
.clock-face::before {
  content: ""; position: absolute; inset: 3px; border-radius: 50%;
  background: repeating-conic-gradient(var(--muted) 0 1.6deg, transparent 1.6deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 13px, #000 13.5px);
  mask: radial-gradient(circle, transparent 13px, #000 13.5px);
  opacity: .6;
}
/* Centre pin */
.clock-face::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
  border-radius: 50%; background: #ff9f0a;
}
/* Hands start at the current time (--a, set by main.js) and keep turning on their own */
.hand {
  position: absolute; left: 50%; bottom: 50%; border-radius: 2px; transform-origin: 50% 100%;
  transform: rotate(var(--a, 0deg));
  animation: spin linear infinite;
}
.hand.hour { width: 3px; height: 10px; margin-left: -1.5px; background: var(--text); animation-duration: 43200s; }
.hand.minute { width: 2px; height: 15px; margin-left: -1px; background: var(--text); animation-duration: 3600s; }
.hand.second { width: 1px; height: 17px; margin-left: -.5px; background: #ff9f0a; animation-duration: 60s; }
@keyframes spin { to { rotate: 360deg; } }
.clock-text { display: flex; flex-direction: column; align-items: flex-start; overflow: hidden; max-width: 140px; transition: max-width .45s var(--ease), opacity .3s; }
.clock-time { display: flex; font-size: 16px; letter-spacing: -.01em; }
.clock-time span { display: inline-block; }
.clock-time .roll { animation: roll .45s var(--ease); }
@keyframes roll { from { transform: translateY(-70%); opacity: 0; filter: blur(2px); } }
.clock-date { font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.clock.compact { padding-right: 6px; }
.clock.compact .clock-text { max-width: 0; opacity: 0; }

/* ============ Back to top ============ */
.totop {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  width: 52px; height: 52px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--text);
  opacity: 0; transform: translateY(20px) scale(.8); pointer-events: none;
  transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.totop.show { opacity: 1; transform: none; pointer-events: auto; }
.totop.show:hover { transform: translateY(-3px); }
.totop > svg { grid-area: 1 / 1; }
.totop-arrow { width: 20px; height: 20px; }
.totop.show:hover .totop-arrow { animation: nudge .8s var(--ease) infinite; }
@keyframes nudge { 50% { transform: translateY(-3px); } }
.totop-ring { width: 52px; height: 52px; transform: rotate(-90deg); }
.totop-ring circle {
  fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 138.23; stroke-dashoffset: calc(138.23 * (1 - var(--p, 0)));
}

/* Keep the floating controls clear of the footer text on small screens */
@media (max-width: 600px) {
  .site-footer { padding-bottom: 72px; }
  .clock { left: 12px; bottom: 12px; padding-right: 12px; gap: 8px; }
  .clock-face { width: 34px; height: 34px; }
  .clock-face::before { -webkit-mask: radial-gradient(circle, transparent 10.5px, #000 11px); mask: radial-gradient(circle, transparent 10.5px, #000 11px); }
  .hand.hour { height: 8px; } .hand.minute { height: 12px; } .hand.second { height: 14px; }
  .clock-time { font-size: 14px; }
  .clock-date { display: none; }
  .totop { right: 12px; bottom: 12px; width: 46px; height: 46px; }
  .totop-ring { width: 46px; height: 46px; }
}

/* ============ Phones ============ */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header { padding: 8px 8px 0; }
  .nav { padding: 0 6px 0 10px; }
  .nav-links > li > a { padding: 0 11px; height: 40px; }
  /* Extra shortcuts stay on wider screens; everything is still one tap away on /linklist */
  .wide-only { display: none; }
  /* When the links don't all fit, the row swipes sideways (the buttons stay put);
     topbar.js adds the classes that fade whichever edge has more links behind it */
  .nav-links { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px 0; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links > li { flex: none; }
  .nav-links.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .nav-links.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); }
  .nav-links.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); }

  .hero { padding: 48px 20px 40px; }
  .avatar { width: 128px; height: 128px; margin-bottom: 22px; }
  .socials { gap: 10px; margin-top: 28px; }
  .pill { height: 44px; padding: 0 18px; font-size: 15px; }

  .container, .section { padding-left: 16px; padding-right: 16px; }
  .section { padding-top: 40px; padding-bottom: 40px; }
  .feed-grid, .carousel { margin-top: 24px; }
  .panel { padding: 12px; border-radius: 22px; }
  .spotify { min-height: 380px; }
  .carousel { padding: 6px; border-radius: 22px; }
  .track { border-radius: 16px; }

  .footer-inner { flex-direction: column; text-align: center; }
  .page { margin: 24px 12px; padding: 24px 20px; }
}
@media (max-width: 374px) {
  /* Small phones: tighter bar so more of the links show before swiping */
  .site-header { padding-left: 6px; padding-right: 6px; }
  .nav { padding: 0 4px 0 8px; }
  .nav-links { gap: 0; }
  .nav-links > li > a { padding: 0 8px; font-size: 13px; }
  .icon-btn { width: 36px; height: 36px; }
  .nav-tools { gap: 2px; padding-left: 2px; }
}

/* Phones turned sideways: shorter hero so content starts on the first screen */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding-top: 32px; padding-bottom: 28px; }
  .avatar { width: 96px; height: 96px; margin-bottom: 14px; }
  .spotify { min-height: 300px; }
}

/* Touch screens: swipe the gallery instead of using arrow buttons */
@media (hover: none) and (pointer: coarse) {
  .nav-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
