/* ============================================================
   TermKey — termkey.app
   Palette mirrors the app's KeyboardTheme.kt exactly.
   ============================================================ */

:root {
  --bg:        #0A0F17;
  --bg-raise:  #0E1520;
  --key:       #1B2331;
  --key-press: #2C3A4F;
  --mod:       #131A24;
  --text:      #E6EDF3;
  --hint:      #5B6B80;
  --border:    #2A3648;
  --accent:    #3DDCC4;
  --on-accent: #06241F;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --display: "Azeret Mono", var(--mono);
}
html[data-accent="cyan"]   { --accent: #38BDF8; --on-accent: #06202E; }
html[data-accent="purple"] { --accent: #8B7CF6; --on-accent: #160F33; }
html[data-accent="amber"]  { --accent: #F5B454; --on-accent: #2E1F06; }
html[data-accent="red"]    { --accent: #F47067; --on-accent: #2E0B08; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--on-accent); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--mod);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.88em;
}

/* film grain over everything, very faint */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none; z-index: 999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(8) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); } 25% { transform: translate(-2%,1%); }
  50% { transform: translate(1%,-2%); } 75% { transform: translate(-1%,2%); }
}

/* ----------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(18px, 4vw, 48px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.wordmark {
  font-family: var(--display);
  font-weight: 900; font-size: 19px; letter-spacing: -0.5px;
  color: var(--text);
}
.wordmark:hover { text-decoration: none; }
.prompt { color: var(--accent); }
.cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.accents { display: flex; gap: 8px; }
.accent-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--dot); border: 2px solid transparent;
  cursor: pointer; padding: 0;
  transition: transform .15s ease, border-color .15s ease;
}
.accent-dot:hover { transform: scale(1.25); }
.accent-dot.active { border-color: var(--text); transform: scale(1.15); }

.btn {
  display: inline-block;
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  padding: 9px 18px; border-radius: 7px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-solid {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-solid:hover { box-shadow: 0 0 36px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn-ghost:hover { background: var(--mod); border-color: var(--hint); }
.btn-lg { font-size: 15px; padding: 13px 24px; }

/* ----------------------------------------------------------- hero */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  padding: clamp(40px, 7vh, 90px) clamp(18px, 5vw, 72px) clamp(40px, 6vh, 80px);
  max-width: 1320px; margin: 0 auto;
}
.hero-glow {
  position: absolute; right: -10%; top: 0; width: 70%; height: 110%;
  background: radial-gradient(ellipse at 65% 45%,
    color-mix(in srgb, var(--accent) 13%, transparent) 0%, transparent 60%);
  pointer-events: none;
  transition: background .4s ease;
}
.kicker {
  color: var(--accent); font-size: 13px; letter-spacing: 1px;
  margin: 0 0 18px;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: 1.02;
  letter-spacing: -2.5px;
  margin: 0 0 22px;
}
.hero h1 em {
  font-style: normal; color: var(--accent);
  text-shadow: 0 0 38px color-mix(in srgb, var(--accent) 45%, transparent);
}
.lede { color: #AFC0D2; max-width: 52ch; margin: 0 0 30px; }
.lede strong { color: var(--text); }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 26px; }
.trust { color: var(--hint); font-size: 12.5px; margin: 0; }

/* hero entrance */
.hero-copy > * { opacity: 0; transform: translateY(14px); animation: rise .6s ease forwards; }
.hero-copy .kicker  { animation-delay: .05s; }
.hero-copy h1       { animation-delay: .15s; }
.hero-copy .lede    { animation-delay: .25s; }
.hero-copy .cta-row { animation-delay: .35s; }
.hero-copy .trust   { animation-delay: .45s; }
.hero-demo { opacity: 0; animation: rise .7s ease .3s forwards; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

/* ----------------------------------------------------------- the live phone demo */
.hero-demo { position: relative; }
.demo-hint {
  color: var(--accent); font-size: 12.5px; text-align: center;
  margin: 0 0 12px;
}
.phone {
  background: #060A10;
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 14px 12px 16px;
  max-width: 420px; margin: 0 auto;
  box-shadow:
    0 30px 80px rgba(0,0,0,.6),
    0 0 0 1px rgba(255,255,255,.03) inset,
    0 0 60px color-mix(in srgb, var(--accent) 9%, transparent);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* terminal */
.terminal {
  background: #05080D;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  position: relative;
}
.terminal::after { /* scanlines */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,.014) 2px 4px);
}
.term-titlebar {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--mod);
  border-bottom: 1px solid var(--border);
}
.term-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
.term-titlebar .term-dot:first-child { background: color-mix(in srgb, var(--accent) 70%, var(--border)); }
.term-title { margin-left: auto; color: var(--hint); font-size: 10.5px; }
.term-screen {
  padding: 10px 12px;
  height: 148px;
  overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-all;
}
.term-line { color: #9FB2C8; min-height: 1.55em; }
.term-line .p { color: var(--accent); font-weight: 700; }
.term-line .ctrlseq { color: var(--accent); }
.term-line.cur .caret {
  background: var(--accent); color: var(--on-accent);
  animation: blink 1.1s steps(1) infinite;
}

/* keyboard */
.kb { display: flex; flex-direction: column; gap: 6px; }
.kb-row { display: flex; gap: 5px; }
.key {
  --w: 1;
  flex: var(--w) 1 0;
  min-width: 0;
  height: calc(44px * var(--h, 1));
  display: flex; align-items: center; justify-content: center;
  position: relative;
  background: var(--key);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--mono); font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  padding: 0; overflow: hidden;
  transition: background .08s ease, transform .05s ease, box-shadow .12s ease;
}
.key:active, .key.pressed {
  background: var(--key-press);
  transform: translateY(1px);
}
.key.mod    { background: var(--mod); color: #B8C6D8; font-size: 12px; }
.key.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.key.accent:active, .key.accent.pressed { filter: brightness(1.18); }
.key.space  { background: var(--mod); color: var(--hint); font-size: 11px; letter-spacing: 1px; }
.key.latched {
  background: color-mix(in srgb, var(--accent) 22%, var(--mod));
  border-color: var(--accent); color: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.key.locked {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 50%, transparent);
}
.key .hint-c {
  position: absolute; top: 2px; right: 5px;
  font-size: 8.5px; color: var(--hint); font-weight: 400;
}
.key .sub {
  position: absolute; bottom: 2px; left: 0; right: 0;
  font-size: 7.5px; color: color-mix(in srgb, currentColor 55%, transparent);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 4px; font-weight: 400;
}
.key.snippet { font-size: 11px; }

/* ----------------------------------------------------------- marquee */
.marquee {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-raise);
  overflow: hidden;
  padding: 13px 0;
}
.marquee-track {
  display: flex; gap: 42px; width: max-content;
  animation: scroll 36s linear infinite;
}
.marquee span { color: var(--hint); font-size: 13px; white-space: nowrap; }
.marquee span:nth-child(4n+1) { color: var(--accent); }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ----------------------------------------------------------- sections */
main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 48px); }
section { padding: clamp(56px, 9vh, 110px) 0; }
h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(26px, 3.2vw, 40px);
  letter-spacing: -1.5px;
  margin: 0 0 42px;
}
.sec-num {
  color: var(--accent); font-size: 0.55em; vertical-align: 0.45em;
  letter-spacing: 0; margin-right: 10px;
}
.sec-num::before { content: "["; color: var(--hint); }
.sec-num::after  { content: "]"; color: var(--hint); }

/* features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}
.feature {
  background: var(--bg);
  padding: 26px 24px 28px;
  transition: background .2s ease;
  position: relative;
}
.feature:hover { background: var(--bg-raise); }
.feature::before {
  content: ""; position: absolute; top: 0; left: 0; right: 100%;
  height: 2px; background: var(--accent);
  transition: right .25s ease;
}
.feature:hover::before { right: 0; }
.feature h3 {
  font-size: 14.5px; font-weight: 700; letter-spacing: 0.3px;
  margin: 0 0 10px; color: var(--text);
}
.feature h3 i { font-style: normal; color: var(--accent); margin-right: 6px; }
.feature p { margin: 0; color: #9FB2C8; font-size: 13.5px; }
.feature p em { color: var(--text); font-style: normal; }

/* screenshots */
.shot-strip {
  display: flex; gap: 18px;
  overflow-x: auto;
  padding-bottom: 14px;
  scroll-snap-type: x proximity;
}
.shot-strip::-webkit-scrollbar { height: 8px; }
.shot-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.shot-strip figure {
  margin: 0; flex: 0 0 auto; scroll-snap-align: start;
}
.shot-strip img {
  width: 218px; height: auto; display: block;
  border: 1px solid var(--border); border-radius: 16px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.shot-strip figure:hover img {
  transform: translateY(-6px);
  box-shadow: 0 18px 44px rgba(0,0,0,.5), 0 0 30px color-mix(in srgb, var(--accent) 14%, transparent);
}
figcaption { color: var(--hint); font-size: 11.5px; margin-top: 9px; text-align: center; }
.shot-wide { margin: 34px 0 0; }
.shot-wide img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--border); border-radius: 18px;
}
.shot-wide figcaption { max-width: 64ch; margin: 12px auto 0; }

/* install */
.install-cols {
  display: grid; grid-template-columns: minmax(260px, 0.9fr) 1.1fr;
  gap: clamp(24px, 4vw, 56px); align-items: start;
}
.install-steps { margin: 0; padding-left: 1.4em; color: #AFC0D2; }
.install-steps li { margin-bottom: 16px; }
.install-steps b { color: var(--text); }
.codeblock {
  background: #05080D;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.codeblock-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--mod);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  color: var(--hint); font-size: 12px;
}
.copy-btn {
  background: none; border: 1px solid var(--border); border-radius: 5px;
  color: var(--accent); font-family: var(--mono); font-size: 11px;
  padding: 3px 10px; cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); }
.codeblock pre {
  margin: 0; padding: 16px;
  font-size: 12px; line-height: 1.7;
  overflow-x: auto; color: #9FB2C8;
}
.install-note { color: var(--hint); font-size: 12.5px; margin-top: 28px; }

/* footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px clamp(18px, 4vw, 48px) 52px;
  text-align: center;
}
.footer-brand { font-family: var(--display); font-weight: 800; font-size: 17px; margin: 0 0 8px; }
.dim { color: var(--hint); font-size: 12.5px; }
.footer .dim a { color: var(--hint); text-decoration: underline; }

/* scroll-reveal */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.shown { opacity: 1; transform: none; }

/* ----------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero-glow { right: -30%; top: 30%; width: 120%; }
  .install-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 14px; }
  .topbar .btn-ghost { display: none; }
  .accents { gap: 6px; }
  .key { height: calc(40px * var(--h, 1)); font-size: 12px; border-radius: 6px; }
  .kb { gap: 4px; }
  .kb-row { gap: 3.5px; }
  .term-screen { height: 120px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .marquee-track { animation: none; }
}
