/* Deep-space violet theme. Plain CSS - no build step, no dependencies. */

:root {
  --bg: #07030f;
  --bg-2: #140a24;
  --panel: rgba(30, 16, 54, .58);
  --line: rgba(163, 106, 255, .22);
  --text: #ece6fb;
  --muted: #a294c4;
  --accent: #b14fff;
  --accent-2: #ff4fd8;
  --glow: rgba(177, 79, 255, .55);
  --radius: 16px;
  --max: 1060px;
}

:root[data-theme="light"] {
  --bg: #f4f0fb;
  --bg-2: #e9e0f8;
  --panel: rgba(255, 255, 255, .74);
  --line: rgba(110, 50, 180, .2);
  --text: #1c1030;
  --muted: #5f5080;
  --accent: #8a2be2;
  --accent-2: #d4319e;
  --glow: rgba(138, 43, 226, .28);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f0fb;
    --bg-2: #e9e0f8;
    --panel: rgba(255, 255, 255, .74);
    --line: rgba(110, 50, 180, .2);
    --text: #1c1030;
    --muted: #5f5080;
    --accent: #8a2be2;
    --accent-2: #d4319e;
    --glow: rgba(138, 43, 226, .28);
  }
}

* { box-sizing: border-box; min-width: 0; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 700px at 78% -8%, var(--bg-2) 0%, transparent 62%),
    radial-gradient(900px 620px at 12% 108%, var(--bg-2) 0%, transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- ambient background ---------------------------------------------- */
#stars { position: fixed; inset: 0; z-index: -2; display: block; }
.glow {
  position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(90px); opacity: .5; pointer-events: none;
}
.glow-a { width: 460px; height: 460px; top: -140px; right: -110px;
          background: var(--glow); animation: drift 22s ease-in-out infinite; }
.glow-b { width: 520px; height: 520px; bottom: -200px; left: -160px;
          background: rgba(255, 79, 216, .34);
          animation: drift 27s ease-in-out infinite reverse; }
@keyframes drift {
  50% { transform: translate3d(40px, 30px, 0) scale(1.12); }
}

/* --- nav -------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 24px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none;
         font-size: 17px; letter-spacing: .2px; }
.nav nav { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: 14px;
         transition: color .15s ease; }
.nav a:hover { color: var(--accent); }
.theme {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; width: 36px; height: 32px; cursor: pointer; font-size: 15px;
  backdrop-filter: blur(8px);
}

/* --- layout ----------------------------------------------------------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 24px; position: relative; }
section { padding: 68px 0; border-bottom: 1px solid var(--line); }
section:last-child { border-bottom: none; }
h1 { font-size: clamp(31px, 5.6vw, 55px); line-height: 1.1; margin: 12px 0 18px;
     letter-spacing: -.5px; }
h2 { font-size: 27px; margin: 0 0 22px; letter-spacing: -.2px; }

.hero { padding-top: 78px; }
.eyebrow { color: var(--accent); font-size: 12px; letter-spacing: 2px;
           text-transform: uppercase; margin: 0; font-weight: 700; }
.grad {
  background: linear-gradient(92deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pan 9s linear infinite;
}
@keyframes pan { to { background-position: 220% 0; } }

.lede, .prose { color: var(--muted); font-size: 17px; max-width: 64ch; }
code { background: var(--panel); border: 1px solid var(--line);
       border-radius: 5px; padding: 1px 6px; font-size: .9em; }

.cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--panel);
  color: var(--text); text-decoration: none; font-size: 15px;
  backdrop-filter: blur(8px);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent);
             box-shadow: 0 8px 26px -8px var(--glow); }
.btn.primary {
  background: linear-gradient(96deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; font-weight: 600;
  box-shadow: 0 8px 30px -10px var(--glow);
}

/* --- projects --------------------------------------------------------- */
.filters { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 22px; }
.filters button {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 16px; font-size: 13px; cursor: pointer;
  backdrop-filter: blur(8px); transition: all .15s ease;
}
.filters button:hover { color: var(--text); border-color: var(--accent); }
.filters button.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(96deg, var(--accent), var(--accent-2));
}

.grid { display: grid; gap: 18px;
        grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
  backdrop-filter: blur(12px);
  animation: rise .5s backwards ease-out;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent);
              box-shadow: 0 18px 44px -20px var(--glow); }
@keyframes rise { from { opacity: 0; transform: translateY(15px); } }
.card h3 { margin: 0; font-size: 18px; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.tag { background: color-mix(in srgb, var(--accent) 18%, transparent);
       color: var(--accent); font-size: 11px; border-radius: 6px;
       padding: 3px 10px; border: 1px solid var(--line); }

.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 9px; }
.chips li { background: var(--panel); border: 1px solid var(--line);
            border-radius: 9px; padding: 7px 15px; font-size: 14px;
            backdrop-filter: blur(8px);
            transition: transform .12s ease, color .12s ease; }
.chips li:hover { transform: translateY(-2px); color: var(--accent); }

/* --- live demo -------------------------------------------------------- */
.demo-wrap { background: var(--panel); border: 1px solid var(--line);
             border-radius: var(--radius); padding: 20px;
             backdrop-filter: blur(12px); margin-top: 20px; }
.controls { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 16px; }
.controls label { display: flex; flex-direction: column; gap: 5px;
                  font-size: 13px; color: var(--muted); flex: 1 1 220px; }
.controls output { color: var(--accent); font-weight: 700; font-size: 15px; }
.controls input[type=range] { accent-color: var(--accent); width: 100%; }
#hypnogram { width: 100%; height: auto; display: block; border-radius: 10px; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.stat { flex: 1 1 110px; text-align: center; padding: 12px 8px;
        border: 1px solid var(--line); border-radius: 11px; }
.stat span { display: block; font-size: 23px; font-weight: 700; color: var(--accent); }
.stat small { color: var(--muted); font-size: 12px; }

/* --- animation -------------------------------------------------------- */
/* Scoped to .js: with no JavaScript the content is simply visible. Never
   let an animation layer be the reason a section cannot be read. */
.js .reveal { opacity: 0; transform: translateY(28px);
              transition: opacity .65s ease, transform .65s ease; }
.js .reveal.visible { opacity: 1; transform: none; }

.hero h1 { animation: rise .6s .05s backwards ease-out; }
.hero .lede { animation: rise .6s .15s backwards ease-out; }
.hero .cta { animation: rise .6s .25s backwards ease-out; }

/* Anyone who asks the OS for less motion gets none of it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

/* --- reviews ---------------------------------------------------------- */
.score { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.score-num { font-size: 44px; font-weight: 700; line-height: 1;
             background: linear-gradient(96deg, var(--accent), var(--accent-2));
             -webkit-background-clip: text; background-clip: text; color: transparent; }
.stars { color: var(--accent-2); letter-spacing: 3px; }
.stars.big { font-size: 21px; }
.muted { color: var(--muted); font-size: 13px; }
.note { margin-top: 18px; }

.review-form { background: var(--panel); border: 1px solid var(--line);
               border-radius: var(--radius); padding: 20px; margin-bottom: 22px;
               backdrop-filter: blur(12px); }
.review-form .row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.review-form input, .review-form textarea {
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; font: inherit; font-size: 14px;
  width: 100%; resize: vertical;
}
.review-form input { flex: 1 1 200px; width: auto; }
.review-form input:focus, .review-form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.rate { display: flex; gap: 2px; align-items: center; }
.rate button { background: none; border: none; cursor: pointer; font-size: 27px;
               color: var(--muted); padding: 0 2px; line-height: 1;
               transition: transform .12s ease, color .12s ease; }
.rate button:hover { transform: scale(1.2); }
.rate button.on { color: var(--accent-2); }
.form-foot { display: flex; align-items: center; justify-content: space-between;
             gap: 12px; margin-top: 12px; flex-wrap: wrap; }

.reviews { display: flex; flex-direction: column; gap: 12px; }
.review { background: var(--panel); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 16px 18px;
          backdrop-filter: blur(12px);
          animation: rise .35s backwards ease-out; }
.review-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.review-head strong { font-size: 15px; }
.review p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.review .del { margin-left: auto; background: none; border: none; cursor: pointer;
               color: var(--muted); font-size: 12px; }
.review .del:hover { color: var(--accent-2); }

footer { max-width: var(--max); margin: 0 auto; padding: 30px 24px 54px;
         color: var(--muted); font-size: 13px; }

/* --- robot mascot ------------------------------------------------------ */
.robot {
  position: fixed; left: 0; top: 0;
  width: 56px; height: 56px; z-index: 6;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 6px 16px var(--glow));
  will-change: transform;
}
.robot:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px;
                        border-radius: 50%; }
.robot-bob { width: 100%; height: 100%; animation: robot-bob 2.6s ease-in-out infinite; }
@keyframes robot-bob { 50% { transform: translateY(-5px); } }
.robot-art { width: 100%; height: 100%; display: block; transform-origin: 50% 50%; }
.robot.facing-left .robot-art { transform: scaleX(-1); }
.robot.spinning .robot-art {
  animation: robot-spin var(--spin-duration, .9s) cubic-bezier(.65, 0, .35, 1);
}
@keyframes robot-spin {
  to { transform: rotate(calc(360deg * var(--spins, 1) * var(--spin-dir, 1))); }
}
.robot-eye { transition: transform .12s ease; transform-origin: center; transform-box: fill-box; }
.robot.blink .robot-eye { transform: scaleY(.15); }
.robot.squint .robot-eye { transform: scaleY(.45); }
.robot.wide-eyed .robot-eye { transform: scale(1.35); }
.robot.wink .robot-eye-r { transform: scaleY(.15); }
.robot.cross-eyed .robot-eye-l { transform: translateX(2.2px); }
.robot.cross-eyed .robot-eye-r { transform: translateX(-2.2px); }
.robot-eyes { transition: transform .35s ease; transform-origin: center; transform-box: fill-box; }
.robot-eyes.look-left { transform: translateX(-2.5px); }
.robot-eyes.look-right { transform: translateX(2.5px); }

.robot-arm { opacity: 0; transform: rotate(0deg); transition: opacity .15s ease; }
.robot.waving .robot-arm {
  opacity: 1;
  animation: robot-wave 1.1s ease-in-out 2;
}
@keyframes robot-wave {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(55deg); }
  40% { transform: rotate(25deg); }
  60% { transform: rotate(55deg); }
  80% { transform: rotate(15deg); }
}

.robot-bubble {
  position: absolute; bottom: 100%; left: 50%; margin-bottom: 10px;
  transform: translate(-50%, 8px) scale(.85);
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; white-space: nowrap; padding: 6px 12px; border-radius: 999px;
  backdrop-filter: blur(8px); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.robot-bubble::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--panel);
}
.robot-bubble.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

@media (max-width: 640px) {
  .nav nav { gap: 13px; }
  section { padding: 46px 0; }
  .score-num { font-size: 35px; }
  .controls { gap: 14px; }
  .robot { width: 44px; height: 44px; }
}
