/* =========================
   BASE
========================= */

* { box-sizing: border-box; }

:root {
  --type-size: 1.7rem;
  --type-line: 1.2;
  --type-weight: 600;
  --accent: #6A00FF;

  --edge-pad: 12px;
  --footer-pad: calc(var(--edge-pad) + 2em + env(safe-area-inset-bottom, 0px));

  --col-year: 5.5em;
  --gap: 0;
}

body {
  margin: 0;
  background: #B4B3C9;
  color: #000;
  font-family: "Space Grotesk", serif;
  font-weight: var(--type-weight);
  font-style: normal;
  line-height: var(--type-line);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: var(--footer-pad);
}

.container { padding: var(--edge-pad); position: relative; z-index: 200; }

/* =========================
   SENTENCE + PANEL TYPE
========================= */

.sentence,
#panel-text,
#panel-text * {
  font-size: var(--type-size);
  line-height: var(--type-line);
  font-weight: var(--type-weight);
}

.sentence {
  margin: 0;
  max-width: 100vw;
  position: relative;
  z-index: 300;
  background: #B4B3C9;
  padding-bottom: 0.2em;
}

/* =========================
   LINKS
========================= */

.inline-link {
  color: #000000;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  cursor: pointer;
}

.inline-link:hover { color: var(--accent); }

.inline-link.active {
  color: var(--accent);
}

/* =========================
   PANEL
========================= */

.panel {
  height: 0;
  overflow: hidden;
  opacity: 0;
  transition: height 420ms ease, opacity 220ms ease;
  color: var(--accent);
}

.panel.open { opacity: 1; }

#panel-text {
  padding-top: 0.1em;
  max-width: 100vw;
  word-break: break-word;
  padding-bottom: calc(0.5em + env(safe-area-inset-bottom, 0px));
}

/* =========================
   ENTRY SYSTEM
========================= */

#panel-text .entry {
  display: grid;
  grid-template-columns: var(--col-year) 1fr;
  column-gap: var(--gap);
  align-items: start;
}

#panel-text .year {
  white-space: nowrap;
  opacity: 0.6;
}

#panel-text .tag {
  opacity: 0.8;
  white-space: nowrap;
}

#panel-text .desc {
  min-width: 0;
}

#panel-text .entry--kv {
  grid-template-columns: max-content 1fr;
}

.mood-block {
  padding: 0.2em 0;
}

.panel.panel--cats {
  position: fixed;
  top: var(--cats-top, 0);
  left: 0;
  right: 0;
  bottom: var(--footer-pad);
  height: auto !important;
  overflow: hidden;
  z-index: 100;
}

#panel-text .mood-cats {
  font-size: var(--type-size);
  line-height: var(--type-line);
  word-break: break-all;
}

/* =========================
   DIARY STACK
========================= */

.diary-stack {
  position: relative;
  width: 60vw;
  max-width: 400px;
  aspect-ratio: 3 / 4;
  margin: 1em auto;
  cursor: pointer;
}

.diary-card {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  translate: -50% -50%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  opacity: 0;
}

.diary-card.diary-card--visible {
  opacity: 1;
}

@media (max-width: 600px) {
  .diary-stack {
    width: 80vw;
  }
}


.plain-link {
  color: inherit;
  text-decoration: none;
}

.plain-link:hover {
  color: inherit;
  text-decoration: none;
}

/* =========================
   FOOTER
========================= */

.footer-left,
.footer-right {
  position: fixed;
  bottom: 12px;
  font-size: var(--type-size);
  line-height: var(--type-line);
}

.footer-left { left: var(--edge-pad); }
.footer-right { right: var(--edge-pad); }

a.footer-link,
a.footer-link:link,
a.footer-link:visited,
a.footer-link:active,
a.footer-link:hover {
  color: #000 !important;
  text-decoration: none !important;
}

a.footer-link:hover {
  color: var(--accent) !important;
}

/* =========================
   PROJECT LIST
========================= */

.project-list {
  padding-left: calc(var(--col-year) + var(--gap));
  margin-bottom: 0.15em;
}

.project-item,
a.project-item:link,
a.project-item:visited,
a.project-item:active {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  opacity: 0.7;
  color: inherit;
  padding: 0.15em 0;
}

.project-item:hover {
  opacity: 1;
}

.project-item + .project-item::before {
  content: "/ ";
  text-decoration: none;
  display: inline;
  opacity: 0.5;
  pointer-events: none;
}

/* =========================
   LIGHTBOX
========================= */

.lightbox {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--sentence-bottom, 0px);
  bottom: var(--footer-pad);
  z-index: 1000;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox.lightbox--bottom {
  align-items: flex-end;
  padding-bottom: calc(var(--footer-pad) + 20px);
}

.lightbox-content {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 85vw;
}

.lightbox-img {
  max-width: 85vw;
  max-height: calc(100vh - var(--sentence-bottom, 0px) - var(--footer-pad) - 70px);
  object-fit: contain;
  border-radius: 4px;
  transition: opacity 200ms ease;
  display: block;
}

.lightbox-video {
  display: none;
  width: 80vw;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #000;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-prev,
.lightbox-next {
  display: none;
}

.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.9rem;
  opacity: 0.6;
  font-family: "Space Grotesk", serif;
}

.lightbox-caption {
  margin-top: 0.5em;
  text-align: left;
  color: #000000;
  font-size: calc(var(--type-size) / 2);
  font-weight: var(--type-weight);
  font-family: "Space Grotesk", serif;
  opacity: 0;
  transition: opacity 200ms ease;
  max-width: 100%;
  word-break: break-word;
}

/* =========================
   RESPONSIVE
========================= */

.mobile-br { display: none; }

@media (max-width: 600px) {
  :root {
    --col-year: 4.5em;
  }
  .mobile-br { display: block; }
}
