/* Aisling Keep — layout and theme */

:root {
  --ivory: #fffef7;
  --ivory-warm: #f5f3eb;
  --stone: #e8e4dc;
  --red: #6b2020;
  --red-dark: #4a1616;
  --text: #2c2520;
  --text-muted: #5c5348;
}

* { box-sizing: border-box; }

body {
  font-family: "Crimson Text", "Georgia", serif;
  background: var(--ivory-warm);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--red);
  color: var(--ivory);
  padding: 1rem 1.5rem;
  border-bottom: 3px solid var(--red-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-text { min-width: 0; }
.header h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.subtitle { margin: 0.25rem 0 0; font-size: 0.85rem; opacity: 0.9; }

.header-compass {
  position: relative;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  border: 2px solid rgba(255, 254, 247, 0.5);
  border-radius: 50%;
  background: rgba(255, 254, 247, 0.08);
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ivory);
  box-shadow: inset 0 0 0 1px rgba(255, 254, 247, 0.15);
}

.header-compass::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  background: var(--ivory);
  border-radius: 50%;
  opacity: 0.7;
}

.header-compass .compass-s { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); }
.header-compass .compass-n { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); }
.header-compass .compass-e { position: absolute; left: 3px; top: 50%; transform: translateY(-50%); }
.header-compass .compass-w { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }

/* Main layout */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: 0;
}

.sidebar {
  background: var(--stone);
  border-right: 1px solid #d8d4cc;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-title {
  margin: 0 1rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--red-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Room list — shared link styles */
.room-list { list-style: none; margin: 0; padding: 0; }
.room-list li { margin: 0; padding: 0; }

.room-list a,
.room-list-sublist a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.room-list a {
  padding: 0.5rem 1rem;
}

.room-list a:hover,
.room-list-sublist a:hover {
  background: rgba(107, 32, 32, 0.08);
  border-left-color: var(--red);
}

.room-list a.active,
.room-list-sublist a.active {
  background: rgba(107, 32, 32, 0.12);
  border-left-color: var(--red);
  font-weight: 600;
  color: var(--red-dark);
}

/* Upper floor group */
.room-list-floor-group { margin-top: 0.5rem; list-style: none; }

.room-list-floor-wrap {
  border: 1px dotted var(--red-dark);
  border-radius: 2px;
  padding: 0.25rem 0 0.25rem 0.5rem;
  margin: 0 0.5rem 0 1rem;
}

.room-list-floor-wrap .room-list-label {
  display: block;
  padding: 0.25rem 0.5rem 0.25rem 0;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--red-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.room-list-sublist {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.75rem;
}

.room-list-sublist li { margin: 0; padding: 0; }

.room-list-sublist a {
  padding: 0.5rem 1rem 0.5rem 0.5rem;
}

/* Content area */
.content {
  background: var(--ivory);
  padding: 1.5rem 2rem;
  overflow-y: auto;
  border-left: 1px solid var(--stone);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.content-text { min-width: 0; }

.room-title {
  margin: 0 0 0.75rem;
  font-size: 1.4rem;
  color: var(--red-dark);
  border-bottom: 1px solid var(--stone);
  padding-bottom: 0.5rem;
}

.room-desc {
  margin: 0 0 1.25rem;
  line-height: 1.65;
  font-size: 1rem;
  max-width: 42rem;
}

/* Exits */
.exits { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.exits .exit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  background: var(--ivory);
  border: 1px solid var(--stone);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.exits .exit-link:hover {
  background: var(--red);
  border-color: var(--red-dark);
  color: var(--ivory);
}

.exits .exit-link:hover .exit-dir {
  background: rgba(255, 254, 247, 0.2);
  border-color: rgba(255, 254, 247, 0.4);
}

.exits .exit-dir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0.15rem 0.35rem;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--red);
  color: var(--ivory);
  border-radius: 3px;
  border: 1px solid transparent;
}

.exits .exit-room {
  font-weight: 500;
  color: var(--red-dark);
}

.exits .exit-link:hover .exit-room { color: var(--ivory); }

/* Map */
.map-wrap {
  margin: 0;
  background: var(--ivory);
  border: 1px solid var(--stone);
  padding: 0.75rem;
  border-radius: 2px;
  min-width: 0;
}

.map-container {
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.map-container svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.map-container .node {
  cursor: pointer;
  transition: opacity 0.15s;
}

.map-container .node:hover { opacity: 0.9; }

.map-container .node.active rect.label-container {
  stroke: var(--red) !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 4px rgba(107, 32, 32, 0.4));
}

.map-container .cluster > rect {
  transition: stroke 0.2s, stroke-width 0.2s, opacity 0.2s;
}

.map-container .cluster.active-floor > rect {
  stroke: var(--red) !important;
  stroke-width: 3px !important;
  opacity: 1;
}

.map-container .cluster:not(.active-floor) > rect { opacity: 0.5; }

.map-fallback {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Responsive */
@media (max-width: 900px) {
  .content { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .main { grid-template-columns: 1fr; }
  .sidebar {
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid #d8d4cc;
  }
  .room-list a,
  .room-list-sublist a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .content {
    padding: 1rem 1.25rem;
    border-left: none;
  }
  .exits .exit-link {
    min-height: 44px;
    padding: 0.5rem 0.5rem 0.5rem 0.4rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
  }
  .header h1 { font-size: 1.25rem; }
  .subtitle { font-size: 0.8rem; }
}

