/* ============================================
   Four Modes — Ink & Ochre / Geometric
   ============================================ */

:root {
  --compress: #5BA37A;
  --expand: #C4687A;
  --reflect: #B8963A;
  --execute: #5B8DB8;

  --compress-light: #EEF6F1;
  --expand-light: #F8EDF0;
  --reflect-light: #F7F2E6;
  --execute-light: #ECF1F7;

  --bg: #FAFAF8;
  --bg-card: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #6E6E66;
  --text-tertiary: #A3A299;
  --border: #E6E4DF;
  --border-light: #F0EEEA;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Space Grotesk', Georgia, serif;

  --header-h: 56px;
  --toolbar-h: 110px;
}

/* ---- Reset ---- */

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

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-title-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.site-title em {
  font-weight: 200;
  font-style: normal;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.site-logo svg {
  width: 12px;
  height: 12px;
}

.view-toggle {
  display: flex;
  gap: 4px;
}

.toggle-btn {
  padding: 6px 12px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

.toggle-btn.active {
  color: var(--text);
}

.toggle-btn:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

/* ---- Views ---- */

.view { display: none; }
.view.active { display: block; }

/* ---- Overview ---- */

.overview-layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 64px 24px 80px;
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 64px;
  align-items: center;
}

.overview-heading {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

.overview-paragraph {
  font-size: 13px;
  line-height: 1.6;
  padding-bottom: 12px;
  color: var(--text-secondary);
  max-width: 380px;
}

.overview-visual { position: relative; }

.visual-subheading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.modes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Mode cards */
.mode-card {
  aspect-ratio: 1;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  transition: transform 0.15s ease;
}

.mode-card:hover { transform: scale(1.03); }

/* Shape clip-paths */
.mode-card[data-mode="compress"] { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); background: var(--compress); }
.mode-card[data-mode="expand"] { clip-path: polygon(50% 2%, 98% 98%, 2% 98%); background: var(--expand); padding-top: 10%; }
.mode-card[data-mode="reflect"] { clip-path: circle(50% at 50% 50%); background: var(--reflect); }
.mode-card[data-mode="execute"] { background: var(--execute); width: 85%; height: 85%; justify-self: center; align-self: center; }

/* White fill inset for colored border effect */
.mode-card::after {
  content: '';
  position: absolute;
  inset: 1.5px;
  background: var(--bg-card);
  z-index: 0;
}

.mode-card[data-mode="compress"]::after { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.mode-card[data-mode="expand"]::after { clip-path: polygon(50% 2%, 98% 98%, 2% 98%); }
.mode-card[data-mode="reflect"]::after { clip-path: circle(50% at 50% 50%); }

/* Name colors */
.mode-card[data-mode="compress"] .mode-name { color: var(--compress); }
.mode-card[data-mode="expand"] .mode-name { color: var(--expand); }
.mode-card[data-mode="reflect"] .mode-name { color: var(--reflect); }
.mode-card[data-mode="execute"] .mode-name { color: var(--execute); }

/* Mode popover */
.mode-popover {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 20px 24px;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
}

.mode-popover[data-mode="compress"] { background: var(--compress); }
.mode-popover[data-mode="expand"] { background: var(--expand); }
.mode-popover[data-mode="reflect"] { background: var(--reflect); }
.mode-popover[data-mode="execute"] { background: var(--execute); }

.popover-desc { margin-bottom: 12px; }

.popover-link {
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.popover-link:hover { color: #fff; }

.mode-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  z-index: 1;
}

.mode-tagline {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
  position: relative;
  z-index: 1;
}

.visual-caption {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 12px;
  letter-spacing: 0.01em;
}

/* ---- Scenarios View ---- */

.scenarios-view.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h));
}

/* Toolbar */
.scenarios-toolbar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.toolbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

.search-wrapper input {
  width: 100%;
  padding: 20px 36px 20px 28px;
  font-family: var(--font-sans);
  font-size: 17px;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}

.search-wrapper input::placeholder { color: var(--text-tertiary); }

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
}

.search-clear:hover { color: var(--text); }
.search-clear svg { width: 14px; height: 14px; }

/* Filter chips */
.filter-bar {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 0 solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.filter-chip.active {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--text-secondary);
}

.filter-chip:not(.active) { opacity: 0.45; }
.filter-chip:hover:not(.active) { opacity: 0.7; }

.filter-chip:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.filter-chip[data-mode="compress"] .chip-shape { color: var(--compress); }
.filter-chip[data-mode="expand"] .chip-shape { color: var(--expand); }
.filter-chip[data-mode="reflect"] .chip-shape { color: var(--reflect); }
.filter-chip[data-mode="execute"] .chip-shape { color: var(--execute); }

.chip-shape { width: 10px; height: 10px; flex-shrink: 0; }

.chip-count {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.chip-count::before { content: attr(data-count); }

/* ---- Split Layout ---- */

.scenarios-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 0; /* critical for flex + overflow */
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

/* List column */
.list-col {
  overflow-y: auto;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.list-col::-webkit-scrollbar { width: 4px; }
.list-col::-webkit-scrollbar-thumb { background: var(--border); }

.scenario-list {
  display: flex;
  flex-direction: column;
}

.scenario-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 16px 24px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.1s ease;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.scenario-item:hover {
  background: var(--border-light);
}

.scenario-item.selected {
  background: var(--bg-card);
  border-left-color: var(--text-tertiary);
}

.scenario-item.selected[data-mode="compress"] { border-left-color: var(--compress); }
.scenario-item.selected[data-mode="expand"] { border-left-color: var(--expand); }
.scenario-item.selected[data-mode="reflect"] { border-left-color: var(--reflect); }
.scenario-item.selected[data-mode="execute"] { border-left-color: var(--execute); }

.scenario-item:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.scenario-shape {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
}

.scenario-item[data-mode="compress"] .scenario-shape { color: var(--compress); }
.scenario-item[data-mode="expand"] .scenario-shape { color: var(--expand); }
.scenario-item[data-mode="reflect"] .scenario-shape { color: var(--reflect); }
.scenario-item[data-mode="execute"] .scenario-shape { color: var(--execute); }

/* Detail column */
.detail-col {
  overflow-y: auto;
  padding: 32px 40px 64px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.detail-col::-webkit-scrollbar { width: 4px; }
.detail-col::-webkit-scrollbar-thumb { background: var(--border); }

/* Back button — desktop hidden */
.back-to-list {
  display: none;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 24px;
}

.back-to-list:hover { color: var(--text); }
.back-to-list svg { flex-shrink: 0; }

/* Detail content */
.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
}

.share-btn:hover { color: var(--text); border-color: var(--text-tertiary); }

.share-btn svg { width: 16px; height: 16px; }

.share-icon-svg.hidden,
.share-check-svg.hidden { display: none; }

.detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0;
}

.detail-badge[data-mode="compress"] { color: var(--compress); }
.detail-badge[data-mode="expand"] { color: var(--expand); }
.detail-badge[data-mode="reflect"] { color: var(--reflect); }
.detail-badge[data-mode="execute"] { color: var(--execute); }

.detail-badge-shape { width: 12px; height: 12px; }

.detail-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.detail-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* Suggested tools */
.detail-tools-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.detail-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  text-decoration: none;
}

.tool-chip:hover {
  border-color: var(--text-tertiary);
  color: var(--text-primary);
}

.tool-icon {
  width: 16px;
  height: 16px;
}

.detail-section { margin-bottom: 24px; }

.detail-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.detail-section-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.detail-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin-bottom: 24px;
}

.detail-principles {
  list-style: none;
}

.detail-principles li {
  display: flex;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 4px 0;
}

.detail-principles li::before {
  content: '';
  width: 4px;
  height: 4px;
  margin-top: 9px;
  flex-shrink: 0;
  background: var(--border);
}

/* Prompt */
.prompt-wrapper { position: relative; }

.prompt-block {
  font-family: 'SF Mono', 'Consolas', 'Liberation Mono', 'Menlo', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border-light);
  padding: 20px;
  padding-right: 48px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all 0.15s ease;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

.copy-btn svg { width: 15px; height: 15px; }
.copy-btn .check-visible { color: var(--expand); }

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
}

.empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.clear-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.clear-btn:hover { text-decoration: none; }

/* ---- Mobile ---- */

@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }

  .site-title em { display: none; }

  /* Overview */
  .overview-layout {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 20px 60px;
  }

  .overview-heading { font-size: 24px; }
  .overview-paragraph { max-width: none; }

  .modes-grid {
    grid-template-columns: 1fr;
    max-width: 240px;
    margin: 0 auto;
    gap: 8px;
  }

  .mode-name { font-size: 14px; }
  .mode-tagline { font-size: 10px; }

  .mode-popover { font-size: 12px; padding: 16px 20px; }

  /* Scenarios */
  .toolbar-inner {
    padding: 8px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrapper input {
    padding: 12px 36px 12px 28px;
    font-size: 15px;
  }

  .filter-bar {
    flex-wrap: nowrap;
    gap: 0;
    margin: 0 -16px;
    border-top: 1px solid var(--border);
  }

  .filter-chip {
    flex: 1;
    justify-content: center;
    padding: 8px 4px;
    font-size: 11px;
    border: none;
    border-right: 1px solid var(--border);
  }

  .filter-chip:last-child { border-right: none; }

  .filter-chip.active {
    background: var(--bg-card);
  }

  .scenarios-toolbar { border-bottom: none; }

  .scenarios-layout {
    grid-template-columns: 1fr;
  }

  /* On mobile, list and detail toggle */
  .list-col {
    border-right: none;
  }

  .detail-col {
    display: none;
    padding: 24px 20px 48px;
  }

  .scenarios-layout.showing-detail .list-col {
    display: none;
  }

  .scenarios-layout.showing-detail .detail-col {
    display: block;
    overflow-y: visible; /* let page scroll naturally on mobile */
  }

  .scenarios-layout.showing-detail .back-to-list {
    display: inline-flex;
  }

  .scenario-item {
    padding: 14px 16px;
    font-size: 15px;
  }
}

@media (max-width: 380px) {
  .filter-chip {
    font-size: 10px;
    padding: 7px 2px;
    gap: 3px;
  }

  .chip-shape { width: 8px; height: 8px; }

  .chip-count { font-size: 10px; }
}

@media (min-width: 769px) {
  .back-to-list { display: none !important; }
}

/* ---- Footer ---- */

.site-footer {
  padding: 24px;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover { color: var(--text); }

.site-footer .right-side { float: right; }

.scenarios-view.active ~ .site-footer { display: none; }

/* ---- Large screens ---- */

@media (min-width: 1024px) {
  .scenarios-layout {
    grid-template-columns: 380px 1fr;
  }

  .scenario-item {
    font-size: 16px;
    padding: 18px 28px;
  }

  .detail-title { font-size: 36px; }
}
