/* ==========================================================================
   CTRL+ALT+ERIC — retro personal-OS link hub
   Mobile-first. No framework, no build step. Self-contained (no external
   fonts) so this page loads fast on Instagram/TikTok in-app browsers.
   ========================================================================== */

:root {
  /* Windows 95 bevel palette */
  --win-face: #c0c0c0;
  --win-face-hover: #d4d4d4;
  --win-light: #dfdfdf;
  --win-highlight: #ffffff;
  --win-shadow: #808080;
  --win-darkshadow: #000000;
  --win-title: #0000aa;
  --win-title-text: #ffffff;
  --win-desktop: #0000aa;
  --win-desktop-deep: #000066;
  --ink: #000000;
  --ink-soft: #1a1a1a;
  --mono: 'Consolas', 'Courier New', 'JetBrains Mono', monospace;
  --ui-font: 'Tahoma', 'MS Sans Serif', 'Segoe UI', Verdana, sans-serif;
  --radius: 0;
  --taskbar-h: 3rem;
}

/* 3 AM mode overrides */
html.hour-3am {
  --win-face: #9aa0a6;
  --win-desktop: #05053a;
  --win-desktop-deep: #020218;
  --win-title: #050540;
}

* { box-sizing: border-box; }

/* Several component classes below set their own `display` (flex/grid/etc.)
   which has equal CSS specificity to the UA [hidden] rule and can win the
   cascade by source order, silently defeating `hidden`. This guards every
   hidden element in one place instead of chasing it per-component. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--ui-font);
  color: var(--ink);
  background: var(--win-desktop);
  min-height: 100vh;
  padding-bottom: calc(var(--taskbar-h) + 1rem);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  color: #000;
  padding: 0.5rem 1rem;
  z-index: 999;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================================
   Desktop backdrop texture (cheap, CSS-only)
   ========================================================================== */
.desktop {
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 6px);
  padding: 0.75rem 0.625rem 1.5rem;
  max-width: 780px;
  margin: 0 auto;
}

/* ==========================================================================
   Header block
   ========================================================================== */
.hero-block {
  text-align: center;
  padding: 1.75rem 0.75rem 1.25rem;
  color: #fff;
}

.hero-block__logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.5rem, 7vw, 2.5rem);
  letter-spacing: 0.06em;
  color: #fff;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  text-shadow: 2px 2px 0 var(--win-desktop-deep), 4px 4px 0 rgba(0,0,0,0.35);
  -webkit-tap-highlight-color: transparent;
}
.hero-block__logo:focus-visible {
  outline: 2px dashed #fff;
  outline-offset: 4px;
}

.hero-block__subtitle {
  font-family: var(--mono);
  margin: 0.75rem 0 0.25rem;
  font-size: 1rem;
  opacity: 0.92;
}

.hero-block__philosophy {
  font-family: var(--mono);
  margin: 0;
  font-size: 0.875rem;
  font-style: italic;
  opacity: 0.75;
}

/* ==========================================================================
   Window chrome — the classic 3D bevel, built from layered borders
   ========================================================================== */
.win-window {
  background: var(--win-face);
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-light) var(--win-darkshadow) var(--win-darkshadow) var(--win-light);
  box-shadow:
    inset 1px 1px 0 var(--win-highlight),
    inset -1px -1px 0 var(--win-shadow),
    3px 3px 0 rgba(0,0,0,0.35);
  margin: 0 0 1.25rem;
}

.win-titlebar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--win-title);
  color: var(--win-title-text);
  padding: 0.4rem 0.5rem;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.win-titlebar__icon {
  flex: none;
  font-size: 1rem;
  line-height: 1;
}

.win-titlebar__text {
  flex: 1 1 auto;
  margin: 0;
  font: inherit;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-titlebar__controls {
  display: flex;
  gap: 0.25rem;
  flex: none;
}

.win-btn {
  width: 1.5rem;
  height: 1.35rem;
  background: var(--win-face);
  border-style: solid;
  border-width: 1px;
  border-color: var(--win-light) var(--win-darkshadow) var(--win-darkshadow) var(--win-light);
  box-shadow: inset 1px 1px 0 var(--win-highlight);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.win-btn:active {
  border-color: var(--win-darkshadow) var(--win-light) var(--win-light) var(--win-darkshadow);
  box-shadow: inset -1px -1px 0 var(--win-highlight);
}

.win-body {
  padding: 0.75rem;
}

.win-subheading {
  font-family: var(--mono);
  font-size: 0.95rem;
  margin: 1.25rem 0 0.6rem;
  border-bottom: 1px solid var(--win-shadow);
  padding-bottom: 0.25rem;
}
.win-subheading:first-child { margin-top: 0; }

/* window shake feedback when a decorative/close button is tapped */
.win-window.shake { animation: win-shake 0.32s ease; }
@keyframes win-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ==========================================================================
   App cards (link tiles)
   ========================================================================== */
.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.app-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  min-height: 3.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--win-face);
  color: var(--ink);
  text-decoration: none;
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-highlight) var(--win-shadow) var(--win-shadow) var(--win-highlight);
  box-shadow: inset 1px 1px 0 var(--win-light);
  -webkit-tap-highlight-color: transparent;
}

.app-card:hover,
.app-card:focus-visible {
  background: var(--win-face-hover);
}

.app-card:active {
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
}

.app-card:focus-visible {
  outline: 2px dashed var(--win-title);
  outline-offset: 2px;
}

.app-card__icon {
  flex: none;
  font-size: 1.5rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-style: solid;
  border-width: 1px;
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
}

.app-card__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.app-card__title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
  min-width: 0;
}

.app-card__badge {
  font-family: var(--ui-font);
  font-weight: 400;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--win-title);
  color: var(--win-title-text);
  padding: 0.1rem 0.4rem;
}

.app-card__desc {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.app-card__arrow {
  flex: none;
  font-size: 1.25rem;
  color: var(--win-shadow);
}

.app-card--static {
  cursor: default;
}
.app-card--static:hover { background: var(--win-face); }

/* ==========================================================================
   Terminal
   ========================================================================== */
.win-body--terminal { padding: 0.6rem; }

.terminal-screen {
  background: #000;
  color: #33ff33;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 0.75rem;
  height: 11rem;
  overflow-y: auto;
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
}

.terminal-line { margin: 0 0 0.4rem; white-space: pre-wrap; word-break: break-word; }
.terminal-line--prompt { color: #fff; }
.terminal-line pre { margin: 0; font-family: inherit; color: inherit; }

.terminal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--win-face);
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-highlight) var(--win-shadow) var(--win-shadow) var(--win-highlight);
  padding: 0.4rem 0.6rem;
  min-height: 2.25rem;
  cursor: pointer;
  color: var(--ink);
}
.chip:active {
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
}
.chip:focus-visible {
  outline: 2px dashed var(--win-title);
  outline-offset: 2px;
}

/* ==========================================================================
   Archives
   ========================================================================== */
.archives-intro {
  font-family: var(--mono);
  font-style: italic;
  font-size: 0.9rem;
  border-left: 3px solid var(--win-title);
  padding-left: 0.6rem;
  margin: 0 0 0.5rem;
}

.archives-category-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 0.75rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--win-shadow);
}

.timeline__item {
  position: relative;
  padding: 0 0 1rem 1rem;
}
.timeline__item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 0.2rem;
  width: 10px;
  height: 10px;
  background: var(--win-title);
  border: 1px solid #fff;
}

.timeline__year {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--win-title);
  margin-bottom: 0.15rem;
}

.timeline__text {
  display: block;
  font-size: 0.88rem;
  line-height: 1.45;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.archive-shot__trigger {
  display: block;
  width: 100%;
  padding: 0;
  background: var(--win-face);
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-highlight) var(--win-shadow) var(--win-shadow) var(--win-highlight);
  cursor: pointer;
}
.archive-shot__trigger:active {
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
}
.archive-shot__trigger:focus-visible {
  outline: 2px dashed var(--win-title);
  outline-offset: 2px;
}

.archive-shot__trigger img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-bottom: 2px solid var(--win-shadow);
}

.archive-shot__placeholder {
  display: none;
  aspect-ratio: 4 / 3;
  width: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--win-shadow);
  background:
    repeating-linear-gradient(45deg, #b9b9b9 0 6px, #c0c0c0 6px 12px);
  border-bottom: 2px solid var(--win-shadow);
}

.archive-shot--missing img { display: none; }
.archive-shot--missing .archive-shot__placeholder { display: flex; }

.archive-shot__caption {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.35rem;
  text-align: center;
}

/* ==========================================================================
   Desktop icons (Recycle Bin, etc.)
   ========================================================================== */
.desktop-icons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 0.5rem 0 1.25rem;
}

.desktop-icon {
  background: none;
  border: none;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--ui-font);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  min-width: 4.5rem;
}
.desktop-icon:focus-visible,
.desktop-icon:active {
  outline: 1px dotted #fff;
  background: rgba(255,255,255,0.12);
}
.desktop-icon__glyph { font-size: 1.75rem; }

/* ==========================================================================
   Random fact footer
   ========================================================================== */
.random-fact {
  text-align: center;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.75rem;
  opacity: 0.85;
  padding: 0 0.75rem;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.win-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.win-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  border: none;
}

.win-modal__window {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 24rem;
  max-height: 85vh;
  overflow-y: auto;
  margin: 0;
}

.win-modal__window--lightbox { max-width: 30rem; }

.about-line { margin: 0 0 0.5rem; font-family: var(--mono); font-size: 0.88rem; }
.about-line--name { font-size: 1.1rem; font-weight: 700; }
.about-line--status { font-style: italic; color: var(--win-title); }

.btn-3d {
  font-family: var(--ui-font);
  background: var(--win-face);
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-highlight) var(--win-shadow) var(--win-shadow) var(--win-highlight);
  padding: 0.5rem 1.25rem;
  min-height: 2.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn-3d:active {
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
}
.btn-3d:focus-visible {
  outline: 2px dashed var(--win-title);
  outline-offset: 2px;
}

.btn-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

#lightbox-img { width: 100%; border: 2px solid var(--win-shadow); }
.archive-shot__placeholder--lightbox {
  display: flex;
  height: 12rem;
  border: 2px solid var(--win-shadow);
  font-size: 0.85rem;
}
.lightbox-caption {
  font-family: var(--mono);
  font-size: 0.82rem;
  margin: 0.6rem 0 0;
}

.deleted-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.deleted-list li {
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--win-shadow);
  color: var(--win-shadow);
}
.deleted-list li:last-child { border-bottom: none; }

/* ==========================================================================
   BSOD
   ========================================================================== */
.bsod {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #0000aa;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  cursor: pointer;
}
.bsod__content {
  font-family: var(--mono);
  max-width: 32rem;
  line-height: 1.7;
}
.bsod__title { font-weight: 700; margin-top: 0; }
.bsod__hint { margin-top: 1.5rem; opacity: 0.85; }

/* ==========================================================================
   Matrix overlay
   ========================================================================== */
.matrix-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #000;
  pointer-events: none;
}

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--taskbar-h) + 0.75rem);
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--win-highlight);
  z-index: 300;
  max-width: 90vw;
  text-align: center;
}

/* ==========================================================================
   3 AM banner
   ========================================================================== */
.banner-3am {
  position: relative;
  z-index: 100;
  background: #000;
  color: #33ff33;
  font-family: var(--mono);
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
}
.banner-3am__dismiss {
  background: none;
  border: 1px solid #33ff33;
  color: #33ff33;
  width: 1.5rem;
  height: 1.5rem;
  cursor: pointer;
  line-height: 1;
  flex: none;
}

/* ==========================================================================
   Taskbar
   ========================================================================== */
.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--taskbar-h);
  background: var(--win-face);
  border-top: 2px solid var(--win-highlight);
  box-shadow: 0 -2px 0 var(--win-shadow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem;
  z-index: 250;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  background: var(--win-face);
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-highlight) var(--win-shadow) var(--win-shadow) var(--win-highlight);
  font-family: var(--ui-font);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}
.start-btn[aria-expanded="true"],
.start-btn:active {
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
}
.start-btn__icon { font-size: 1rem; }

.start-menu {
  position: fixed;
  left: 0.5rem;
  bottom: calc(var(--taskbar-h) + 0.25rem);
  width: min(14rem, 80vw);
  background: var(--win-face);
  border-style: solid;
  border-width: 2px;
  border-color: var(--win-highlight) var(--win-shadow) var(--win-shadow) var(--win-highlight);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.35);
  z-index: 260;
}
.start-menu ul { list-style: none; margin: 0; padding: 0.3rem; }
.start-menu li { margin: 0; }
.start-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  color: var(--ink);
}
.start-menu button:hover,
.start-menu button:focus-visible {
  background: var(--win-title);
  color: #fff;
  outline: none;
}
.start-menu__divider {
  height: 1px;
  background: var(--win-shadow);
  box-shadow: 0 1px 0 var(--win-highlight);
  margin: 0.3rem 0.2rem;
}

.taskbar__tray {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-style: solid;
  border-width: 1px;
  border-color: var(--win-shadow) var(--win-highlight) var(--win-highlight) var(--win-shadow);
  padding: 0.2rem 0.5rem;
  height: 2rem;
}

.tray-btn {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.tray-btn:focus-visible { outline: 1px dotted var(--ink); }

.tray-clock {
  font-family: var(--mono);
  font-size: 0.8rem;
}

/* ==========================================================================
   Boot screen
   ========================================================================== */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #000;
  color: #33ff33;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.35s ease;
}
.boot-screen.is-hiding { opacity: 0; pointer-events: none; }

.boot-screen__inner { font-family: var(--mono); padding: 1.5rem; }
.boot-screen__brand {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  margin: 0 0 1rem;
}
.boot-screen__msg { font-size: 0.9rem; margin: 0 0 1rem; min-height: 1.3em; }
.boot-screen__bar {
  width: 14rem;
  max-width: 70vw;
  height: 0.6rem;
  border: 1px solid #33ff33;
  margin: 0 auto 1rem;
  padding: 2px;
}
.boot-screen__bar-fill {
  height: 100%;
  width: 0%;
  background: #33ff33;
  transition: width 1.1s linear;
}
.boot-screen__skip { font-size: 0.7rem; opacity: 0.6; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .boot-screen__bar-fill { transition: none; }
  .boot-screen { transition: none; }
}

/* ==========================================================================
   Utility / motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   Larger screens — iPad / desktop
   ========================================================================== */
@media (min-width: 640px) {
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-block__logo { font-size: 2.75rem; }
}

@media (min-width: 900px) {
  .app-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
