/* ==========================================================================
   B. Gaston Photography — design system
   Palette: warm off-white surface, near-black text, muted amber accent.
   Display face (header + page headings): Bitter (bold slab serif).
   Body face (everything else): Courier Prime.
   ========================================================================== */

:root {
  --color-bg: #f7f5f1;
  --color-text: #141414;
  --color-accent: #c08552;

  --font-display: "Bitter", Georgia, "Times New Roman", serif;
  --font-body: "Courier Prime", "Courier New", monospace;

  --sidebar-width: 260px;
  --header-height: 110px;
  --gap: 1.5rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
input,
textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
}

/* -------------------------------------------------------------------------
   Layout: full-width top header + fixed left sidebar + main content area
   ------------------------------------------------------------------------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Center the title over the content column (to the right of the
     sidebar), not the full page — lines up with the diptych seam on the
     homepage. The header itself still spans edge-to-edge so the background
     fill and bottom border stay unbroken behind the sidebar. */
  padding-left: var(--sidebar-width);
  background: var(--color-bg);
  border-bottom: 1px solid rgba(20, 20, 20, 0.08);
  z-index: 20;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
}

.layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-height);
}

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  border-right: 1px solid rgba(20, 20, 20, 0.08);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.nav a,
.nav button.nav-link {
  font-family: var(--font-body);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--color-text);
  transition: color 0.15s ease;
}

.nav a:hover,
.nav button.nav-link:hover {
  color: var(--color-accent);
}

.nav .nav-recent {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-left: 0.1rem;
}

.nav .nav-recent a {
  font-size: 0.85rem;
  opacity: 0.85;
}

.nav-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.5;
  margin-bottom: 0.3rem;
}

.nav-archive-toggle {
  color: var(--color-accent);
}

.nav-archive-list {
  display: none;
  flex-direction: column;
  gap: 0.6rem;
  padding-left: 0.1rem;
  margin-top: 0.6rem;
}

.nav-archive-list.open {
  display: flex;
}

.nav-archive-list a {
  font-size: 0.85rem;
  opacity: 0.85;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.8rem;
  opacity: 0.6;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-footer button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  text-align: left;
}

.sidebar-footer button:hover {
  color: var(--color-accent);
}

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

/* -------------------------------------------------------------------------
   Homepage hero
   ------------------------------------------------------------------------- */

.hero {
  height: calc(100vh - var(--header-height));
  display: flex;
}

.hero.single {
  position: relative;
}

.hero.single img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero.diptych {
  display: flex;
  gap: 6px;
  background: var(--color-bg);
}

.hero.diptych .hero-half {
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.hero.diptych img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-empty {
  height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  opacity: 0.55;
  font-size: 0.95rem;
}

/* -------------------------------------------------------------------------
   About / generic content pages
   ------------------------------------------------------------------------- */

.page {
  max-width: 640px;
  padding: 4rem 3rem;
}

.page h1 {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}

.page p {
  margin-bottom: 1rem;
}

.about-editor {
  margin-top: 1.25rem;
}

.about-editor textarea {
  width: 100%;
  min-height: 140px;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(20, 20, 20, 0.25);
  background: #fff;
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 1rem;
  resize: vertical;
  margin-bottom: 0.75rem;
}

/* -------------------------------------------------------------------------
   Album pages
   ------------------------------------------------------------------------- */

.album-header {
  padding: 3rem 3rem 1rem;
}

.album-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
}

.album-writeup {
  max-width: 640px;
  margin-bottom: 1rem;
}

.album-writeup:empty {
  display: none;
  margin: 0;
}

.album-meta {
  font-size: 0.8rem;
  opacity: 0.55;
  margin-bottom: 1.5rem;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  padding: 0 3rem 4rem;
}

.thumb {
  position: relative;
  cursor: pointer;
}

.thumb-image-wrap {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: rgba(20, 20, 20, 0.04);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.4s ease, transform 0.4s ease;
}

.thumb:hover img {
  filter: grayscale(0%);
  transform: scale(1.02);
}

.thumb-caption {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.thumb:hover .thumb-caption {
  opacity: 0.85;
  transform: translateY(0);
}

.thumb-caption:empty {
  display: none;
}

.thumb-star {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(247, 245, 241, 0.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.thumb:hover .thumb-star,
.thumb-star.active {
  opacity: 1;
}

.thumb-star.active {
  color: var(--color-accent);
}

/* -------------------------------------------------------------------------
   Lightbox: enlarged single-photo view (public visitors only) with
   prev/next paging. Replaces the album-grid in place — sidebar and header
   stay exactly where they are.
   ------------------------------------------------------------------------- */

.lightbox {
  padding: 1rem 3rem 3rem;
}

.lightbox-close {
  display: block;
  margin: 0 0 1rem auto;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--color-text);
  padding: 0.3rem 0;
  transition: color 0.15s ease;
}

.lightbox-close:hover {
  color: var(--color-accent);
}

.lightbox-stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-image-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image-wrap img {
  max-width: 100%;
  max-height: calc(100vh - var(--header-height) - 9rem);
  object-fit: contain;
}

.lightbox-nav {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 2.25rem;
  line-height: 1;
  padding: 0.5rem 0.75rem;
  color: var(--color-text);
  transition: color 0.15s ease;
}

.lightbox-nav:hover {
  color: var(--color-accent);
}

.lightbox-nav:disabled {
  opacity: 0.2;
  cursor: default;
}

.lightbox-nav:disabled:hover {
  color: var(--color-text);
}

.lightbox-caption {
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 1rem;
}

.lightbox-caption:empty {
  display: none;
}

/* -------------------------------------------------------------------------
   Forms: login, album creation, caption editing, upload
   ------------------------------------------------------------------------- */

.form-page {
  max-width: 420px;
  padding: 4rem 3rem;
}

.form-page h1 {
  font-family: var(--font-display);
  font-weight: normal;
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.field {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.8rem;
  opacity: 0.65;
}

.field input,
.field textarea {
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(20, 20, 20, 0.25);
  background: #fff;
  border-radius: 2px;
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  font-family: var(--font-body);
  background: var(--color-text);
  color: var(--color-bg);
  border: none;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  border-radius: 2px;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--color-accent);
}

.btn.secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid rgba(20, 20, 20, 0.3);
}

.btn.secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: transparent;
}

.form-error {
  color: #a33;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.form-error:empty {
  display: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 3rem 0;
  flex-wrap: wrap;
}

.toolbar .btn {
  white-space: nowrap;
}

.upload-dropzone {
  margin: 1rem 3rem;
  border: 1px dashed rgba(20, 20, 20, 0.3);
  padding: 2rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.75;
}

.upload-dropzone.dragover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  opacity: 1;
}

/* -------------------------------------------------------------------------
   Photo detail / caption editing overlay (for logged-in users)
   ------------------------------------------------------------------------- */

.photo-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.4rem;
}

.photo-controls input {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(20, 20, 20, 0.2);
  background: #fff;
}

/* -------------------------------------------------------------------------
   Small helpers
   ------------------------------------------------------------------------- */

.empty-state {
  padding: 2rem 3rem;
  opacity: 0.55;
  font-size: 0.9rem;
}

.badge-accent {
  color: var(--color-accent);
}

.menu-toggle {
  display: none;
}

@media (max-width: 720px) {
  :root {
    --header-height: 84px;
  }
  .site-header {
    padding-left: 0;
  }
  .site-title {
    font-size: 1.5rem;
  }
  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 20px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 25;
  }
  .menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: auto;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid rgba(20, 20, 20, 0.08);
    background: var(--color-bg);
    z-index: 15;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }
  .sidebar.nav-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
  .main {
    margin-left: 0;
  }
  .hero,
  .hero-empty {
    height: 70vh;
  }
  .hero.diptych .hero-half {
    height: 70vh;
  }
  .page,
  .album-header,
  .album-grid,
  .toolbar,
  .form-page,
  .lightbox {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .lightbox-nav {
    font-size: 1.75rem;
    padding: 0.5rem 0.35rem;
  }
}
