/* ==========================================================================
   dannyhanes.com — Apple-inspired design system
   Light-first. SF system typography, frosted materials, hairline borders,
   pill buttons, Home-app tiles. Accent derives from --hue (Apple system
   colors via the Accent card). Dark mode = macOS dark, via [data-theme].
   ========================================================================== */

:root {
  --hue: 211; /* Apple system blue */

  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --card: rgba(255, 255, 255, 0.76);
  --card-solid: #ffffff;
  --card-border: rgba(0, 0, 0, 0.07);
  --card-hover-border: rgba(0, 0, 0, 0.12);
  --text: #1d1d1f;
  --text-muted: #515154;
  --text-faint: #86868b;
  --accent: hsl(var(--hue), 100%, 45%);
  --accent-strong: hsl(var(--hue), 100%, 40%);
  --accent-soft: hsla(var(--hue), 90%, 45%, 0.1);
  --accent-glow: hsla(var(--hue), 95%, 50%, 0.18);
  --avatar-bg: linear-gradient(135deg, hsl(var(--hue), 90%, 52%), hsl(calc(var(--hue) + 40), 80%, 58%));
  --code-bg: #1d1d1f;
  --code-text: #e8e8ed;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.09);
  --header-bg: rgba(251, 251, 253, 0.78);
  --aurora-opacity: 0.5;
  --ok: #34c759;
  --warn: #ff9f0a;
  --danger: #ff3b30;
}

[data-theme="dark"] {
  --bg: #161617;
  --bg-elevated: #1d1d1f;
  --card: rgba(29, 29, 31, 0.76);
  --card-solid: #1d1d1f;
  --card-border: rgba(255, 255, 255, 0.11);
  --card-hover-border: rgba(255, 255, 255, 0.22);
  --text: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-faint: #6e6e73;
  --accent: hsl(var(--hue), 100%, 60%);
  --accent-strong: hsl(var(--hue), 100%, 66%);
  --accent-soft: hsla(var(--hue), 90%, 60%, 0.14);
  --accent-glow: hsla(var(--hue), 95%, 60%, 0.25);
  --code-bg: #0d0d0e;
  --code-text: #d8d8dd;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.4), 0 14px 36px rgba(0, 0, 0, 0.5);
  --header-bg: rgba(22, 22, 23, 0.72);
  --aurora-opacity: 0.45;
  --ok: #30d158;
  --warn: #ffd60a;
  --danger: #ff453a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 3px solid var(--accent-glow); outline-offset: 2px; border-radius: 8px; }

/* ---------- Background: soft accent wash + faint particle field ---------- */
.aurora {
  position: fixed;
  inset: -20%;
  z-index: -3;
  pointer-events: none;
  opacity: var(--aurora-opacity);
  filter: blur(80px);
  background:
    radial-gradient(40% 34% at 20% 12%, hsla(var(--hue), 90%, 60%, 0.10), transparent 70%),
    radial-gradient(32% 30% at 82% 8%, hsla(calc(var(--hue) + 50), 85%, 62%, 0.08), transparent 70%),
    radial-gradient(38% 36% at 70% 85%, hsla(calc(var(--hue) - 30), 85%, 60%, 0.06), transparent 70%);
  animation: aurora-drift 32s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  to   { transform: translate3d(1.5%, 1.5%, 0) scale(1.05); }
}
#particles { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
.spotlight {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(620px circle at var(--mx, 50%) var(--my, 30%), var(--accent-glow), transparent 72%);
  opacity: 0.35;
}

/* ---------- Header: frosted toolbar ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  padding: 0.7rem 1.25rem;
  display: flex;
  justify-content: center;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid var(--card-border);
}
.site-header .header-inner {
  width: 100%;
  max-width: 860px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.wordmark {
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.022em;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.wordmark .mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}
.site-nav { display: flex; gap: 0.15rem; align-items: center; flex-wrap: wrap; }
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover { color: var(--text); background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.38rem 0.6rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-btn:hover { color: var(--text); background: var(--accent-soft); }
.nav-btn svg { width: 15px; height: 15px; }
.nav-btn .kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 0.05rem 0.3rem;
  color: var(--text-faint);
}
@media (max-width: 560px) { .nav-btn .kbd, .nav-btn .btn-label { display: none; } }

/* ---------- Layout ---------- */
main.page {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  flex: 1;
}
.page-title {
  font-size: clamp(2rem, 5.5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.1;
}
.page-sub { margin-top: 0.6rem; color: var(--text-muted); max-width: 40rem; font-size: 1.05rem; }

/* Scroll-reveal (activated only when JS tags the page) */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.65s cubic-bezier(0.25, 0.1, 0.25, 1);
  transition-delay: var(--reveal-delay, 0s);
}
.js-reveal .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Hero ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(2rem, 7vh, 4.5rem) 0 1rem;
}
.avatar-ring {
  width: 122px;
  height: 122px;
  border-radius: 50%;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-hover);
}
.avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.hero h1 {
  margin-top: 1.5rem;
  font-size: clamp(2.5rem, 8vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.tagline {
  margin-top: 0.7rem;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  color: var(--text-muted);
  font-weight: 480;
  min-height: 1.8em;
}
.tagline .typed { color: var(--accent); font-weight: 600; }
.tagline .caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent);
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.bio { margin-top: 1.2rem; max-width: 36rem; color: var(--text-muted); font-size: 1.02rem; }
.cta-row { margin-top: 1.9rem; display: flex; gap: 0.8rem; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.35rem;
  border-radius: 999px;
  font-weight: 550;
  font-size: 0.98rem;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); box-shadow: 0 6px 20px -6px var(--accent-glow); }
.btn-ghost { background: var(--accent-soft); color: var(--accent); }
.btn-ghost:hover { background: var(--accent-glow); }

/* ---------- Section headings ---------- */
.section { margin-top: clamp(3rem, 8vh, 4.5rem); }
.section-title {
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.018em;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--card-border); }

/* ---------- Link cards ---------- */
.links {
  margin-top: 1.4rem;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  list-style: none;
}
.links a {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  height: 100%;
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.18s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.18s ease;
}
.links a:hover, .links a:focus-visible { box-shadow: var(--shadow-hover); outline: none; }
.icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.icon svg { width: 20px; height: 20px; }
.link-text { display: flex; flex-direction: column; min-width: 0; }
.link-title { font-weight: 590; font-size: 0.96rem; }
.link-sub {
  font-size: 0.83rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arrow { margin-left: auto; flex: none; color: var(--text-faint); transition: transform 0.15s ease, color 0.15s ease; }
.links a:hover .arrow { transform: translateX(3px); color: var(--accent); }

/* ---------- Blog listing ---------- */
.post-list { list-style: none; margin-top: 1.8rem; display: flex; flex-direction: column; gap: 1.3rem; }
.post-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.18s cubic-bezier(0.25, 0.1, 0.25, 1), box-shadow 0.18s ease;
}
.post-card:hover { box-shadow: var(--shadow-hover); }
.post-card img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.post-card-body { padding: 1.15rem 1.3rem 1.35rem; }
.post-meta { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; color: var(--text-faint); }
.tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 590;
  font-size: 0.76rem;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
}
.post-card h2 { margin-top: 0.5rem; font-size: 1.35rem; font-weight: 650; letter-spacing: -0.015em; }
.post-card p { margin-top: 0.4rem; color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Article / prose ---------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--accent);
  z-index: 60;
}
.prose { margin-top: 1.6rem; }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { margin-top: 2.6rem; font-size: 1.5rem; font-weight: 650; letter-spacing: -0.018em; }
.prose h3 { margin-top: 1.9rem; font-size: 1.13rem; font-weight: 600; }
.prose p, .prose li { color: var(--text-muted); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.35rem; }
.prose img { border-radius: 14px; border: 1px solid var(--card-border); box-shadow: var(--shadow); }
.prose blockquote {
  border-left: 3px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  border-radius: 0 14px 14px 0;
  padding: 0.9rem 1.1rem;
  color: var(--text);
  font-size: 0.95rem;
}
.prose code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--accent-soft);
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
}
.codeblock { position: relative; }
.codeblock pre {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}
.codeblock pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(235, 235, 245, 0.12);
  color: #d8d8dd;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 590;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.copy-btn:hover { background: rgba(235, 235, 245, 0.24); }
.article-header .post-meta { margin-bottom: 0.7rem; }
.article-hero { margin-top: 1.6rem; border-radius: 16px; border: 1px solid var(--card-border); box-shadow: var(--shadow); }

/* ---------- Career timeline ---------- */
.timeline { list-style: none; margin-top: 2.2rem; display: flex; flex-direction: column; gap: 1.3rem; }
.job {
  display: flex;
  gap: 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease;
}
.job:hover { box-shadow: var(--shadow-hover); }
.job-logo { flex: none; width: 56px; height: 56px; border-radius: 14px; object-fit: cover; border: 1px solid var(--card-border); }
.job h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.012em; }
.job .role { color: var(--text-muted); font-size: 0.92rem; margin-top: 0.1rem; }
.job .dates { color: var(--text-faint); font-size: 0.82rem; margin-top: 0.1rem; }
.job-body { margin-top: 0.8rem; }
.job-body p, .job-body li { color: var(--text-muted); font-size: 0.94rem; }
.job-body > * + * { margin-top: 0.7rem; }
.job-body ul { padding-left: 1.3rem; }
.job-body li + li { margin-top: 0.3rem; }
@media (max-width: 540px) { .job { flex-direction: column; } }

/* ---------- Footer ---------- */
.site-footer {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-faint);
  border-top: 1px solid var(--card-border);
}
.site-footer .socials { display: flex; gap: 0.9rem; align-items: center; }
.site-footer .socials a { color: var(--text-faint); display: grid; place-items: center; }
.site-footer .socials a:hover { color: var(--accent); }
.site-footer .socials svg { width: 18px; height: 18px; }

/* ---------- Command palette (Spotlight) ---------- */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.2);
  display: grid;
  place-items: start center;
  padding: 16vh 1rem 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
[data-theme="dark"] .cmdk-overlay { background: rgba(0, 0, 0, 0.4); }
.cmdk-overlay.open { opacity: 1; pointer-events: auto; }
.cmdk {
  width: 100%;
  max-width: 580px;
  background: var(--card);
  -webkit-backdrop-filter: saturate(1.8) blur(40px);
  backdrop-filter: saturate(1.8) blur(40px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 24px 70px -18px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.cmdk-overlay.open .cmdk { transform: none; }
.cmdk input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.15rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--card-border);
}
.cmdk input::placeholder { color: var(--text-faint); }
.cmdk-list { max-height: 46vh; overflow-y: auto; padding: 0.5rem; }
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.62rem 0.8rem;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.94rem;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
}
.cmdk-item svg { width: 17px; height: 17px; color: var(--text-faint); flex: none; }
.cmdk-item .cmdk-hint { margin-left: auto; font-size: 0.75rem; color: var(--text-faint); }
.cmdk-item.active { background: var(--accent); color: #fff; }
.cmdk-item.active svg, .cmdk-item.active .cmdk-hint { color: rgba(255, 255, 255, 0.8); }
.cmdk-empty { padding: 1.2rem; text-align: center; color: var(--text-faint); font-size: 0.9rem; }

/* ---------- 404 ---------- */
.notfound { flex: 1; display: grid; place-items: center; text-align: center; padding: 3rem 1.25rem; }
.notfound h1 {
  font-size: clamp(4rem, 16vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--text);
}
.notfound p { color: var(--text-muted); margin-top: 0.8rem; }

/* ---------- Party mode (Konami code) ---------- */
html.party { animation: party-hue 5s linear infinite; }
@keyframes party-hue {
  from { --hue: 0; }
  25% { --hue: 90; }
  50% { --hue: 180; }
  75% { --hue: 270; }
  to { --hue: 360; }
}

/* ---------- Cross-document view transitions ---------- */
@view-transition { navigation: auto; }
html:not(.theme-vt)::view-transition-old(root) { animation: vt-out 0.2s ease both; }
html:not(.theme-vt)::view-transition-new(root) { animation: vt-in 0.28s ease both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }
/* Theme toggle drives its own circular clip animation from JS */
.theme-vt::view-transition-old(root) { animation: none; }
.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  .js-reveal .reveal { opacity: 1; transform: none; }
  .aurora { animation: none; }
  .tagline .caret { animation: none; }
}
