/* css/styles.css */

:root {
  --bg-color: #121212;
  --text-color: #ffffff;
  --accent: #FFD700;
  --slice-bg: #222;
  --slice-border: #333;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  /* Prevent scroll on main view */
  height: 100vh;
  width: 100vw;
}

.hidden {
  display: none !important;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Landing */
#landing {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
}

h1 {
  margin-bottom: 0.5rem;
}

.hint {
  color: #888;
  font-size: 0.9rem;
  margin-top: 2rem;
}

button {
  padding: 12px 24px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  margin-top: 20px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: bold;
}

.btn-secondary {
  background: #333;
  color: #fff;
}

/* App Main */
.top-bar {
  padding: 10px;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: space-between;
  font-family: monospace;
  font-size: 0.9rem;
  z-index: 10;
}

.compass-container {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.center-marker {
  position: absolute;
  z-index: 5;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.7rem;
  border: 2px solid var(--accent);
}

/* Compass Slices (Grid Layout) 
   We will position them absolutely in a circle or 3x3 grid around the center.
   Actually, a 3x3 grid is easiest for "Directional" UI.
*/

#compass {
  display: grid;
  grid-template-columns: 100px 100px 100px;
  grid-template-rows: 100px 100px 100px;
  gap: 10px;
}

.slice {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: var(--slice-bg);
  border: 1px solid var(--slice-border);
  overflow: hidden;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.slice.empty {
  opacity: 0.3;
}

/* Mapping buckets to grid 
   0=Ahead (N for grid), 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW
   
   Grid:
   [7 NW] [0 N ] [1 NE]
   [6 W ] [USER] [2 E ]
   [5 SW] [4 S ] [3 SE]
*/
.slice-n {
  grid-column: 2;
  grid-row: 1;
  border-bottom: 3px solid var(--accent);
}

.slice-ne {
  grid-column: 3;
  grid-row: 1;
}

.slice-e {
  grid-column: 3;
  grid-row: 2;
}

.slice-se {
  grid-column: 3;
  grid-row: 3;
}

.slice-s {
  grid-column: 2;
  grid-row: 3;
}

.slice-sw {
  grid-column: 1;
  grid-row: 3;
}

.slice-w {
  grid-column: 1;
  grid-row: 2;
}

.slice-nw {
  grid-column: 1;
  grid-row: 1;
}

.slice-content {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
}

.slice-content img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dist {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.8rem;
  text-align: center;
  padding: 2px;
}

/* Detail View */
#detail {
  background: #000;
  z-index: 100;
  justify-content: center;
}

.detail-content {
  position: relative;
  /* For absolute positioning of years */
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.detail-content img {
  flex: 1;
  width: 100%;
  object-fit: contain;
  background: #111;
}

.detail-meta {
  padding: 20px;
  background: #222;
}

#detail-title {
  margin: 0;
  font-size: 1.2rem;
}

#detail-info {
  color: #aaa;
  margin: 5px 0 15px 0;
}

/* Debug Overlay */
#debug {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px;
  border-radius: 8px;
  z-index: 999;
  font-size: 0.8rem;
}

#debug input {
  width: 80px;
}

/* Detail Orientation Bar */
#detail-orientation-bar {
  width: 80%;
  max-width: 300px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  margin: 10px auto;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  display: block;
  /* Ensure visibility */
}

/* The Fixed Center (Me) - Optional, just a line to show where I am */
#detail-orientation-bar .center-marker {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-50%);
}

/* The Moving Marker (Bucket Center) */
#detail-orientation-bar .orientation-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  /* We will animate translateX via JS */
  box-shadow: 0 0 8px var(--accent);
}

/* Active Slice Highlight */
.slice.active {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
  z-index: 5;
}

/* Year Indicators (Right Side) */
#detail-years {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 80px;
  pointer-events: none;
  /* Let clicks pass through to image/swipe if needed, but maybe we want buttons clickable? */
  z-index: 20;
}

/* Make actual indicators clickable if we add click logic later, or valid target for existing swipe */
.year-indicator {
  position: absolute;
  right: 15px;
  /* Margin from edge */
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 12px;
  border-radius: 20px;
  color: #fff;
  font-weight: bold;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: opacity 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#year-newer {
  top: 20px;
}

#year-current {
  top: 50%;
  transform: translateY(-50%);
  /* Vertically Centered */
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-size: 1.2rem;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

#year-older {
  bottom: 20px;
}

.year-indicator .arrow {
  font-size: 0.8rem;
  opacity: 0.8;
}

.year-indicator .val {
  font-size: 0.9rem;
}

#year-current .val {
  font-size: 1.1rem;
}