/* ===================================================
   THEMES
   Each theme is just a set of colors. Change them here,
   or copy a block to make a new theme.
   =================================================== */
:root,
[data-ui-theme="paper"] {
  --bg: #e8e7e5;          /* page background */
  --ink: #141414;         /* main text / lines */
  --muted: #7d7c79;       /* placeholder + secondary text */
  --field: #e1e0de;       /* input box background */
  --card: #f0efed;        /* project cards */
  --panel: #f2f1ef;       /* customize panel */
  --accent: #22b07d;      /* green status dot */
  --glow: none;           /* text glow (used by CRT theme) */
  color-scheme: light;
}
[data-ui-theme="ink"] {
  --bg: #151515;
  --ink: #ecebe7;
  --muted: #8b8a86;
  --field: #212120;
  --card: #1d1d1c;
  --panel: #1d1d1c;
  --accent: #3ccf91;
  color-scheme: dark;
}
[data-ui-theme="crt"] {
  --bg: #08110a;
  --ink: #7dff9e;
  --muted: #4a9e62;
  --field: #0f1e13;
  --card: #0d1a10;
  --panel: #0b160e;
  --accent: #7dff9e;
  --glow: 0 0 6px rgba(125, 255, 158, 0.55);
  color-scheme: dark;
}
[data-ui-theme="parchment"] {
  --bg: #f4ede2;
  --ink: #2a2118;
  --muted: #85786a;
  --field: #faf6ef;
  --card: #faf6ef;
  --panel: #f6f0e6;
  --accent: #22b07d;
  color-scheme: light;
}

:root {
  --serif: "Newsreader", Georgia, serif;
  --mono: "Courier Prime", "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  text-shadow: var(--glow);
  transition: background 0.25s, color 0.25s;
}

/* Faint scanlines for the CRT theme */
[data-ui-theme="crt"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px);
}

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

/* Two columns: narrow left, wide right */
.layout {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 2fr;
  gap: 4vw;
  min-height: 100vh;
  padding: 5vw 4vw 4vw 5vw;
}

/* ---------- Left column ---------- */
.side {
  display: flex;
  flex-direction: column;
}

.title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 4.2vw, 4.2rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.domain, .count {
  font-family: var(--mono);
  font-size: clamp(1rem, 1.5vw, 1.5rem);
  letter-spacing: 0.12em;
  margin: 1.2rem 0 0;
}
.count { color: var(--muted); margin-top: 0.4rem; font-size: clamp(0.9rem, 1.2vw, 1.2rem); }

.hint {
  margin-top: auto;           /* sits at the bottom of the column */
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  text-shadow: var(--glow);
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 3vw, 3rem);
  align-self: flex-start;
}
.key {
  background: var(--ink);
  color: var(--bg);
  text-shadow: none;
  font: 700 0.42em/1 system-ui, sans-serif;
  min-width: 2.1em;
  text-align: center;
  padding: 0.75em 0.35em 0.25em;
  border-radius: 3px;
}
.hint:hover { text-decoration: underline; }

/* ---------- Right column ---------- */
.content { padding-top: 1.4vw; min-width: 0; }

.label {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1rem, 1.5vw, 1.5rem);
  letter-spacing: 0.18em;
  margin: 0 0 1.5rem;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding-left: 4rem;
}

#search {
  flex: 1;
  min-width: 0;
  background: var(--field);
  border: none;
  outline: none;
  padding: 1.4rem 1.2rem;
  font-family: var(--mono);
  font-size: clamp(1rem, 1.6vw, 1.6rem);
  letter-spacing: 0.08em;
  color: var(--ink);
  text-shadow: var(--glow);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
#search::placeholder { color: var(--muted); }
#search:focus { box-shadow: inset 0 -2px 0 var(--ink); }

/* "Go" and "Open" share this arrow style */
.go, .open {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  text-shadow: var(--glow);
  font-family: var(--mono);
  font-size: clamp(1.6rem, 2.5vw, 2.6rem);
  letter-spacing: 0.06em;
  padding: 0;
  flex-shrink: 0;
}
.go svg, .open svg {
  width: 1.3em; height: 1.3em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s;
}
.go:hover svg, .project:hover .open svg { transform: translateX(4px); }

.message {
  min-height: 1.4em;
  margin: 0.6rem 0 0 4rem;
  font-family: var(--mono);
  color: var(--muted);
}

.rule {
  border: none;
  border-top: 3px solid var(--ink);
  margin: 0.6rem 0 2.6rem;
}

/* Project cards */
.projects {
  list-style: none;
  margin: 0;
  padding: 0 0 0 3rem;
  display: grid;
  gap: 14px;
}
.project {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  padding: 1.2rem 1.4rem;
  transition: transform 0.15s;
}
.project:hover { transform: translateX(4px); }
.project-info { flex: 1; min-width: 0; }
.project-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.3rem;
  font-weight: 500;
  font-size: clamp(1.25rem, 1.6vw, 1.6rem);
}
.badge {
  font: 400 0.75rem/1 var(--mono);
  letter-spacing: 0.08em;
  border: 1px solid var(--ink);
  padding: 4px 8px;
}
.project-desc {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  line-height: 1.4;
}
.project-desc:empty { display: none; }
.project-meta {
  margin: 0;
  font: 0.85rem/1.4 var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.open { font-size: clamp(1.1rem, 1.5vw, 1.5rem); gap: 0.8rem; }
/* The whole card is clickable through the Open link */
.open::after { content: ""; position: absolute; inset: 0; }

/* "More on the way..." below the list */
.more { padding-left: 3rem; margin-top: 2.4rem; }
.searching {
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  margin: 0;
}
.dots {
  display: inline-block;
  width: 1.2em;               /* room for 3 dots, so nothing shifts */
}

/* No-match state */
.no-match { padding-left: 3rem; }
.empty {
  font-weight: 500;
  font-size: clamp(1.5rem, 2vw, 2.1rem);
  margin: 0 0 1rem;
}
.sub {
  font-size: clamp(1.2rem, 1.6vw, 1.6rem);
  color: var(--muted);
  margin: 0;
}
.dotted {
  margin-top: 1.4rem;
  border-top: 5px dotted var(--ink);
}

/* ---------- Click-to-edit mode ---------- */
.editing .editable {
  outline: 1px dashed var(--muted);
  outline-offset: 4px;
  cursor: text;
}
.editing .editable:focus { outline: 2px solid var(--accent); }

/* ---------- Customize button + panel ---------- */
.customize-btn {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  color: var(--ink);
  text-shadow: var(--glow);
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 9px 14px;
  font: 0.8rem/1 var(--mono);
  letter-spacing: 0.08em;
  cursor: pointer;
}
.customize-btn .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.studio {
  position: fixed;
  top: calc(58px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  z-index: 20;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 74px);
  overflow-y: auto;
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--mono);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.studio-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}
.close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
}
.studio-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 16px 0 8px;
}
.options.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.studio button:not(.close) {
  background: transparent;
  color: var(--ink);
  text-shadow: var(--glow);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 8px 10px;
  font: 0.78rem/1.2 var(--mono);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.studio button:not(.close):not(.on):hover { background: var(--field); }
.options button.on {
  background: var(--ink);
  color: var(--bg);
  text-shadow: none;
  font-weight: 700;
}

.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--field);
  cursor: pointer;
}
.toggle b { display: block; font-size: 0.78rem; letter-spacing: 0.04em; }
.toggle small { display: block; font-size: 0.68rem; color: var(--muted); margin-top: 3px; }
.toggle input { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }

.studio .wide {
  width: 100%;
  margin-top: 16px;
  text-align: center !important;
  letter-spacing: 0.06em;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- Phone / small screens ---------- */
@media (max-width: 760px) {
  .layout {
    display: flex;
    flex-direction: column;
    padding: 64px 16px 32px;
    gap: 24px;
  }
  .side { display: contents; }   /* lets the Search hint move to the bottom */
  .title, .domain, .count { margin: 0; }
  .search-row { padding-left: 0; gap: 0.8rem; }
  #search { padding: 1rem 0.8rem; }
  .go { font-size: 1.4rem; gap: 0.5rem; }
  .message, .projects, .no-match, .more { margin-left: 0; padding-left: 0; }
  .project { padding: 1rem; }
  .open span { display: none; }  /* just the arrow on phones */
  .hint { order: 10; margin-top: 1rem; }
}
