:root{
  --mono: Tahoma, Geneva, Verdana, sans-serif;
  /* fallback before JS applies the time-based theme */
  --bg: #0a0a0a;
  --fg: #f2f2f2;
  --dim: #7a7a7a;
  --accent: #e8e8e8;
  --panel-bg: #161616;
  --panel-border: #262626;
  --panel-text: #4d4d4d;
}
.theme-dark{
  --bg: #0a0a0a;
  --fg: #f2f2f2;
  --dim: #7a7a7a;
  --accent: #e8e8e8;
  --panel-bg: #161616;
  --panel-border: #262626;
  --panel-text: #4d4d4d;
}
.theme-light{
  --bg: #f7f7f5;
  --fg: #111111;
  --dim: #6a6a6a;
  --accent: #000000;
  --panel-bg: #ececea;
  --panel-border: #d8d8d5;
  --panel-text: #8a8a8a;
}
*{box-sizing:border-box; margin:0; padding:0;}
html,body{
  background:var(--bg);
  color:var(--fg);
  font-family:var(--mono);
  height:100%;
  overflow-x:hidden;
  transition: background-color 0.6s ease, color 0.6s ease;
}
body{
  min-height:100vh;
}
body{
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:64px 24px 40px;
}
a{ color:inherit; text-decoration:none; }

header{
  display:flex;
  flex-direction:column;
  align-items:center;
  margin-bottom:72px;
}
.wordmark-img{
  width: clamp(220px, 46vw, 440px);
  height: auto;
  display: block;
  filter: none;
  transition: filter 0.6s ease;
}
/* evening theme: invert the black logo instead of swapping to a separate file */
.theme-dark .wordmark-img{
  filter: invert(1);
}
.clock{
  margin-top:18px;
  font-size:14px;
  color:var(--fg);
  letter-spacing:0.5px;
}

nav{
  width:100%;
  max-width: min(92vw, 640px);
  display:flex;
  flex-direction:column;
  gap:22px;
}
.nav-item{
  font-size:19px;
  color:var(--fg);
  cursor:pointer;
  width:fit-content;
  transition:color 0.15s ease;
  display:block;
}
.nav-item:hover, .nav-item:focus-visible{
  color:var(--dim);
  outline:none;
}
.nav-item.active{
  color:var(--accent);
}

.panel{
  width:100%;
  max-width: min(92vw, 640px);
  display:grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease;
}
.panel.open{
  grid-template-rows: 1fr;
}
.panel-inner{
  overflow:hidden;
  min-height:0;
  padding:14px 0 4px 0;
  font-size:14px;
  line-height:1.7;
  color:var(--dim);
}
.panel-inner p{ margin-bottom:12px; max-width:38ch; }

.grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
  margin-top:6px;
}
@media (min-width: 640px){
  .grid{
    grid-template-columns: repeat(3, 1fr);
  }
}
.grid-item{
  aspect-ratio: 4/5;
  background:var(--panel-bg);
  border:1px solid var(--panel-border);
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--panel-text);
  font-size:12px;
  font-family:inherit;
  transition: background-color 0.6s ease, border-color 0.6s ease, color 0.15s ease;
  position:relative;
  overflow:hidden;
  padding:0;
  margin:0;
  width:100%;
  cursor:pointer;
}
a.grid-item, button.grid-item{
  text-align:inherit;
}
a.grid-item:hover,
button.grid-item:hover{
  color:var(--fg);
  border-color:var(--dim);
}
.grid-item img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.grid-item .grid-label{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  padding:6px 8px;
  font-size:11px;
  color:#f2f2f2;
  background:linear-gradient(to top, rgba(0,0,0,0.75), rgba(0,0,0,0));
  text-align:left;
}

footer{
  margin-top:80px;
  display:flex;
  gap:22px;
}
.tagline{
  margin-top:14px;
  font-size:11px;
  color:var(--dim);
  letter-spacing:0.5px;
  transition: color 0.6s ease;
}
.icon{
  width:20px;
  height:20px;
  color:var(--dim);
  opacity:0.8;
  transition:opacity 0.15s ease, color 0.15s ease;
}
footer a:hover .icon{
  opacity:1;
  color:var(--fg);
}

@media (prefers-reduced-motion: reduce){
  .panel, .nav-item, .icon{ transition:none; }
}

/* ---- random page ---- */
body.random-page{
  padding:0;
}
.media-stage{
  width:100%;
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.media-stage img,
.media-stage video{
  max-width:90vw;
  max-height:80vh;
  width:auto;
  height:auto;
  opacity:0;
  transition:opacity 0.9s ease;
}
.media-stage img.visible,
.media-stage video.visible{
  opacity:1;
}
.media-empty{
  color:var(--dim);
  font-size:14px;
  text-align:center;
  max-width:32ch;
}

/* ---- gallery page ---- */
.gallery-page{
  width:100%;
  max-width: min(94vw, 960px);
  margin: 0 auto;
  padding: 48px 0 160px;
}
.gallery-title{
  font-size:19px;
  color:var(--fg);
  margin-bottom:22px;
}
@media (min-width: 960px){
  .gallery-grid{
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---- lightbox viewer ---- */
body.lightbox-locked{
  overflow:hidden;
}
.lightbox{
  position:fixed;
  inset:0;
  z-index:100;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,0.92);
}
.lightbox.open{
  display:flex;
}
.lightbox-stage{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  cursor:default;
}
.lightbox-stage img{
  max-width:88vw;
  max-height:80vh;
  width:auto;
  height:auto;
  user-select:none;
  -webkit-user-drag:none;
  touch-action:none;
  transition: transform 0.05s linear;
  cursor:grab;
}
.lightbox-close{
  position:fixed;
  top:20px;
  right:24px;
  background:none;
  border:none;
  color:#f2f2f2;
  font-size:32px;
  line-height:1;
  cursor:pointer;
  padding:6px 10px;
  opacity:0.8;
}
.lightbox-close:hover{
  opacity:1;
}
.lightbox-hint{
  position:fixed;
  bottom:20px;
  left:50%;
  transform:translateX(-50%);
  color:#a8a8a8;
  font-size:12px;
  letter-spacing:0.3px;
  pointer-events:none;
}

@keyframes fadeInMedia{
  from{ opacity:0; }
  to{ opacity:1; }
}
.fade-in-media{
  opacity:0;
  animation: fadeInMedia 0.9s ease forwards;
  animation-delay:0.05s;
}

.corner{
  position:fixed;
  left:20px;
  bottom:20px;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:8px;
  z-index:10;
}
.corner .wordmark-img{
  width:90px;
}
.corner .clock{
  margin-top:0;
  font-size:11px;
}
