:root { --accent: #e65100; }

* { box-sizing: border-box; }

body {
  align-items: center;
  background: #f9faf9;
  color: #1c2420;
  display: flex;
  font-family: "Courier New", monospace;
  justify-content: flex-end;
  margin: 0;
  min-height: 100vh;
  padding: 1.5rem;
}

main { text-align: right; width: 100%; }

.context { align-items: center; color: #66736c; display: flex; font-size: 0.8rem; gap: 0.75rem; justify-content: flex-end; margin: 0; opacity: 0.72; }
.context a { color: inherit; text-underline-offset: 0.25rem; }
.context a:hover, .context a:focus-visible { color: var(--accent); outline: none; }
.context { margin-bottom: 0.7rem; }
.contact { align-items: center; display: flex; justify-content: flex-end; max-width: 100%; }
.email-unit { display: inline-flex; flex-direction: column; max-width: 100%; }
footer { align-items: center; bottom: 1.5rem; display: flex; flex-direction: column; font-size: 0.7rem; gap: 0.45rem; left: 50%; position: fixed; transform: translateX(-50%); }
footer a { color: #66736c; text-decoration: none; }
footer a:hover, footer a:focus-visible { color: var(--accent); outline: none; text-decoration: underline; text-underline-offset: 0.25rem; }

#email {
  background: transparent;
  border: 0;
  color: #1c2420;
  display: block;
  font: clamp(0.75rem, 3.8vw, 1.15rem) "Courier New", monospace;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 0.5rem;
  transition: color 150ms ease;
}

#email, #email span { text-decoration: none !important; }
#email:hover, #email:focus-visible { color: var(--accent); outline: none; }
#local-part { display: inline-grid; font-weight: 600; }
#local-base, #local-progress { grid-area: 1 / 1; }
#local-base, #email > span:last-child { color: #718078; }
#local-progress { clip-path: inset(0 100% 0 0); color: var(--accent); transition: color 150ms ease; }
.is-changing { animation: change 320ms ease-out; }

@keyframes change {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-color-scheme: dark) {
  :root { --accent: #ffb74d; }
  body { background: #141816; color: #e6ebe7; }
  .context { color: #a6b4ab; }
  footer a { color: #a6b4ab; }
  footer a:hover, footer a:focus-visible { color: var(--accent); }
  #email { color: #e6ebe7; }
  #email:hover, #email:focus-visible { color: var(--accent); }
  #local-base, #email > span:last-child { color: #b7c5bc; }
}

@media (max-width: 600px) {
  main { text-align: center; }
  .context { justify-content: center; }
  .contact { justify-content: center; }
  footer { bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .is-changing { animation: none; }
}