/* ============================================================================
   styles.css  —  the look & feel of the whole site.
   You usually won't need to touch this. Fonts, sizes, and layout live here.
============================================================================ */

/* --- Basic reset so the site looks the same in every browser --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* The sidebar colour is set live by JavaScript, but we give it a start value */
  --sidebar-color: #2e3a2f;
  --sidebar-text: #ffffff;
  --fade-time: 1.2s;            /* how long the cross-fade takes */
  --sidebar-width: 22%;         /* width of the left sidebar (~20%) */
}

html, body {
  height: 100%;
  font-family: Helvetica, Arial, sans-serif;   /* standard, consistent everywhere */
  font-size: 16px;              /* "medium size" base text */
  line-height: 1.5;
  letter-spacing: normal;       /* standard, un-stretched spacing site-wide */
  color: #1c1c1c;
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }


/* ============================================================================
   SIDEBAR (shared by every page)
============================================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;   /* text at top, buttons at bottom */
  background-color: var(--sidebar-color);
  color: var(--sidebar-text);
  /* the smooth colour cross-fade when images change: */
  transition: background-color var(--fade-time) ease-in-out,
              color var(--fade-time) ease-in-out;
  z-index: 10;
  overflow-y: auto;
}

.sidebar__intro p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* "hello + welcome." is now the same standard size/weight as the rest. */
.sidebar__intro .lede {
  font-size: 1rem;
  font-weight: 400;
}

/* The navigation buttons: text with a medium-thickness rectangle around them */
.sidebar__nav {
  display: flex;
  flex-direction: column;
  align-items: center;          /* centred within the sidebar */
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  width: 80%;
  max-width: 220px;
  text-align: center;
  padding: 0.6rem 1rem;
  border: 2px solid currentColor;   /* medium-thickness rectangle line */
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.btn:hover {
  background-color: currentColor;   /* fill on hover... */
}
.btn:hover span {
  color: var(--sidebar-color);      /* ...text flips to the sidebar colour */
}


/* ============================================================================
   MAIN CONTENT AREA (right of sidebar)
============================================================================ */
.content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}


/* ============================================================================
   LANDING PAGE SLIDESHOW
============================================================================ */
.slideshow {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  height: 100vh;
}

.slide {
  position: absolute;
  inset: 0;                     /* fill the whole area */
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity var(--fade-time) ease-in-out;
}

.slide.is-active {
  opacity: 1;
}


/* ============================================================================
   WRITING PAGE
============================================================================ */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

.page__title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

.entry {
  border-bottom: 1px solid #e2e2e2;
  padding: 1.25rem 0;
}

.entry__header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 500;
  color: #1c1c1c;
}

.entry__toggle {
  display: inline-block;
  width: 1.2em;
  font-weight: 400;
  color: #888;
}

.entry__date {
  font-size: 0.85rem;
  color: #999;
  font-weight: 400;
}

/* Smooth expand/collapse: the row animates from 0 to its real height and back,
   so it glides open and closed no matter how long the writing is. */
.entry__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s ease;
}

.entry__body-inner {
  min-height: 0;                /* required so the grid can shrink to 0 */
  overflow: hidden;
  white-space: pre-line;        /* keeps your line breaks from data.js */
  font-size: 1rem;
  color: #333;
}

.entry.is-open .entry__body {
  grid-template-rows: 1fr;
}

/* small fade + spacing that also eases in/out with the open state */
.entry.is-open .entry__body-inner {
  padding-top: 0.75rem;
}

.entry__toggle {
  transition: transform 0.3s ease;
}


/* ============================================================================
   LIBRARY PAGE (music + books)
============================================================================ */
.library-section {
  padding: 3rem 2rem;
}

.library-section + .library-section {
  border-top: 1px solid #ececec;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

/* Search box, top-right of the library page */
.library-search {
  display: flex;
  justify-content: flex-end;
  padding: 1.5rem 2rem 0;
}
#library-search-input {
  width: 280px;
  max-width: 100%;
  padding: 0.55rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  color: #1c1c1c;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
}
#library-search-input:focus {
  border-color: #888;
}

/* Title tile shown when a card has no cover/poster image yet */
.cover-card__fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.75rem;
  background: #3b3b3b;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

/* A scroller = left arrow + the scrolling row + right arrow */
.cover-scroller {
  position: relative;
}

/* Horizontal left/right scrolling row of covers */
.cover-row {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}
.cover-row::-webkit-scrollbar { height: 8px; }
.cover-row::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
.cover-row::-webkit-scrollbar-track { background: #f2f2f2; border-radius: 4px; }

/* The round left/right arrow buttons */
.scroll-btn {
  position: absolute;
  top: 105px;                   /* roughly centred on the cover images */
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  color: #222;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;                   /* hidden until you hover the row */
  transition: opacity 0.2s ease, background 0.2s ease;
}
.scroll-btn:hover { background: #fff; }
.scroll-btn--left { left: -6px; }
.scroll-btn--right { right: -6px; }
/* Show the arrows when hovering (or keyboard-focusing) the row... */
.cover-scroller:hover .scroll-btn,
.cover-scroller:focus-within .scroll-btn {
  opacity: 1;
}
/* ...but keep an arrow hidden when there's nothing more to scroll that way. */
.scroll-btn:disabled {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
}

.cover-card {
  flex: 0 0 auto;
  width: 200px;
  scroll-snap-align: start;
}

/* The image + hover overlay share this box, so the overlay always matches
   the cover's height whether it's square or a tall rectangle. */
.cover-card__media {
  position: relative;
  width: 200px;
  height: 200px;                /* default (square) — album covers */
  border-radius: 4px;
  overflow: hidden;
  background: #eee;
}
/* Books and movie posters are a standard portrait rectangle (2:3) */
.cover-card--poster .cover-card__media {
  height: 300px;
}

.cover-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;            /* crops nicely if a cover isn't exactly 2:3 */
  display: block;
}

.cover-card__caption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}
.cover-card__caption .title { font-weight: 600; }
.cover-card__caption .by { color: #777; }

/* The panel that appears when you hover over a cover */
.cover-card__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.82);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 1rem;
  text-align: center;
}

.cover-card:hover .cover-card__overlay,
.cover-card:focus-within .cover-card__overlay {
  opacity: 1;
}

.stars {
  font-size: 1.25rem;
  color: #ffd166;
}

.overlay-date {
  font-size: 0.8rem;
  color: #e6e6e6;
  letter-spacing: 0.02em;
}

.overlay-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* Each link is now a simple white logo icon */
.overlay-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;                  /* icons inherit this white colour */
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.overlay-links a:hover {
  opacity: 0.7;
  transform: scale(1.1);
}
.overlay-links svg {
  width: 26px;
  height: 26px;
  fill: currentColor;           /* = white */
  display: block;
}
/* The Wikipedia globe is drawn with lines, not a solid shape */
.overlay-links svg.icon--stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}


/* ============================================================================
   RESPONSIVE — SMALL SCREENS
   • The fixed sidebar becomes a normal full-width block so nothing overlaps.
   • On the LANDING PAGE the photos are hidden — mobile shows ONLY the sidebar
     (the colour still gently cross-fades on its own).
   • Content pages (Writing / Library) show the sidebar on top, content below.
============================================================================ */
@media (max-width: 800px) {
  :root { --sidebar-width: 100%; }

  .sidebar {
    position: relative;
    height: auto;
    min-height: 100vh;            /* sidebar fills the screen on the home page */
    width: 100%;
  }

  .content { margin-left: 0; }

  /* Landing-page photos are hidden on mobile — sidebar only. */
  .slideshow { display: none; }

  .sidebar__nav { align-items: center; }
}

/* --- Phones: shrink text + buttons so everything fits comfortably --- */
@media (max-width: 500px) {
  html, body { font-size: 15px; }

  .sidebar { padding: 1.75rem 1.5rem; }

  .sidebar__intro p { margin-bottom: 0.75rem; }

  .btn {
    width: 100%;
    max-width: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
  }

  .sidebar__nav { gap: 0.5rem; margin-top: 1.5rem; }

  /* Library covers scale down a touch on small phones */
  .cover-card { width: 150px; }
  .cover-card__media { width: 150px; height: 150px; }
  .cover-card--poster .cover-card__media { height: 225px; }
  .scroll-btn { top: 80px; }
}

/* --- When the sidebar runs out of room (screen too short OR too narrow, so
       the paragraph wraps taller), JavaScript adds the "is-cramped" class and
       this hides the long interests paragraph so the buttons stay in view. --- */
.sidebar.is-cramped .interests {
  display: none;
}
