/* Site styles shared by the Puck editor preview and the exported static site.
   Everything is scoped under .site so it never leaks into the editor UI. */

:root {
  --s-bg: #fbfbfd;
  --s-surface: #ffffff;
  --s-text: #1b1d24;
  --s-muted: #5d6270;
  --s-border: #e3e5eb;
  --s-accent: #2f5bea;
  --s-accent-text: #ffffff;
  --s-accent-soft: #e9eefd;
  --s-code-bg: #f3f4f7;
  --s-shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 16px rgb(16 24 40 / 6%);
  --s-radius: 12px;
  --s-max: 960px;
  --s-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  --s-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --s-bg: #0f1115;
    --s-surface: #171a21;
    --s-text: #e7e9ee;
    --s-muted: #9aa1b2;
    --s-border: #2a2f3a;
    --s-accent: #7d9bff;
    --s-accent-text: #0f1115;
    --s-accent-soft: #1d2540;
    --s-code-bg: #1b1f27;
    --s-shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
  }
}

html { -webkit-text-size-adjust: 100%; }
body.site-body { margin: 0; background: var(--s-bg); }

.site {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--s-bg);
  color: var(--s-text);
  font-family: var(--s-font);
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: break-word;
}
.site *, .site *::before, .site *::after { box-sizing: border-box; }
.site a { color: var(--s-accent); text-decoration: none; }
.site a:hover { text-decoration: underline; }
.site img { max-width: 100%; height: auto; }
.site h1, .site h2, .site h3 { line-height: 1.25; margin: 0 0 0.5em; letter-spacing: -0.01em; }
.site p { margin: 0 0 1em; }
.site:lang(zh) { line-height: 1.8; letter-spacing: 0.01em; }
.site :focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; border-radius: 4px; }

.s-container { width: 100%; max-width: var(--s-max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .s-container { padding: 0 24px; } }
.s-block { margin: 12px auto; }
.s-muted { color: var(--s-muted); }
.s-icon { flex: none; }

/* Navbar */
.s-nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--s-bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--s-border); }
.s-nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 60px; flex-wrap: wrap; padding-block: 10px; }
.site .s-brand { font-weight: 700; color: var(--s-text); font-size: 1.05rem; }
.s-nav-links { display: flex; align-items: center; gap: 4px 18px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.site .s-nav-links a { color: var(--s-muted); font-size: 0.95rem; }
.site .s-nav-links a:hover { color: var(--s-text); text-decoration: none; }
.s-lang { display: inline-flex; align-items: center; border: 1px solid var(--s-border); border-radius: 999px; overflow: hidden; font-size: 0.8rem; font-weight: 600; }
.s-lang > * { padding: 2px 10px; line-height: 1.6; }
.site .s-lang a { color: var(--s-muted); }
.site .s-lang a:hover { background: var(--s-surface); color: var(--s-text); }
.s-lang [aria-current] { background: var(--s-text); color: var(--s-bg); }
/* Icon links (e.g. GitHub) sit at the far right of the navbar */
.s-nav-icon a { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-right: -7px; border-radius: 999px; }
.site .s-nav-icon a:hover { background: var(--s-surface); color: var(--s-text); }
.s-nav-icon .s-icon { width: 20px; height: 20px; }
/* The language switch lives on blog pages (lists and articles), not in the navbar */
/* "/" (language picker; normally skipped by assets/lang.js) */
.s-lang-pick { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.s-lang-pick p { margin: 0; font-weight: 700; font-size: 1.2rem; }
.s-lang-pick .s-lang { font-size: 1rem; }
.s-lang-pick .s-lang a { padding: 6px 18px; }
.s-lang-bar { display: flex; padding-top: 28px; margin-bottom: -12px; }
.s-lang-bar-right { justify-content: flex-end; }
.s-article-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.s-article-top .s-back { margin-bottom: 0; }

/* Hero */
.s-hero { padding: 72px 0 48px; }
.s-hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.s-eyebrow { color: var(--s-accent); font-weight: 600; margin-bottom: 4px !important; }
.site .s-hero-name { font-size: clamp(2.2rem, 6vw, 3.4rem); margin-bottom: 4px; }
.s-hero-role { font-size: clamp(1.15rem, 3vw, 1.5rem); color: var(--s-muted); font-weight: 500; }
.s-hero-tagline { max-width: 36em; font-size: 1.1rem; }
.s-avatar { width: 176px; height: 176px; border-radius: 50%; object-fit: cover; border: 4px solid var(--s-surface); box-shadow: var(--s-shadow); flex: none; }
@media (max-width: 720px) {
  .s-hero { padding: 40px 0 24px; }
  .s-hero-inner { flex-direction: column-reverse; align-items: flex-start; gap: 24px; }
  .s-avatar { width: 112px; height: 112px; }
}

/* Buttons */
.s-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.site .s-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 0.95rem; border: 1px solid transparent; transition: transform .15s ease, background .15s ease; }
.site .s-btn:hover { text-decoration: none; transform: translateY(-1px); }
.site .s-btn-primary { background: var(--s-accent); color: var(--s-accent-text); }
.site .s-btn-secondary { background: transparent; color: var(--s-text); border-color: var(--s-border); }
.site .s-btn-secondary:hover { background: var(--s-surface); }

/* Sections */
.s-section { padding: 40px 0; }
.s-section-title { font-size: 1.6rem; }
.s-lead { font-size: 1.1rem; color: var(--s-muted); }
.s-prose { max-width: 42em; }

.s-skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.s-skill-group h3 { font-size: 1rem; color: var(--s-muted); font-weight: 600; }
.s-tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.s-tags li { background: var(--s-accent-soft); color: var(--s-text); padding: 4px 12px; border-radius: 999px; font-size: 0.9rem; }
.s-tags-sm li { font-size: 0.78rem; padding: 2px 10px; }

.s-timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--s-border); }
.s-timeline li { position: relative; padding: 0 0 24px 20px; }
.s-timeline li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--s-accent); }
.s-timeline-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.s-timeline h3 { font-size: 1.1rem; margin: 0; }
.s-period { color: var(--s-muted); font-size: 0.9rem; }
.s-timeline p { margin: 6px 0 0; }

.s-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.site .s-card { display: flex; flex-direction: column; gap: 8px; padding: 20px; background: var(--s-surface); border: 1px solid var(--s-border); border-radius: var(--s-radius); color: var(--s-text); transition: border-color .15s ease, transform .15s ease; }
.site .s-card:hover { text-decoration: none; border-color: var(--s-accent); transform: translateY(-2px); }
.s-card h3 { font-size: 1.1rem; margin: 0; }
.s-card p { color: var(--s-muted); margin: 0; flex: 1; }

.s-social { display: flex; flex-wrap: wrap; gap: 12px; list-style: none; margin: 0; padding: 0; }
.site .s-social a { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border: 1px solid var(--s-border); border-radius: 999px; background: var(--s-surface); color: var(--s-text); font-weight: 500; }
.site .s-social a:hover { border-color: var(--s-accent); text-decoration: none; }

/* Post list */
.s-posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.site .s-posts a { display: block; padding: 16px; margin: 0 -16px; border-radius: var(--s-radius); color: var(--s-text); }
.site .s-posts a:hover { background: var(--s-surface); text-decoration: none; }
.s-posts time { color: var(--s-muted); font-size: 0.85rem; }
.s-posts h3 { font-size: 1.15rem; margin: 2px 0 4px; }
.s-posts p { color: var(--s-muted); margin: 0; }
.s-more { font-weight: 600; }

.s-heading { margin: 0; }
.s-heading-h1 { padding-top: 48px; }
.site .s-heading-h1 .s-heading { font-size: clamp(2rem, 5vw, 2.6rem); }
.s-section:has(> .s-container > .s-posts:first-child) { padding-top: 8px; }
.s-spacer-sm { height: 16px; } .s-spacer-md { height: 40px; } .s-spacer-lg { height: 80px; }

/* Footer */
.s-footer { margin-top: auto; padding: 32px 0; border-top: 1px solid var(--s-border); color: var(--s-muted); font-size: 0.9rem; }

/* Article */
.s-article { padding: 48px 0 32px; }
.s-article-inner { max-width: 760px; }
.s-article-header { margin-bottom: 32px; }
.site .s-article-header h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
.s-article-meta { color: var(--s-muted); font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.s-article-meta .s-tags li { font-size: 0.78rem; padding: 2px 10px; }
.s-back { display: inline-block; margin-bottom: 24px; font-size: 0.95rem; }
.s-markdown h2 { font-size: 1.5rem; margin-top: 2em; }
.s-markdown h3 { font-size: 1.2rem; margin-top: 1.6em; }
.s-markdown ul, .s-markdown ol { padding-left: 1.4em; margin: 0 0 1em; }
.s-markdown li + li { margin-top: 0.25em; }
.s-markdown blockquote { margin: 0 0 1em; padding: 4px 16px; border-left: 4px solid var(--s-border); color: var(--s-muted); }
.s-markdown hr { border: 0; border-top: 1px solid var(--s-border); margin: 2em 0; }
.s-markdown img { border-radius: 8px; }
.s-markdown table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; margin: 0 0 1em; }
.s-markdown th, .s-markdown td { border: 1px solid var(--s-border); padding: 6px 12px; text-align: left; }
.s-markdown code { font-family: var(--s-mono); font-size: 0.88em; background: var(--s-code-bg); padding: 0.15em 0.4em; border-radius: 6px; }
.s-markdown pre { background: var(--s-code-bg); border: 1px solid var(--s-border); border-radius: 10px; padding: 16px; overflow-x: auto; line-height: 1.5; margin: 0 0 1.2em; }
.s-markdown pre code { background: none; padding: 0; font-size: 0.85rem; }
.s-markdown pre code.hljs { background: none; padding: 0; }

/* Full-screen 3D home (Hero3D): the page is the tech galaxy */
.s-h3d {
  --h3d-bg: radial-gradient(110% 85% at 50% 45%, #eef2fd 0%, #f4f6fc 50%, #e8edf8 100%);
  --h3d-card: rgb(255 255 255 / 60%);
  position: relative;
  height: 100vh;
  height: 100dvh; /* follows mobile browser toolbars, so nothing hangs below the screen */
  overflow: hidden;
  background: var(--h3d-bg);
  color: var(--s-text);
}
@media (prefers-color-scheme: dark) {
  .s-h3d-auto {
    --h3d-bg: radial-gradient(110% 85% at 50% 45%, #0d1430 0%, #060a17 55%, #02040a 100%);
    --h3d-card: rgb(12 16 30 / 55%);
  }
}
/* Forced scene themes also force the overlay colours so text stays readable. */
.s-h3d-dark {
  --s-text: #e7e9ee; --s-muted: #9aa1b2; --s-border: #2a2f3a; --s-surface: #171a21;
  --s-accent: #7d9bff; --s-accent-text: #0f1115;
  --h3d-bg: radial-gradient(110% 85% at 50% 45%, #0d1430 0%, #060a17 55%, #02040a 100%);
  --h3d-card: rgb(12 16 30 / 55%);
}
.s-h3d-light {
  --s-text: #1b1d24; --s-muted: #5d6270; --s-border: #e3e5eb; --s-surface: #ffffff;
  --s-accent: #2f5bea; --s-accent-text: #ffffff;
  --h3d-bg: radial-gradient(110% 85% at 50% 45%, #eef2fd 0%, #f4f6fc 50%, #e8edf8 100%);
  --h3d-card: rgb(255 255 255 / 60%);
}
/* drags rotate the galaxy instead of scrolling or bouncing the page */
.s-h3d-canvas { position: absolute; inset: 0; touch-action: none; opacity: 0; transition: opacity .4s ease; }
.s-h3d-canvas.is-ready { opacity: 1; }

/* Visually hidden, still read by screen readers and search engines */
.s-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* A navbar placed above Hero3D floats over the scene. */
.site:has(.s-h3d) .s-nav { position: absolute; left: 0; right: 0; z-index: 2; background: transparent; border-bottom-color: transparent; backdrop-filter: none; }
.site:has(.s-h3d) .s-footer { margin-top: 0; }
.site:has(.s-h3d) { position: relative; min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; }
/* The galaxy page is exactly one screen: no scrolling, no overscroll bounce or pull-to-refresh */
html:has(.s-h3d), body:has(.s-h3d) { height: 100%; overflow: hidden; overscroll-behavior: none; }

/* Planet links: hidden visually while the 3D scene runs (it shows the planets); shown as chips without WebGL */
.s-h3d-planets { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.s-h3d-planets:focus-within { position: absolute; left: 16px; bottom: 16px; width: auto; height: auto; clip-path: none; z-index: 2; }
.s-h3d:not(:has(.s-h3d-canvas.is-ready)) .s-h3d-planets { position: absolute; left: 0; right: 0; bottom: 24px; width: auto; height: auto; clip-path: none; z-index: 1; }
.s-h3d-planets ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; margin: 0; padding: 0 16px; }
.site .s-h3d-planets a { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--s-border); background: var(--h3d-card); color: var(--s-text); font-size: 0.9rem; }

/* Tag chips link to tag pages */
.site .s-tags a { color: inherit; }
.site .s-tags a:hover { text-decoration: none; color: var(--s-accent); }
