/* LoveCreates — shared styles for every page. */

:root {
  --bg: #F3EEE6;
  --ink: #2E2A25;
  --muted: #4A433C;
  --soft: #6B6259;
  --accent: #7A5C2E;
  --line: rgba(46, 42, 37, 0.16);
  --pill: rgba(250, 247, 241, 0.6);
  --pill-hover: rgba(250, 247, 241, 0.9);
  --pill-line: rgba(46, 42, 37, 0.14);
  --gutter: 28px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
/* Night: chosen with the toggle (data-theme), else follows the visitor's setting. */
:root[data-theme="dark"] {
  color-scheme: dark;
    --bg: #141B2E;
    --ink: #EFE8DC;
    --muted: rgba(239, 232, 220, 0.8);
    --soft: rgba(239, 232, 220, 0.62);
    --accent: #D4B27A;
    --line: rgba(239, 232, 220, 0.18);
    --pill: rgba(255, 255, 255, 0.08);
    --pill-hover: rgba(255, 255, 255, 0.16);
    --pill-line: rgba(239, 232, 220, 0.16);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #141B2E;
    --ink: #EFE8DC;
    --muted: rgba(239, 232, 220, 0.8);
    --soft: rgba(239, 232, 220, 0.62);
    --accent: #D4B27A;
    --line: rgba(239, 232, 220, 0.18);
    --pill: rgba(255, 255, 255, 0.08);
    --pill-hover: rgba(255, 255, 255, 0.16);
    --pill-line: rgba(239, 232, 220, 0.16);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh; min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 999px; }
.serif { font-family: "Cormorant Garamond", Georgia, serif; }

/* ---------- Full-screen backdrop (each page fills it differently) ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); view-transition-name: backdrop; }

/* ---------- Top bar ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 18px var(--gutter) 0;
  view-transition-name: bar;
}
.wordmark { grid-column: 2; display: inline-flex; align-items: center; gap: 6px; font: 500 22px/1 "Hanken Grotesk", Inter, system-ui, sans-serif; letter-spacing: -0.02em; }
.wordmark .logo { width: 34px; height: 34px; margin-left: -5px; fill: currentColor; flex: none; }
.actions { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 8px; }
.mail, .theme {
  grid-column: 3; justify-self: end;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--pill); border: 1px solid var(--pill-line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s;
}
.mail:hover, .theme:hover { background: var(--pill-hover); }
.theme { padding: 0; color: inherit; cursor: pointer; font: inherit; }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme .sun { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
:root[data-theme="dark"] .theme .moon { display: none; }
.mail svg, .theme svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Project pills (left side) ---------- */
.projects {
  position: fixed; left: var(--gutter); top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  margin: 0; padding: 0; list-style: none;
  view-transition-name: projects;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 999px;
  font-size: 15px;
  background: var(--pill); border: 1px solid transparent;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s, border-color 0.2s;
}
.pill:hover { background: var(--pill-hover); }
.pill[aria-current="page"] { border-color: currentColor; background: transparent; }
.pill.quiet { color: var(--soft); }

/* ---------- Page content ---------- */
.stage {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  padding: 0 var(--gutter);
  view-transition-name: stage;
}
.fine {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 20px;
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 12px; color: var(--soft);
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  :root { --gutter: 20px; }
  .bar { grid-template-columns: auto 1fr auto; padding-top: 14px; }
  .wordmark { grid-column: 1; }
  .projects {
    top: auto; bottom: 52px; transform: none;
    flex-direction: row; flex-wrap: wrap;
  }
}

/* ---------- Page-to-page transition (Chrome, Edge, Safari 18.2+) ---------- */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(*) { animation-duration: 0.9s; animation-timing-function: var(--ease); }

  /* The backdrop dissolves; the new one settles in from a slight zoom. */
  ::view-transition-old(backdrop) { animation: 0.9s var(--ease) both vt-fade-out; }
  ::view-transition-new(backdrop) { animation: 1.1s var(--ease) both vt-settle; }

  /* Words lift away, then the new ones rise in. */
  ::view-transition-old(stage) { animation: 0.45s var(--ease) both vt-lift-out; }
  ::view-transition-new(stage) { animation: 0.8s var(--ease) 0.3s both vt-rise-in; }

  @keyframes vt-fade-out { to { opacity: 0; } }
  @keyframes vt-settle { from { opacity: 0; transform: scale(1.05); } }
  @keyframes vt-lift-out { to { opacity: 0; transform: translateY(-14px); } }
  @keyframes vt-rise-in { from { opacity: 0; transform: translateY(18px); } }

  /* First load */
  .rise { animation: rise 1s var(--ease) both; }
  .d1 { animation-delay: 0.12s; } .d2 { animation-delay: 0.24s; } .d3 { animation-delay: 0.36s; }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } }

  /* Switching day/night: a soft cross-fade of the whole page, nothing moves.
     (html.theming::… is more specific, so it wins over the page-to-page animations above.) */
  html.theming::view-transition-group(*) { animation-duration: 0.8s; }
  html.theming::view-transition-old(*) { animation: 0.8s ease both vt-fade-out; }
  html.theming::view-transition-new(*) { animation: 0.8s ease both vt-fade-in; }
  @keyframes vt-fade-in { from { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
