@font-face {
  font-family: 'Ubuntu Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/UbuntuSans-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Ubuntu Sans Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/UbuntuSansMono-Regular.woff2') format('woff2');
}

:root,
:root[data-theme="dark"] {
  --bg: #0e1113;
  --bg-raised: #14181b;
  --text: #e9ebe9;
  --text-dim: #9aa39e;
  --accent: #5fb3a0;
  --accent-dim: #3d7a6f;
  --border: #232a2c;
  --mono: 'Ubuntu Sans Mono', ui-monospace, monospace;
  --sans: 'Ubuntu Sans', system-ui, sans-serif;
}

:root[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-raised: #ffffff;
  --text: #16191a;
  --text-dim: #5b6461;
  --accent: #107b5e;
  --accent-dim: #bfe0d7;
  --border: #e0e2df;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6vh 20px 8vh;
}

.wrap {
  width: 100%;
  max-width: 560px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  transition: color 0.2s ease;
}

h1 {
  font-family: var(--mono);
  font-weight: bold;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.25;
  margin: 0 0 18px;
  color: var(--text);
  transition: color 0.2s ease;
}

p.lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-dim);
  margin: 0 0 36px;
  max-width: 46ch;
  transition: color 0.2s ease;
}

/* signature element: a little fake code-comment, static so it doesn't rely on
   motion to be noticed (unlike the animated waveform it replaced) */
.code-comment {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--accent);
  margin: 0 0 36px;
  transition: color 0.2s ease;
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
  transition: border-color 0.2s ease;
}

label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

input, textarea {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  resize: vertical;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(95, 179, 160, 0.15);
}

/* Browsers paint autofilled fields with their own internal background fill,
   ignoring background-color entirely — box-shadow is the only lever that
   overrides it. Chrome/Safari also run their own transition on that internal
   fill whenever the field's autofill state toggles (e.g. you edit an
   autofilled value), which is what caused the white/blue flash. Setting an
   absurdly long duration on background-color specifically tells the browser
   "don't ever finish animating your own fill", so only our box-shadow (which
   we do transition normally) is ever visible. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  box-shadow: 0 0 0 1000px var(--bg-raised) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 600000s ease-in-out 0s, box-shadow 0.2s ease, border-color 0.2s ease, -webkit-text-fill-color 0.2s ease;
}

/* Multiple shadows are comma-separated in one box-shadow value: the inset
   one still hides the browser's own autofill fill, the second adds back the
   focus glow that the rule above would otherwise wipe out. */
input:-webkit-autofill:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1000px var(--bg-raised) inset, 0 0 0 3px rgba(95, 179, 160, 0.15);
}

textarea { min-height: 120px; }

/* honeypot — hidden from real users, catches basic bots */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.btn {
  align-self: flex-start;
  margin-top: 4px;
  background: var(--accent);
  color: #0b1211;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 11px 22px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

/* dark accent teal in light theme needs light text for contrast */
:root[data-theme="light"] .btn { color: #ffffff; }

.btn:hover { background: #6fc4b0; }

.btn:disabled {
  background: var(--accent-dim);
  cursor: default;
  position: relative;
  overflow: hidden;
}

/* Indeterminate progress: a soft highlight band sweeping left to right on
   loop, since we don't know how long the request will actually take.
   Pseudo-element so it doesn't interfere with the button's own text/layout;
   .btn:disabled gets overflow:hidden so the sweep clips to the rounded
   corners instead of spilling out. */
.btn:disabled::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.45;
  transform: translateX(-100%);
  animation: btn-progress-sweep 1.3s ease-in-out infinite;
}

@keyframes btn-progress-sweep {
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .btn:disabled::after {
    animation: btn-progress-pulse 1.6s ease-in-out infinite;
    transform: none;
  }
}

@keyframes btn-progress-pulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.4; }
}

/* Custom focus ring for keyboard navigation only (not mouse clicks), using
   outline instead of box-shadow so it still shows up under forced-colors /
   Windows High Contrast mode. */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a:focus-visible {
  border-radius: 4px;
  border-color: transparent;
}

.form-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: -6px 0 0;
  transition: color 0.2s ease;
}

.status {
  font-family: var(--mono);
  font-size: 13px;
  min-height: 18px;
  margin-top: 4px;
}

.status.ok { color: var(--accent); }
.status.err { color: #d98a5f; }

.status a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.status a:hover { color: var(--accent); }

.personal {
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.personal a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.personal a:hover { border-color: var(--accent); color: var(--accent); }

footer {
  margin-top: auto;
  padding-top: 48px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}

.copy{
  font-size: 18px;
  font-weight: normal;
  vertical-align: top;
  line-height: 12px;
}

.controls {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.theme-toggle svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-toggle .icon-sun { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
.theme-toggle .icon-moon { transform: translate(-50%, -50%) scale(0.6) rotate(-40deg); opacity: 0; }

:root[data-theme="light"] .theme-toggle .icon-sun { transform: translate(-50%, -50%) scale(0.6) rotate(40deg); opacity: 0; }
:root[data-theme="light"] .theme-toggle .icon-moon { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle svg { transition: opacity 0.2s ease; }

  .theme-toggle .icon-sun,
  .theme-toggle .icon-moon,
  :root[data-theme="light"] .theme-toggle .icon-sun,
  :root[data-theme="light"] .theme-toggle .icon-moon {
    transform: translate(-50%, -50%);
  }
}

.lang-switch {
  display: flex;
  gap: 2px;
  height: 36px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lang-switch__btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-weight: bold;
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-switch__btn:hover:not(.lang-switch__btn--active) { color: var(--accent); }

.lang-switch__btn--active {
  background: var(--accent);
  color: #0b1211;
  pointer-events: none;
}

/* dark accent teal in light theme needs light text for contrast, same fix as .btn */
:root[data-theme="light"] .lang-switch__btn--active { color: #ffffff; }
