@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0f14;
  --text: #c5ceda;
  --muted: #7a8696;
  --border: #2a3442;
  --highlight: #e0703a;
  /* Sky tint: theme.js shifts it with the time of day in São Paulo */
  --sky-a: 64, 120, 175;
  --sky-b: 45, 95, 130;
  --glow-a: rgba(var(--sky-a), 0.10);
  --glow-b: rgba(var(--sky-b), 0.08);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f5f8;
  --text: #18202b;
  --muted: #5b6675;
  --border: #c3ccd8;
  --highlight: #b44d16;
  --glow-a: rgba(var(--sky-a), 0.10);
  --glow-b: rgba(var(--sky-b), 0.07);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f8;
    --text: #18202b;
    --muted: #5b6675;
    --border: #c3ccd8;
    --highlight: #b44d16;
    --glow-a: rgba(var(--sky-a), 0.10);
    --glow-b: rgba(var(--sky-b), 0.07);
    color-scheme: light;
  }
}

*, *::before { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
  background: var(--bg);
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Faint, slow, cold background glow */
body::before {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 35% at 30% 35%, var(--glow-a), transparent 70%),
    radial-gradient(35% 40% at 70% 65%, var(--glow-b), transparent 70%);
  animation: drift 90s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate3d(-4%, -3%, 0) rotate(0deg); }
  to   { transform: translate3d(4%, 3%, 0) rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

main { width: 100%; max-width: 34rem; }

h1 {
  margin: 0 0 1.25rem;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 span { color: var(--highlight); }

p { margin: 0 0 1.1rem; }

a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color .2s, border-color .2s;
}

a:hover, a:focus-visible {
  color: var(--highlight);
  border-color: var(--highlight);
}

a:focus-visible { outline: 1px dashed var(--highlight); outline-offset: 3px; }

.controls {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.lang {
  display: flex;
  gap: 8px;
  padding: 0 8px;
}

.lang a { color: var(--muted); border: 0; }
.lang a[aria-current="true"] { color: var(--text); }
.lang a:hover, .lang a:focus-visible { color: var(--highlight); }

.theme-toggle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s;
}

.theme-toggle:hover, .theme-toggle:focus-visible { color: var(--highlight); }
.theme-toggle:focus-visible { outline: 1px dashed var(--highlight); outline-offset: 2px; }
.theme-toggle svg { width: 16px; height: 16px; }

/* Mainframe mode (secret): green phosphor terminal, à la IBM 3270. See theme.js */
:root[data-theme="mainframe"] {
  --bg: #000;
  --text: #4dff7a;
  --muted: #2fd35a;
  --border: #1b6b31;
  --highlight: #b8ffc9;
  color-scheme: dark;
}

:root[data-theme="mainframe"] body {
  text-transform: uppercase;
  text-shadow: 0 0 4px rgba(77, 255, 122, 0.45);
}

/* No sky glow; faint scanlines instead */
:root[data-theme="mainframe"] body::before {
  inset: 0;
  z-index: 1;
  animation: none;
  transform: none;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.35) 2px 3px);
}

/* The orange dot becomes a blinking block cursor */
:root[data-theme="mainframe"] h1 span {
  display: inline-block;
  width: 1ch;
  height: 1.15em;
  margin-left: 0.5ch;
  vertical-align: text-bottom;
  overflow: hidden;
  color: transparent;
  text-shadow: none;
  background: var(--text);
  animation: cursor 1.06s steps(1) infinite;
}

/* Status line, like the bottom row of a 3270 screen */
:root[data-theme="mainframe"] main::after {
  content: "READY";
  display: block;
  margin-top: 2rem;
  color: var(--muted);
}

@keyframes cursor { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  :root[data-theme="mainframe"] h1 span { animation: none; }
}

/* Toast (theme.js: light theme in the small hours) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  animation: toast-in .3s ease-out;
  transition: opacity .5s;
}
.toast.out { opacity: 0; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Koi pond (secret): the dot after the name opens a door. See theme.js and pond.js */
h1 span { position: relative; }
h1 span::after { content: ""; position: absolute; inset: -8px -6px; } /* a fingertip-sized target */
h1 span.ajar { visibility: hidden; }
.door {
  position: fixed;
  z-index: 2;
  width: 24px;
  height: calc(var(--door, 48px) + 8px);
  transform: translate(-50%, calc(-100% + 4px));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.door::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 3px;
  height: 3px;
  margin-left: -1.5px;
  border-radius: 50%;
  background: var(--highlight);
  transition: width .2s, margin .2s, height .45s cubic-bezier(.5, 0, .2, 1), border-radius .2s, box-shadow .45s;
}
.door.open::before {
  width: 1.5px;
  height: var(--door, 48px);
  margin-left: -.75px;
  border-radius: 1px;
  box-shadow: 0 0 6px var(--highlight);
}
.pond {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .door::before { transition: none; }
}

/* Printing the page gives a business card (QR from /qr.svg). Update the role here when it changes */
@media print {
  @page { margin: 2cm; }
  :root, :root[data-theme] {
    --bg: #fff; --text: #000; --muted: #444; --border: #bbb; --highlight: #c4561c;
  }
  body { display: block; min-height: 0; padding: 0; background: #fff; text-transform: none; text-shadow: none; }
  body::before, body::after, .controls, .toast, .door, .pond { display: none !important; }
  main {
    position: relative;
    width: 85mm;
    height: 55mm;
    max-width: none;
    padding: 7mm 30mm 7mm 7mm;
    border: 0.3mm solid #bbb;
    border-radius: 2mm;
    font-size: 8.5pt;
    line-height: 1.6;
  }
  main > p, main::after { display: none !important; }
  h1 { font-size: 11pt; margin: 0 0 5mm; }
  h1 span { color: var(--highlight) !important; background: none !important; animation: none !important; width: auto; height: auto; }
  main::before {
    content: "";
    position: absolute;
    right: 6mm;
    top: 50%;
    width: 22mm;
    height: 22mm;
    transform: translateY(-50%);
    background: url("/qr.svg") center / contain no-repeat;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  h1::after {
    content: "CTO · DXC Technology\A São Paulo\A\A arley@arleylambert.com\A arleylambert.com\A\A\A (sim, alguém imprimiu um site)";
    display: block;
    margin-top: 3mm;
    white-space: pre;
    font-weight: 400;
    color: var(--muted);
    font-size: 7.5pt;
  }
  :root[lang="en"] h1::after {
    content: "CTO · DXC Technology\A São Paulo\A\A arley@arleylambert.com\A arleylambert.com\A\A\A (yes, someone printed a website)";
  }
}
