/* ============================================================
   ysd-blog Terminal — CSS variables for theme system
   Phase 2: default dark terminal. Phase 3: sakura theme.
   ============================================================ */

:root {
  /* ── base palette (Phase 2: dark terminal) ── */
  --bg:           #1a1b26;
  --bg-alt:       #16161e;
  --fg:           #c0caf5;
  --fg-dim:       #a9b1d6;
  --accent:       #7aa2f7;
  --accent-dim:   #565f89;
  --success:      #9ece6a;
  --warning:      #e0af68;
  --error:        #f7768e;
  --border:       #24283b;
  --selection:    #33467c;

  /* ── typography ── */
  --font-mono:    'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;
  --font-size:    14px;
  --line-height:  1.5;

  /* ── layout ── */
  --radius:       8px;
  --pad:          16px;
  --title-h:      36px;
}

/* ── Phase 3 sakura theme (uncomment to activate) ──
:root[data-theme="sakura"] {
  --bg:           #fef0f5;
  --bg-alt:       #fde5ef;
  --fg:           #5a3e52;
  --fg-dim:       #8b6b80;
  --accent:       #e88fb0;
  --accent-dim:   #d4a0b9;
  --success:      #7eb88a;
  --warning:      #d4a853;
  --error:       #d4687c;
  --border:       #f5d0e0;
  --selection:    #f0c0d8;
}
*/

/* ── reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-alt);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--font-size);
  line-height: var(--line-height);
  overflow: hidden;
}

/* ── app shell ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ── titlebar (macOS dots) ── */
.titlebar {
  display: flex;
  align-items: center;
  height: var(--title-h);
  padding: 0 var(--pad);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
  user-select: none;
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
}
.dot-red    { background: var(--error); }
.dot-yellow { background: var(--warning); }
.dot-green  { background: var(--success); }

.titlebar-name {
  margin-left: 12px;
  color: var(--fg-dim);
  font-size: 13px;
}

/* ── terminal body ── */
.terminal {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.output {
  flex: 1;
  overflow-y: auto;
  padding: var(--pad);
  padding-bottom: 0;
  scroll-behavior: smooth;
}

.output-line {
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 2px;
}

.output-line.banner {
  color: var(--accent);
  margin-bottom: 12px;
  line-height: 1.3;
}

.output-line.error { color: var(--error); }
.output-line.success { color: var(--success); }
.output-line.warning { color: var(--warning); }
.output-line.dim { color: var(--fg-dim); }

/* ── input line (flows with output, like a real terminal) ── */
.input-line {
  display: flex;
  align-items: center;
  padding: 0 0 var(--pad) 0;
  margin-top: 2px;
}

.prompt {
  color: var(--accent);
  white-space: nowrap;
  user-select: none;
}

.input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  caret-color: var(--accent);
}

.input::selection { background: var(--selection); }

/* ── scrollbar ── */
.output::-webkit-scrollbar { width: 8px; }
.output::-webkit-scrollbar-track { background: var(--bg); }
.output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.output::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── cursor blink (for Phase 3) ──
.cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--accent);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}
@keyframes blink { 50% { opacity: 0; } }
*/

/* ── exit full-screen sakura ── */
#exit-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #24283b 0%, var(--bg-alt) 70%);
  color: var(--fg);
  font-family: var(--font-mono);
  text-align: center;
  z-index: 10;
  overflow: hidden;
}

.exit-inner { position: relative; z-index: 2; padding: 24px; }

.exit-banner {
  color: var(--accent);
  margin-bottom: 18px;
  line-height: 1.3;
  white-space: pre;
}

.exit-hint { color: var(--fg-dim); font-size: 13px; }

.exit-sakura {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.petal {
  position: absolute;
  top: -2em;
  opacity: 0;
  animation: sakura-fall linear infinite;
}

@keyframes sakura-fall {
  0%   { transform: translateY(-10vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: 0.9; }
  90%  { opacity: 0.9; }
  100% { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

/* ── responsive ── */
@media (max-width: 640px) {
  :root { --font-size: 13px; --pad: 10px; }
  #app { border: none; }
}
