
/* Preloader */

#preloader {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--paper);
  transition: opacity .5s var(--ease), visibility .5s;
}
#preloader.done { opacity: 0; visibility: hidden; }

.pre-mark {
  display: grid; gap: 1.1rem; justify-items: center;
}
.pre-mark span {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  color: var(--muted);
  letter-spacing: .18em;
}
.pre-bar {
  width: 180px; height: 3px;
  background: var(--line); border-radius: 2px; overflow: hidden;
}
.pre-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--o), var(--o-2));
  border-radius: 2px;
  animation: preFill .9s var(--ease-out) forwards;
}
@keyframes preFill { to { width: 100%; } }

/* Scroll progress                                                  */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--o-deep), var(--o-2));
  z-index: 120;
  transition: width .1s linear;
}

/* Buttons                                                          */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .82rem 1.35rem;
  border-radius: 12px;
  font-size: .92rem; font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: -.01em;
  border: 1px solid transparent;
  transition: transform .22s var(--ease), box-shadow .28s var(--ease),
              background-color .22s, color .22s, border-color .22s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex: none; transition: transform .28s var(--ease); }

.btn--primary {
  background: var(--o); color: #fff;
  box-shadow: 0 10px 24px -12px rgba(255,107,0,.85);
}
.btn--primary:hover {
  background: var(--o-deep);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -12px rgba(255,107,0,.75);
}
.btn--primary:hover svg { transform: translateX(3px); }

.btn--ghost {
  background: var(--paper); color: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover {
  border-color: var(--o); color: var(--o-ink);
  transform: translateY(-2px);
  background: var(--tint);
}
.btn--ghost:hover svg { transform: translateY(2px); }

.btn--sm { padding: .55rem 1rem; font-size: .84rem; border-radius: 10px; }
.btn--block { width: 100%; }

.btn--quiet {
  color: var(--muted); border-color: var(--line);
  background: transparent;
}
.btn--quiet:hover { color: var(--ink); border-color: var(--line-strong); }

/* Text link with animated underline */
.tlink {
  position: relative; display: inline-flex; align-items: center; gap: .4rem;
  color: var(--o-ink); font-weight: 600; font-size: .9rem;
}
.tlink::after {
  content: ""; position: absolute; left: 0; bottom: -2px;
  width: 100%; height: 1.5px; background: var(--o);
  transform: scaleX(0); transform-origin: right;
  transition: transform .32s var(--ease-out);
}
.tlink:hover::after { transform: scaleX(1); transform-origin: left; }
.tlink svg { width: 14px; height: 14px; transition: transform .28s var(--ease); }
.tlink:hover svg { transform: translate(2px, -2px); }

/* Cards & tags                                                     */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.5rem;
  transition: border-color .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}

.tag {
  display: inline-flex; align-items: center;
  padding: .26rem .62rem;
  border-radius: 7px;
  font-family: var(--font-mono); font-size: .71rem; font-weight: 500;
  background: var(--paper-3); color: var(--muted);
  border: 1px solid transparent;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s;
}
.tag--o { background: var(--tint); color: var(--o-ink); }

/* TERMINAL - the centrepiece                                       */
.terminal {
  position: relative;
  background: var(--term-bg);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,.06);
  font-family: var(--font-mono);
  display: flex; flex-direction: column;
  height: 440px;          
}

.term-bar {
  display: flex; align-items: center; gap: .5rem;
  padding: .78rem 1rem;
  background: var(--term-bar);
  flex: none;
}
.term-dots { display: flex; gap: .42rem; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.term-dots i:nth-child(1) { background: #FF5F57; }
.term-dots i:nth-child(2) { background: #FEBC2E; }
.term-dots i:nth-child(3) { background: #28C840; }
.term-title {
  margin-left: auto;
  font-size: .66rem; letter-spacing: .14em;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
}

.term-body {
  flex: 1;
  padding: 1.15rem 1.15rem .5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;         
  font-size: .82rem;
  line-height: 1.85;
  color: var(--term-text);
  scrollbar-width: thin;
  scrollbar-color: #3a352f transparent;
}
.term-body::-webkit-scrollbar { width: 8px; }
.term-body::-webkit-scrollbar-track { background: transparent; }
.term-body::-webkit-scrollbar-thumb {
  background: #423c35; border-radius: 4px;
  border: 2px solid transparent; background-clip: padding-box;
}
.term-body::-webkit-scrollbar-thumb:hover { background: #5a5249; background-clip: padding-box; }

.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line.boot   { color: var(--term-orange); }
.term-line.ok     { color: var(--term-dim); }
.term-line.hint   { color: #fff; font-weight: 500; }
.term-line.out    { color: var(--term-text); }
.term-line.dim    { color: var(--term-dim); }
.term-line.good   { color: var(--term-green); }
.term-line.err    { color: #FF6B6B; }
.term-line.head   { color: var(--term-orange); font-weight: 500; }
.term-line.echo   { color: var(--term-orange); }
.term-line.echo em { color: var(--term-text); font-style: normal; }
.term-line .dimx { color: var(--term-dim); }
.term-line a { color: var(--term-green); text-decoration: underline; text-underline-offset: 2px; }
.term-line a:hover { color: #fff; }
.term-line.spacer { height: .55rem; }

.term-prompt-row {
  display: flex; align-items: center; gap: .5rem;
  padding: .9rem 1.15rem 1.05rem;
  border-top: 1px solid rgba(255,255,255,.07);
  flex: none;
  cursor: text;
}
.term-user { color: var(--term-orange); font-size: .82rem; flex: none; }
.term-input {
  flex: 1; min-width: 0;
  background: none; border: none; outline: none;
  color: var(--term-text);
  font-family: var(--font-mono); font-size: .82rem;
  caret-color: var(--o);
}
.term-input::placeholder { color: #5b564f; }

.term-cursor {
  display: inline-block; width: 8px; height: 15px;
  background: var(--o); vertical-align: -2px;
  animation: blink 1.05s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.term-chips {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin-top: .9rem;
}
.term-chip {
  font-family: var(--font-mono); font-size: .72rem;
  padding: .32rem .62rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--muted); background: var(--paper);
  transition: color .2s, border-color .2s, background-color .2s, transform .2s var(--ease);
}
.term-chip:hover {
  color: var(--o-ink); border-color: var(--o); background: var(--tint);
  transform: translateY(-1px);
}

/* Modal                                                            */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: end center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .32s var(--ease), visibility .32s;
}
.modal.open { opacity: 1; visibility: visible; pointer-events: auto; }

.modal-scrim {
  position: absolute; inset: 0;
  background: rgba(17, 14, 10, .55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.modal-panel {
  position: relative;
  width: min(920px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--paper);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  transform: translateY(24px);
  transition: transform .4s var(--ease-out);
  box-shadow: var(--shadow-lg);
}
.modal.open .modal-panel { transform: none; }

.modal-close {
  position: sticky; top: 1rem; float: right;
  margin: 1rem 1rem 0 0;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper-3); color: var(--ink);
  border: 1px solid var(--line);
  z-index: 2;
  transition: background-color .2s, transform .2s var(--ease);
}
.modal-close:hover { background: var(--o); color: #fff; transform: rotate(90deg); }
.modal-close svg { width: 16px; height: 16px; }

/* Form                                                             */
.field { display: grid; gap: .42rem; min-width: 0; }
.field label {
  font-size: var(--t-xs); font-weight: 600; color: var(--ink);
  letter-spacing: .01em;
}
.field input, .field textarea {
  width: 100%;
  padding: .82rem .95rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  font-size: .93rem;
  transition: border-color .22s var(--ease), box-shadow .22s var(--ease), background-color .22s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--o);
  box-shadow: 0 0 0 3px rgba(255,107,0,.14);
}
.field textarea { resize: vertical; min-height: 130px; }
.field.invalid input, .field.invalid textarea { border-color: #E0483B; }
.field-error { font-size: var(--t-xs); color: #C43A2E; min-height: 1em; }

.form-note {
  font-size: var(--t-xs); color: var(--muted);
  display: flex; align-items: flex-start; gap: .45rem;
}

.form-status {
  font-size: .88rem; font-weight: 500;
  padding: .75rem .95rem; border-radius: 10px;
  display: none;
}
.form-status.show { display: block; }
.form-status.ok  { background: var(--tint); color: var(--o-ink); border: 1px solid var(--tint-strong); }
.form-status.bad { background: #FDEDEA; color: #C43A2E; border: 1px solid #F6D5CF; }
[data-theme="dark"] .form-status.bad { background: #2A1512; border-color: #45201B; color: #FF9484; }

.btn.is-loading { pointer-events: none; opacity: .75; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Custom cursor (desktop, fine pointer only)                       */
#cursor, #cursor-ring { display: none; }

@media (hover: hover) and (pointer: fine) and (min-width: 1025px) {
  #cursor, #cursor-ring { opacity: 0; transition: opacity .25s var(--ease); }
  body.cursor-live #cursor, body.cursor-live #cursor-ring { opacity: 1; }
  #cursor {
    display: block; position: fixed; z-index: 400;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--o); pointer-events: none;
    translate: -50% -50%;
  }
  #cursor-ring {
    display: grid; place-items: center;
    position: fixed; z-index: 399;
    width: 30px; height: 30px; border-radius: 50%;
    border: 1.5px solid color-mix(in srgb, var(--o) 55%, transparent);
    pointer-events: none; translate: -50% -50%;
    transition: width .26s var(--ease), height .26s var(--ease),
                background-color .26s, border-color .26s;
    font-family: var(--font-mono); font-size: .6rem;
    color: #fff; letter-spacing: .06em; overflow: hidden;
  }
  #cursor-ring span { opacity: 0; transition: opacity .2s; }
  #cursor-ring.hot { width: 52px; height: 52px; background: color-mix(in srgb, var(--o) 14%, transparent); }
  #cursor-ring.view { width: 68px; height: 68px; background: var(--o); border-color: var(--o); }
  #cursor-ring.view span { opacity: 1; }
  #cursor-ring.view + #cursor { opacity: 0; }
}

code {
  font-family: var(--font-mono);
  font-size: .82em;
  padding: .1em .35em;
  border-radius: 5px;
  background: var(--paper-3);
  color: var(--o-ink);
}
