:root {
  --bg: #f4f2ed;
  --fg: #1b1b19;
  --muted: #6d6a63;
  --line: #d9d5cc;
  --card: #ffffff;
  --shadow: 0 12px 40px rgba(20, 18, 12, 0.14);
  --accent: #1b1b19;
  --ok: #2f9e44;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110;
    --fg: #ecebe6;
    --muted: #8f8c84;
    --line: #2c2b28;
    --card: #1b1a18;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    --accent: #ecebe6;
    --ok: #51cf66;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111110;
  --fg: #ecebe6;
  --muted: #8f8c84;
  --line: #2c2b28;
  --card: #1b1a18;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --accent: #ecebe6;
  --ok: #51cf66;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter Tight', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* Top bar */
.topbar {
  display: flex; justify-content: flex-end; align-items: center;
  max-width: 1120px; width: 100%; margin: 0 auto;
  padding: 24px 32px 0;
}
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 12px/1 'JetBrains Mono', ui-monospace, monospace;
  color: var(--muted); letter-spacing: .02em;
  white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--fg);
  display: grid; place-items: center; cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.theme-toggle:hover { border-color: var(--fg); transform: rotate(15deg); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; grid-area: 1/1; transition: opacity .25s, transform .35s; }
.icon-moon { opacity: 0; transform: scale(.5) rotate(-60deg); }
:root[data-theme="dark"] .icon-sun { opacity: 0; transform: scale(.5) rotate(60deg); }
:root[data-theme="dark"] .icon-moon { opacity: 1; transform: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { opacity: 0; transform: scale(.5) rotate(60deg); }
  :root:not([data-theme="light"]) .icon-moon { opacity: 1; transform: none; }
}

/* Layout */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  max-width: 1120px; width: 100%;
  margin: 0 auto;
  padding: 0 32px;
}
/* Wide screens: a third column on the right holds the hover preview card */
@media (min-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 420px 220px; max-width: 1240px; }
  .topbar, .footer { max-width: 1240px; }
}
/* Very wide screens: the preview card fits in the page margin, so drop the reserved
   column and centre photo + text on the screen. */
@media (min-width: 1660px) {
  .layout { grid-template-columns: minmax(0, 1fr) 420px; max-width: 1000px; }
  .topbar, .footer { max-width: 1000px; }
}
.portrait-wrap { position: relative; display: grid; place-items: center; }
.portrait { width: 100%; max-width: 520px; aspect-ratio: 1; display: block; touch-action: pan-y; }

.info { max-width: 420px; }
h1 { font-size: 44px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 14px; }
.tagline { font-weight: 500; margin: 0 0 20px; }
.bio { color: var(--muted); margin: 0 0 32px; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.list { list-style: none; padding: 0; margin: 0 0 30px; }
.list li { position: relative; padding-left: 16px; margin: 6px 0; font-size: 14px; color: var(--muted); }
.list li::before { content: ''; position: absolute; left: 2px; top: .7em; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.list li .item-role { color: var(--fg); }

.hl {
  cursor: pointer;
  color: var(--fg); text-decoration: none; font-weight: 500;
  background-image: linear-gradient(var(--fg), var(--fg)), linear-gradient(var(--line), var(--line));
  background-size: 0% 1px, 100% 1px; background-position: 0 100%, 0 100%; background-repeat: no-repeat;
  transition: background-size .35s ease;
  padding-bottom: 1px; outline-offset: 3px;
}
.hl:hover, .hl:focus-visible, .hl.active { background-size: 100% 1px, 100% 1px; }


/* Footer */
.footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  max-width: 1120px; width: 100%; margin: 0 auto;
  padding: 28px 32px 36px;
  font-size: 12px; color: var(--muted);
}
.footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer a { text-decoration: none; transition: color .2s; }
.footer a:hover { color: var(--fg); }
.footer-right { display: flex; align-items: center; gap: 18px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang-switch button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 500 11px/1 'JetBrains Mono', monospace; padding: 5px 9px; border-radius: 999px;
  transition: color .2s, background-color .2s;
}
.lang-switch button:hover { color: var(--fg); }
.lang-switch button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.copy { font-family: 'JetBrains Mono', monospace; font-size: 11px; }

/* Link preview card */
.preview {
  position: fixed; z-index: 10; width: 300px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; pointer-events: none;
  opacity: 0; transform: translateY(6px) scale(.98);
  transition: opacity .2s ease, transform .2s ease;
}
.preview.show { opacity: 1; transform: none; }
.preview[hidden] { display: block; visibility: hidden; }
.preview-thumb {
  aspect-ratio: 16 / 10; background-size: cover; background-position: center top;
  border-bottom: 1px solid var(--line);
  display: grid; place-items: center;
  font: 600 38px/1 'Inter Tight', sans-serif; color: rgba(255,255,255,.92); letter-spacing: -0.03em;
}
.preview-body { padding: 10px 12px 12px; display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.preview-body strong { color: var(--fg); font-size: 13px; font-weight: 600; }
.preview-domain { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }

/* Mobile */
@media (max-width: 820px) {
  .topbar { padding: 16px; }
  .layout { grid-template-columns: 1fr; gap: 8px; padding: 0 16px; }
  .portrait { max-width: 340px; }
  .info { max-width: none; }
  h1 { font-size: 36px; }
  .footer { padding: 24px 16px 32px; flex-direction: column; align-items: flex-start; }
  .preview { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}

span.hl { cursor: default; }



@media (max-width: 820px) { .footer-right { flex-wrap: wrap; gap: 12px 16px; } }

.preview-thumb.term {
  display: block; background: #151513; color: #b9b6ad;
  font: 400 10.5px/1.65 'JetBrains Mono', monospace; letter-spacing: 0;
  padding: 14px 14px; text-align: left; white-space: pre; overflow: hidden;
}
.preview-thumb.term { place-items: start; justify-items: stretch; }
.preview-thumb.term > div { width: 100%; text-align: left; }
.preview-thumb.term .cmd { color: #ecebe6; }
.preview-thumb.term .ok { color: #69db7c; }

@media (min-width: 1180px) { .footer { max-width: 1240px; } }
@media (min-width: 1660px) { .footer { max-width: 1000px; } }
