/* ============================================================
   Elliott Rosenberg — Shared Stylesheet
   ============================================================ */

@font-face {
  font-family: 'GT America';
  src: url('../assets/fonts/GT-America-Bold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'GT America';
  src: url('../assets/fonts/GT-America-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'GT America';
  src: url('../assets/fonts/GT-America-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'GT America';
  src: url('../assets/fonts/GT-America-Light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}

/* ── TOKENS ── */
:root {
  --bg:     #ffffff;
  --ink:    #000000;
  --mid:    #555555;
  --border: #bbbbbb;
  --accent: #0000cc;
  --font:   'Times New Roman', Times, serif;
  --pad-x:  0px;
  --pad-top: 8px;

  /* Console vars — light mode (Chrome DevTools style) */
  --c-bg:      #f5f5f5;
  --c-ink:     #1e1e1e;
  --c-bar:     #ebebeb;
  --c-border:  #d0d0d0;
  --c-comment: #4a7c59;
  --c-value:   #0070c1;
  --c-string:  #a31515;
  --c-input:   #ffffff;
  --c-run:     #005fb8;
  --c-muted:   #878787;
}

[data-theme="dark"] {
  --bg:     #111111;
  --ink:    #dddddd;
  --mid:    #888888;
  --border: #333333;
  --accent: #5588ff;

  /* Console vars — dark mode (VS Code terminal style) */
  --c-bg:      #1e1e1e;
  --c-ink:     #d4d4d4;
  --c-bar:     #252526;
  --c-border:  #444444;
  --c-comment: #6a9955;
  --c-value:   #9cdcfe;
  --c-string:  #ce9178;
  --c-input:   #2d2d2d;
  --c-run:     #0e639c;
  --c-muted:   #555555;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { text-decoration: none; color: inherit; }
button { font-family: var(--font); }
img { display: block; max-width: 100%; }

/* ── LAYOUT WRAPPER ── */
.page {
  flex: 1;
  width: 100%;
  padding: var(--pad-top) var(--pad-x) 96px;
  padding-bottom: var(--console-height, 220px);
}

/* ── FOOTER ── */
footer {
  width: 100%;
  padding: 28px var(--pad-x) 52px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-nav { display: flex; gap: 24px; list-style: none; }
.footer-nav a { font-size: 11px; color: var(--mid); }
.footer-nav a:hover { color: var(--ink); }

/* ── THEME TOGGLE ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  font-size: 10px;
  color: var(--mid);
  display: flex;
  align-items: center;
  gap: 7px;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.toggle-pip { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }

/* ── SHARED TAGS ── */
.tag {
  font-size: 11px;
  color: var(--mid);
}

/* ── POPUP ── */
.popup-overlay {
  position: fixed; inset: 0;
  display: none; z-index: 100;
  /* transparent — just a click-outside capture layer */
}
.popup-overlay.open { display: block; }

.popup-card {
  position: fixed; top: 0; right: 0;
  width: min(340px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0;
  z-index: 101;
  display: none;
}
.popup-card.open { display: block; }

.popup-title { font-size: 1em; font-weight: bold; margin-bottom: 4px; padding-right: 20px; }
.popup-sub { font-size: 13px; color: var(--mid); margin-bottom: 16px; line-height: 1.6; }
.popup-form { display: flex; flex-direction: column; }

.popup-form input,
.popup-form textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  font-family: var(--font);
  font-size: 1em;
  color: var(--ink);
  outline: none; resize: none; width: 100%;
  margin-bottom: 2px;
}
.popup-form input:focus,
.popup-form textarea:focus { border-bottom-color: var(--ink); }
.popup-form input::placeholder,
.popup-form textarea::placeholder { color: var(--mid); }
.popup-form textarea { height: 80px; }

.popup-actions { margin-top: 16px; }

.btn-submit {
  font-family: var(--font); font-size: 1em;
  background: none; color: var(--accent); border: none; padding: 0;
  text-decoration: underline; cursor: pointer;
}
.btn-submit:hover { opacity: 0.7; }

.btn-close {
  position: absolute; top: 8px; right: 10px;
  font-size: 14px; color: var(--mid);
  background: none; border: none; font-family: var(--font); padding: 0; cursor: pointer;
}
.btn-close:hover { color: var(--ink); }

/* ── AI REDESIGN CONSOLE ── */
/* Uses --c-* vars which are set per-theme above, unknown to AI redesigns */

/* FAB — reopen console */
.redesign-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 9998;
  background: var(--c-bg); color: var(--c-ink);
  border: 1px solid var(--c-border);
  padding: 6px 12px;
  font-family: Menlo, Monaco, 'Courier New', monospace;
  font-size: 11px; cursor: pointer;
}
.redesign-fab:hover { background: var(--c-bar); }

/* Console — docked, full width, resizable */
.redesign-console {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--c-bg); color: var(--c-ink);
  font-family: Menlo, Monaco, 'Courier New', monospace;
  font-size: 12px; z-index: 9999;
  border-top: 1px solid var(--c-border);
  transform: translateY(100%);
  transition: transform 0.2s ease;
  display: flex; flex-direction: column;
  height: 280px; max-height: 50vh; min-height: 80px;
  overflow: hidden;
}
.redesign-console.open { transform: translateY(0); }

/* Drag-to-resize handle */
.console-resize-handle {
  height: 5px; background: var(--c-border);
  cursor: ns-resize;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; user-select: none;
}
.console-resize-handle:hover { background: var(--c-run); opacity: 0.5; }
.console-resize-grip { width: 32px; height: 3px; background: var(--c-muted); border-radius: 2px; }

.console-bar {
  background: var(--c-bar); padding: 6px 12px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.console-title { color: var(--c-ink); font-size: 11px; font-weight: bold; }
.console-bar-right { display: flex; align-items: center; gap: 6px; }

.console-body { display: flex; flex-direction: column; flex: 1; overflow: hidden; background: var(--c-bg); }
.console-scroll { flex: 1; overflow-y: auto; padding: 8px 12px 4px; display: flex; flex-direction: column; }
.console-form-area { flex-shrink: 0; padding: 6px 12px 10px; border-top: 1px solid var(--c-border); background: var(--c-bg); }

.console-log { color: var(--c-comment); margin-bottom: 6px; }
.console-active-vibe { color: var(--c-value); margin-bottom: 6px; }

/* Preset quick-launch buttons */
.console-presets { margin-bottom: 8px; }
.console-preset-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.console-preset-btn {
  background: none; border: 1px solid var(--c-border);
  color: var(--c-value); font-family: inherit; font-size: 11px;
  padding: 1px 7px; cursor: pointer;
}
.console-preset-btn:hover { border-color: var(--c-value); background: var(--c-input); }

.console-form-row { display: flex; align-items: flex-start; gap: 8px; }
.console-prompt { color: var(--c-comment); line-height: 28px; }

.console-input {
  flex: 1; background: var(--c-input); color: var(--c-ink);
  border: 1px solid var(--c-border); padding: 4px 8px;
  font-family: inherit; font-size: 12px; resize: none; line-height: 1.5;
}
.console-input:focus { outline: 1px solid var(--c-muted); }

.console-run {
  background: var(--c-run); color: #fff; border: none;
  padding: 4px 12px; font-family: inherit; font-size: 12px; cursor: pointer;
}
.console-run:hover { opacity: 0.85; }

.console-char-count { color: var(--c-muted); margin-top: 4px; font-size: 10px; }

.console-action-btn {
  background: none; border: 1px solid var(--c-border); color: var(--c-ink);
  font-family: inherit; font-size: 11px; padding: 2px 8px; cursor: pointer;
}
.console-action-btn:hover { border-color: var(--c-ink); }

/* Loading state (inline in scroll area) */
.console-loading-vibe { color: var(--c-string); margin-bottom: 8px; }
.console-loading-text { color: var(--c-comment); margin-top: 6px; font-size: 11px; }
.redesign-game-wrap { overflow: hidden; }
.redesign-progress { height: 2px; background: var(--c-border); overflow: hidden; margin-top: 6px; }
.redesign-progress-bar { height: 100%; background: var(--c-run); width: 0%; }

/* Share panel */
.redesign-share-panel {
  position: fixed; bottom: 0; left: 0;
  width: min(400px, 100vw);
  background: var(--c-bg); color: var(--c-ink);
  font-family: Menlo, Monaco, 'Courier New', monospace;
  font-size: 12px; z-index: 10000;
  border-top: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  transform: translateY(100%);
  transition: transform 0.2s ease;
}
.redesign-share-panel.open { transform: translateY(0); }
.redesign-share-link { color: var(--c-value); }
.redesign-share-link:hover { text-decoration: underline; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  :root { --pad-x: 20px; --pad-top: 52px; }
  body { cursor: auto; }
  footer { flex-direction: column; gap: 20px; align-items: flex-start; padding-bottom: 44px; }

  /* Console — shorter default height, tighter bar on small screens */
  .redesign-console { height: 220px; }
  .console-bar-right { flex-wrap: wrap; gap: 3px; }
  .console-action-btn { padding: 2px 4px; font-size: 10px; }
}
