/* v2 — Cozy Terminal (Vesper-Ghostty pastels) */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101010;
  --panel: #161616;
  --fg: #ffffff;
  --gray: #a0a0a0;
  --faint: #6e6e6e;
  --coral: #f5a191;
  --sage: #90b99f;
  --sand: #e6b99d;
  --lavender: #aca1cf;
  --orchid: #e29eca;
  --rose: #ea83a5;
  --peach: #ffc799;
  --mint: #99ffe4;
  --sel-bg: #e6b99d;
  --sel-fg: #101010;
  --line: #242424;
}

/* :root alone = no-JS fallback: the paper terminal, so the page is never unstyled */
:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe6;
  --panel: #eae3d6;
  --fg: #2a2620;
  --gray: #6e675e;
  --faint: #9a927f;
  --coral: #b4564a;
  --sage: #4e7359;
  --sand: #9a6b3f;
  --lavender: #6c5fa3;
  --orchid: #a44e86;
  --rose: #b03a5e;
  --peach: #b4564a;
  --mint: #4e7359;
  --sel-bg: #2a2620;
  --sel-fg: #f4efe6;
  --line: #ddd4c2;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "iA Writer Mono", ui-monospace, monospace;
  font-size: 15px;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--sel-bg); color: var(--sel-fg); }

a { color: var(--lavender); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--peach);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- top bar ---- */

.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}

.dots { display: inline-flex; gap: 7px; }
.dots i {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--coral);
}
.dots i:nth-child(2) { background: var(--sand); }
.dots i:nth-child(3) { background: var(--sage); }

.bar-title {
  color: var(--gray);
  font-size: 13px;
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#theme-btn {
  font: inherit;
  font-size: 13px;
  color: var(--gray);
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.15rem 0.7rem;
  cursor: pointer;
}
#theme-btn:hover { color: var(--fg); border-color: var(--gray); }

/* ---- terminal ---- */

#term {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 3.4rem 1.5rem 1rem;
  cursor: text;
}

#out > div { margin: 0 0 0.4rem; }

pre {
  margin: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.echo { margin-top: 1.1rem; }
.blk { margin: 0.65rem 0 1.1rem; }

.c-gray { color: var(--gray); }
.c-faint { color: var(--faint); }
.c-coral { color: var(--coral); }
.c-sage { color: var(--sage); }
.c-sand { color: var(--sand); }
.c-lavender { color: var(--lavender); }
.c-orchid { color: var(--orchid); }
.c-rose { color: var(--rose); }
.c-mint { color: var(--mint); }
.c-peach { color: var(--peach); }
.b { font-weight: 700; }

.prose {
  margin: 0 0 0.95rem;
  max-width: 56ch;
}
.blk .prose:last-child { margin-bottom: 0; }

.links-grid {
  display: grid;
  grid-template-columns: max-content max-content 1fr;
  column-gap: 1.2ch;
  row-gap: 0.15rem;
  align-items: baseline;
}
.links-grid a { overflow-wrap: anywhere; }

/* clickable command words inside output */
.cmd-word {
  font: inherit;
  color: var(--coral);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--coral) 40%, transparent);
  text-underline-offset: 4px;
}
.cmd-word:hover { text-decoration-color: var(--coral); }

/* ---- neofetch card ---- */

.card {
  display: flex;
  gap: 2.6rem;
  align-items: flex-start;
  margin: 1.2rem 0 0.4rem;
}

.card .art { flex: 0 0 auto; line-height: 1.35; }
.card .facts { flex: 0 1 auto; min-width: 0; }

.facts .kv .k { color: var(--sage); font-weight: 700; }
.facts .rule { color: var(--faint); }

.swatches {
  display: grid;
  grid-template-columns: repeat(8, 26px);
  grid-auto-rows: 15px;
  margin-top: 0.9rem;
}
.swatches i { display: block; }

/* light mode: the true pastels keep their native dark ground - a small inset bar */
:root[data-theme="light"] .swatches {
  width: max-content;
  padding: 6px;
  background: #101010;
  border-radius: 3px;
}

/* ---- prompt ---- */

#prompt-row {
  position: relative;
  margin-top: 1.2rem;
  min-height: 1.65em;
}

.ps1 { color: var(--sage); font-weight: 700; margin-right: 0.6ch; }

#typed, #typed-after { white-space: pre-wrap; overflow-wrap: break-word; }

#cursor {
  display: inline-block;
  width: 0.62em;
  height: 1.15em;
  background: var(--peach);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.beacon { animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

#cmd {
  position: absolute;
  inset: 0;
  width: 100%;
  font: inherit;
  font-size: 16px;
  background: transparent;
  border: none;
  color: transparent;
  caret-color: transparent;
  outline: none;
  padding: 0;
}

/* ---- chips ---- */

#chips[hidden] { display: none; }

#chips {
  margin: 1.1rem 0 0.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

#chips button {
  font: inherit;
  font-size: 13px;
  color: var(--gray);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.3rem 0.85rem;
  cursor: pointer;
}
#chips button:hover { color: var(--fg); border-color: var(--gray); }

/* ---- footer ---- */

footer {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem 1.6rem;
}
footer a { color: var(--faint); font-size: 12px; }
footer a:hover { color: var(--gray); }

/* ---- mobile ---- */

@media (max-width: 640px) {
  body { font-size: 14px; }
  #term { padding: 1.6rem 1.1rem 0.8rem; }
  .bar { padding: 0.75rem 1.1rem; }
  .bar-title { text-align: left; }
  .card { flex-direction: column; gap: 1.4rem; }
  .card .art { font-size: 12px; }
  .swatches { grid-template-columns: repeat(8, 24px); grid-auto-rows: 14px; }
  #chips { gap: 0.5rem; }
  #chips button { font-size: 14px; padding: 0.55rem 1rem; }
  footer { padding: 0.4rem 1.1rem 1.4rem; }
}

/* ---- reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  #cursor { animation: none; }
  .beacon { animation: none; }
}
