/* chenhao.do — the site's own components, loaded after look/tokens.css and before look/glass.css
   (design system v2.0, look.md § load order). Every value is a token from look/tokens.css; this
   file never declares one. glass.css finishes the card, the buttons and the page mesh over these.
   The page layout is in page.css, the house illustration's motion in src/styles/scene.css. */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--s7) + var(--s4));   /* anchors stop below the fixed bar */
  scrollbar-gutter: stable;
}
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font: var(--t-base)/1.5 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: padding-box;
  min-height: 32px; min-width: 32px;
}
::-webkit-scrollbar-thumb:hover { background: var(--mut); background-clip: padding-box; }

.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 {
  position: fixed; top: var(--s2); left: var(--s2); z-index: 60;
  padding: var(--s2) var(--s4); border-radius: var(--r-full);
  background: var(--ac-fill); color: var(--on-accent); font-weight: 650; text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus-visible { transform: none; }

/* one focus treatment, keyboard only (components.md § focus treatment) */
:is(button, input, select, textarea, a, [tabindex]):focus-visible {
  outline: none;
  border-color: var(--ac);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ac) 25%, transparent);
}
.icon-btn:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; box-shadow: none; }
main:focus { outline: none; }   /* programmatic target of the skip link only */

/* card (components.md § card). glass.css draws it: --glass, the glass edge and shadow, radius
   --r-card, padding 16 / 18 / 8, --s4 apart. Its contents supply their own bottom space. */
.card h3 { margin: 0 0 var(--s1); line-height: 1.4; }

/* icon button + theme button (components.md § button, § theme button). glass.css makes it a capsule. */
.icon-btn {
  position: relative; width: var(--ctl-w-icon); min-height: var(--ctl-h); padding: 0;
  display: flex; align-items: center; justify-content: center; flex: none;
  background: none; border: 1px solid transparent; color: var(--mut);
  cursor: pointer;
  transition: background var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out),
              color var(--d-fast) var(--ease-out), transform var(--d-fast) var(--ease-out);
}
.icon-btn:active { transform: scale(0.97); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5;
                stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { color: var(--ac-tx); background: var(--in); }
}
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}

/* a link drawn as the default button (components.md § button). glass.css finishes a.button:
   a capsule on --in, no edge, --tx ink. */
a.button {
  display: inline-flex; align-items: center; gap: var(--s1);
  font-size: var(--t-md); font-weight: 600; text-decoration: none;
  border: 1px solid transparent;
  padding: 6px var(--s4); min-height: var(--ctl-h);
  transition: background var(--d-fast) var(--ease-out), transform var(--d-fast) var(--ease-out);
}
a.button:hover { background: var(--line-strong); }
a.button:active { transform: scale(0.97); }
a.button svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2;
               stroke-linecap: round; stroke-linejoin: round; }

/* neutral pill: a kind, not a status, so no status colour (components.md § pills) */
.pill {
  display: inline-block; border-radius: var(--r-full); padding: 2px 8px;
  font-size: var(--t-xs); font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line-strong); color: var(--mut);
}

/* 44px targets on a phone or any touch screen (look.md § targets) */
@media (max-width: 760px), (pointer: coarse) {
  .icon-btn { width: 44px; min-height: 44px; }
  a.button { min-height: 44px; }
}

/* reduced motion: keep the fade, drop the travel (motion.md) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 1ms !important; }
  a.button:active, .icon-btn:active { transform: none; }
}
