/* === Base === */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'SF Mono', ui-monospace, 'Fira Mono', 'Consolas', monospace;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === State Layers === */
#boot,
#login,
#desktop {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#boot    { z-index: 100; }
#login   { z-index: 101; }
#desktop { z-index: 102; }

#boot.active,
#login.active,
#desktop.active {
  opacity: 1;
  pointer-events: auto;
}

/* login→desktop uses a quicker fade */
#login {
  transition: opacity 0.2s ease;
}

/* === Boot Screen === */
#boot {
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

#boot-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg);
  margin: 0;
}

.boot-progress-track {
  width: 220px;
  height: 14px;
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 2px;
  background: #000;
  overflow: hidden;
}

.boot-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--fg);
  border-radius: 2px;
  transition: width 3.4s linear;
}

.boot-progress-fill.go {
  width: 100%;
}

#boot-status {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin: 0;
  min-height: 1.2em;
}

/* === Login Screen === */
#login {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
}

.login-system-label {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
}

.login-welcome {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
}

.blink-cursor {
  display: inline-block;
  margin-left: 0.1em;
  animation: blink 1s step-end infinite;
  color: var(--fg);
  font-weight: 400;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.login-hint {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin: 0.5rem 0 0 0;
}

/* === Desktop === */
#desktop {
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* === Menubar === */
#menubar {
  height: 28px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 12px;
  flex-shrink: 0;
  user-select: none;
  gap: 0;
}

.menubar-brand {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--fg);
  margin-right: 1.5rem;
  flex-shrink: 0;
}

.menubar-item {
  font-size: 0.75rem;
  color: var(--fg);
  padding: 0 0.6rem;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: default;
  border-radius: 3px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.menubar-item:hover {
  background: rgba(255,255,255,0.1);
}

.menubar-spacer {
  flex: 1;
}

#menubar-clock {
  font-size: 0.72rem;
  color: var(--fg);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* === Desktop Background === */
#desktop-bg {
  flex: 1;
  background: var(--bg);
}

/* === Dock === */
#dock {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0 12px 0;
  flex-shrink: 0;
}

.dock-inner {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08),
              0 4px 16px rgba(0,0,0,0.4);
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;
  position: relative;
  z-index: 1;
  padding: 4px 6px 0 6px;
}

.dock-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  color: var(--fg);
  transition: transform 0.15s ease;
}

.dock-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-item:hover .dock-icon {
  transform: scale(1.15) translateY(-4px);
}

.dock-label {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,20,0.92);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.62rem;
  color: var(--fg);
  letter-spacing: 0.03em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.dock-item:hover .dock-label {
  opacity: 1;
}

/* === App Windows === */
.os-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  min-width: 320px;
  min-height: 200px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 60px);
  user-select: none;
}

.window-titlebar {
  height: 32px;
  background: rgba(255,255,255,0.06);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 12px;
  cursor: default;
  flex-shrink: 0;
}

.window-controls {
  display: flex;
  gap: 6px;
  margin-right: 12px;
  flex-shrink: 0;
}

.window-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  padding: 0;
  cursor: default;
}

.window-btn.close {
  background: #ff5f57;
  cursor: pointer;
}

.window-btn.minimize {
  background: #febc2e;
}

.window-btn.maximize {
  background: #28c840;
}

.window-title {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  flex: 1;
  text-align: center;
}

.window-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  user-select: text;
  cursor: auto;
}

.window-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.12) 50%);
}

/* === Window Content === */
.win-body-text {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.exp-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.exp-entry {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.25rem;
}

.exp-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.exp-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.exp-role,
.exp-location {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.exp-company {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0 0 0.3rem 0;
}

.exp-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* === Flush window body modifier — must be used alongside .window-body === */
.window-body--flush {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* === Terminal === */
/* intentionally darker/dimmer than --bg/#111 for terminal depth */
.term-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #0a0a0a;
  font-family: 'SF Mono', ui-monospace, 'Fira Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  color: #c8c8c8;
}

.term-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.term-input-row {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 0.4rem 1rem;
  flex-shrink: 0;
}

.term-prompt {
  color: #5af78e;
  margin-right: 0.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #c8c8c8;
  font-family: inherit;
  font-size: inherit;
  caret-color: #5af78e;
}

/* === Finder === */
.finder-body {
  display: flex;
  flex: 1;
}

.finder-sidebar {
  width: 160px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  padding: 0.75rem 0;
}

.finder-sidebar-section {
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 0.75rem 0.35rem 0.75rem;
}

.finder-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  color: var(--fg);
  cursor: default;
  border-radius: 4px;
  margin: 0 4px;
}

.finder-sidebar-item:hover {
  background: rgba(255,255,255,0.07);
}

.finder-sidebar-item.active {
  background: rgba(255,255,255,0.12);
}

.finder-sidebar-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.finder-main {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.finder-icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0.5rem;
}

.finder-icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: default;
  padding: 0.5rem;
  border-radius: 6px;
  width: 80px;
}

.finder-icon-item:hover {
  background: rgba(255,255,255,0.07);
}

.finder-icon-item.selected {
  background: rgba(255,255,255,0.12);
}

.finder-icon-svg {
  width: 40px;
  height: 40px;
  stroke: var(--fg);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.finder-icon-label {
  font-size: 0.68rem;
  color: var(--fg);
  text-align: center;
  word-break: break-word;
}

.finder-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 0.8rem;
  color: var(--muted);
}

.finder-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
}

.finder-coming-soon-name {
  font-size: 0.85rem;
  color: var(--fg);
  font-weight: 600;
}

.finder-coming-soon-label {
  font-size: 0.78rem;
  color: var(--muted);
}

/* === Wallpapers === */
html[data-wallpaper="default"] #desktop-bg { background: var(--bg); }

html[data-wallpaper="dots"] #desktop-bg {
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 20px 20px;
}

html[data-wallpaper="grid"] #desktop-bg {
  background-color: var(--bg);
  background-image: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 24px 24px;
}

html[data-wallpaper="sunset"] #desktop-bg { background: linear-gradient(135deg, #ff6b35, #f7c59f); }
html[data-wallpaper="ocean"]  #desktop-bg { background: linear-gradient(135deg, #1a6b8a, #2ec4b6); }
html[data-wallpaper="aurora"] #desktop-bg { background: linear-gradient(135deg, #7b2d8b, #00c9a7); }

/* === Cursor Sizes === */
html[data-cursor="small"] body {
  cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M1 1l8 4-4 1-3 6z' fill='white' stroke='black' stroke-width='1'/></svg>") 0 0, auto;
}

html[data-cursor="medium"] body { cursor: auto; }

html[data-cursor="large"] body {
  cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'><path d='M2 2l18 9-9 2-7 14z' fill='white' stroke='black' stroke-width='1.5'/></svg>") 0 0, auto;
}

/* === Dock Position: Right === */
html[data-dock="right"] #desktop {
  display: grid;
  grid-template-areas: "menubar menubar" "bg dock";
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
}

html[data-dock="right"] #menubar    { grid-area: menubar; }
html[data-dock="right"] #desktop-bg { grid-area: bg; }
html[data-dock="right"] #dock       { grid-area: dock; padding: 12px 8px; }
html[data-dock="right"] .dock-inner { flex-direction: column; }

/* === Settings Window === */
.settings-main {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
}

.settings-section-title {
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.75rem 0;
}

.settings-swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.settings-swatch {
  width: 72px;
  height: 52px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  cursor: default;
  flex-shrink: 0;
}

.settings-swatch.active {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* Swatch preview backgrounds (always dark-base for pattern swatches) */
.settings-swatch[data-wallpaper="default"] { background: var(--bg); }
.settings-swatch[data-wallpaper="dots"] {
  background-color: #111;
  background-image: radial-gradient(circle, rgba(255,255,255,0.15) 1px, transparent 1px);
  background-size: 20px 20px;
}
.settings-swatch[data-wallpaper="grid"] {
  background-color: #111;
  background-image: linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 24px 24px;
}
.settings-swatch[data-wallpaper="sunset"] { background: linear-gradient(135deg, #ff6b35, #f7c59f); }
.settings-swatch[data-wallpaper="ocean"]  { background: linear-gradient(135deg, #1a6b8a, #2ec4b6); }
.settings-swatch[data-wallpaper="aurora"] { background: linear-gradient(135deg, #7b2d8b, #00c9a7); }

.settings-option-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.settings-option-btn {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  cursor: default;
}

.settings-option-btn:hover {
  background: rgba(255,255,255,0.05);
}

.settings-option-btn.active {
  background: var(--line);
  border-color: var(--fg);
}

/* === Light Theme Chrome Overrides === */
html[data-theme="light"] #menubar {
  background: rgba(0,0,0,0.04);
}

html[data-theme="light"] .menubar-item:hover {
  background: rgba(0,0,0,0.08);
}

html[data-theme="light"] .dock-inner {
  background: rgba(0,0,0,0.05);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.1);
}

html[data-theme="light"] .dock-icon {
  background: rgba(0,0,0,0.05);
}

html[data-theme="light"] .os-window {
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

html[data-theme="light"] .window-titlebar {
  background: rgba(0,0,0,0.04);
}

html[data-theme="light"] .finder-sidebar {
  background: rgba(0,0,0,0.03);
}

html[data-theme="light"] .finder-sidebar-item:hover {
  background: rgba(0,0,0,0.06);
}

html[data-theme="light"] .finder-sidebar-item.active {
  background: rgba(0,0,0,0.1);
}

html[data-theme="light"] .settings-option-btn:hover {
  background: rgba(0,0,0,0.05);
}

/* Light theme wallpaper pattern overrides (white dots/grid invisible on light bg) */
html[data-theme="light"][data-wallpaper="dots"] #desktop-bg {
  background-image: radial-gradient(circle, rgba(0,0,0,0.15) 1px, transparent 1px);
}

html[data-theme="light"][data-wallpaper="grid"] #desktop-bg {
  background-image: linear-gradient(rgba(0,0,0,0.08) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,0,0,0.08) 1px, transparent 1px);
}
