:root {
  color-scheme: light;
  --bg: #fafafa;
  --fg: #2e3338;
  --border: #d0d7de;
  --crt-scan: rgba(0, 0, 0, 0.03);
  --crt-vignette: rgba(0, 0, 0, 0.13);
}

@font-face {
  font-family: "Maple Mono";
  src: url("./fonts/MapleMono.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Maple Mono";
  src: url("./fonts/MapleMono-Italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("./fonts/SourceSerif4-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

.defs-only { position: absolute; width: 0; height: 0; overflow: hidden; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Maple Mono", "Fira Code", "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

#app {
  height: 100vh;
  display: flex;
  justify-content: center;
  padding: 12px;
}

#term-host {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 16px 18px 28px 18px;
  overflow: hidden;
  max-width: calc(80ch + 38px);
  opacity: 0;
  transition: opacity 150ms ease-out;
}
#term-host.ready { opacity: 1; }

#nameplate {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
#nameplate h1 {
  margin: 0;
  font-family: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 600;
  font-size: clamp(2.1rem, 4.6vw, 2.85rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #1f2328;
}
#nameplate .email {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: #57606a;
}
#nameplate .plain-link {
  flex-shrink: 0;
  margin-bottom: 2px;
  color: #1a4f8b;
  font-size: 0.95rem;
  text-decoration: none;
}
#nameplate .plain-link:hover { text-decoration: underline; }

#term-screen {
  flex: 1;
  min-height: 0;
  filter: url(#crt-smudge);
}
#term-screen .xterm { height: 100%; }

#term-screen .xterm-rows,
#term-screen .xterm-rows span {
  font-feature-settings: "liga" 1, "calt" 1;
}

#term-host::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(
    to bottom,
    var(--crt-scan) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: multiply;
}
#term-host::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 11;
  background: radial-gradient(
    ellipse 120% 120% at 50% 50%,
    transparent 55%,
    var(--crt-vignette) 100%
  );
}

.xterm-viewport {
  scrollbar-width: thin;
  scrollbar-color: #c0c7cf transparent;
}
.xterm-viewport::-webkit-scrollbar { width: 10px; }
.xterm-viewport::-webkit-scrollbar-track { background: transparent; }
.xterm-viewport::-webkit-scrollbar-thumb {
  background: #c0c7cf;
  border-radius: 5px;
}
.xterm-viewport::-webkit-scrollbar-thumb:hover { background: #a8afb7; }

@media (max-width: 640px) {
  #app { padding: 4px; }
  #term-host {
    padding: 12px 8px 22px 8px;
    border-radius: 6px;
  }
  #nameplate {
    padding-bottom: 10px;
    margin-bottom: 8px;
  }
  #nameplate h1 { font-size: 1.85rem; }
}
