/* ── Reset & custom properties ───────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --color-text: #839496;    /* base0  */
  --color-muted: #586e75;   /* base01 */
  --color-bg: #002b36;      /* base03 */
  --color-surface: #073642; /* base02 */
  --color-border: #073642;  /* base02 */
  --color-draft: #cb4b16;   /* orange */
  --color-draft-bg: #1a0e00;
  --radius: 8px;
  --gap: 1.5rem;
  --max-width: 1200px;
}


/* ── Base ─────────────────────────────────────────────────────────────────── */

body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100svh;
}

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

a {
  color: inherit;
}

/* ── Site header ──────────────────────────────────────────────────────────── */

.site-header {
  padding: 1rem var(--gap);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--color-muted);
}

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

.nav-link--button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

/* ── Main content area ────────────────────────────────────────────────────── */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--gap);
}

/* ── Post grid (index) ────────────────────────────────────────────────────── */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
}

.post-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--color-bg);
  transition: box-shadow 0.15s ease;
}

.post-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.post-card--draft {
  border-color: var(--color-draft);
}

.post-card-cover {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-surface);
  position: relative;
}

.post-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.post-card:hover .post-card-cover img {
  transform: scale(1.02);
}

.post-card-cover--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.post-card-collage {
  display: grid;
  position: absolute;
  inset: 0;
  gap: 2px;
}

.post-card-collage--1 {
  grid-template-columns: 1fr;
}

.post-card-collage--2 {
  grid-template-columns: 1fr 1fr;
}

.post-card-collage--3 {
  grid-template-columns: 3fr 2fr;
  grid-template-rows: 1fr 1fr;
}

.post-card-collage--3 .collage-img:first-child {
  grid-row: 1 / 3;
}

.collage-img {
  overflow: hidden;
}

.collage-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.post-card:hover .collage-img img {
  transform: scale(1.02);
}

.photo-count {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.post-card-body {
  padding: 0.875rem 1rem;
}

.post-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

.post-card-title a {
  text-decoration: none;
}

.post-card-title a:hover {
  text-decoration: underline;
}

.post-card-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-card-date {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.post-card-access {
  font-size: 0.75rem;
  color: var(--color-muted);
  opacity: 0.7;
}

/* ── Draft indicators ─────────────────────────────────────────────────────── */

.badge-draft {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  background: var(--color-draft);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2em 0.55em;
  border-radius: 3px;
  text-transform: uppercase;
}

.banner-draft {
  background: var(--color-draft-bg);
  color: var(--color-draft);
  border: 1px solid var(--color-draft);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--gap);
}

/* ── Post page ────────────────────────────────────────────────────────────── */

.post-header {
  margin-bottom: var(--gap);
}

.post-header h1 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.375rem;
}

.post-meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.post-date {
  font-size: inherit;
  color: inherit;
}

.post-access {
  font-size: inherit;
  color: inherit;
}

.post-body {
  max-width: 65ch;
  margin-bottom: calc(var(--gap) * 2);
}

.post-body h1,
.post-body h2,
.post-body h3 {
  margin-top: 1.75em;
  margin-bottom: 0.5em;
  line-height: 1.3;
}

.post-body p {
  margin-bottom: 1em;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1em 1.5em;
}

.post-body li {
  margin-bottom: 0.25em;
}

/* ── Gallery ──────────────────────────────────────────────────────────────── */

.gallery-section {
  margin-bottom: calc(var(--gap) * 2);
}

.gallery-heading {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gallery-row {
  display: flex;
  gap: 0.375rem;
  height: clamp(220px, 28vw, 380px);
}

.gallery-row--video {
  height: auto;
}

.gallery-row-spacer {
  flex: 999 0 0;
}

.gallery-row--last .gallery-item {
  flex-grow: 0;
  flex-basis: auto;
}

.gallery-item {
  display: block;
  flex-basis: 0;
  min-width: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--color-surface);
  position: relative;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

@media (max-width: 640px) {
  .gallery-row {
    flex-direction: column;
    height: auto;
  }

  .gallery-item {
    flex-basis: auto;
  }

  .gallery-row-spacer {
    display: none;
  }
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-exif {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 0.6rem 0.45rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.gallery-item:hover .gallery-exif {
  opacity: 1;
}

.gallery-exif-time {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.gallery-exif-camera {
  color: rgba(255, 255, 255, 0.75);
}

.gallery-exif-tech {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.64rem;
}

.gallery-item--video {
  flex: 1;
  height: auto;
  overflow: visible;
  background: none;
}

.gallery-item--video video {
  width: 100%;
  display: block;
  border-radius: 4px;
}

/* ── Login page ───────────────────────────────────────────────────────────── */

.login-form {
  max-width: 360px;
  margin: clamp(2rem, 8vh, 5rem) auto 0;
}

.login-form h1 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.15s;
}

.form-group input:focus {
  outline: none;
  border-color: #268bd2;
  box-shadow: 0 0 0 3px rgba(38, 139, 210, 0.2);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 3.5rem;
}

.btn-show-password {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.2rem 0.3rem;
  border: none;
  background: none;
  color: var(--color-muted);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
}

.btn-show-password:hover {
  color: var(--color-text);
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 0.625rem 1rem;
  margin-top: 1.25rem;
  background: var(--color-text);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.85;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.empty-state {
  color: var(--color-muted);
  grid-column: 1 / -1;
  padding: 2rem 0;
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 100;
  cursor: pointer;
}

.lightbox.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  cursor: default;
  border-radius: 2px;
}

.lightbox-exif {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  pointer-events: none;
  min-height: 2.4em;
}

.lightbox-exif-time {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
}

.lightbox-exif-meta {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.lightbox-toolbar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.lightbox-original,
.lightbox-close {
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  opacity: 0.75;
  transition: opacity 0.15s;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
  padding: 1rem 1.25rem;
  opacity: 0.6;
  transition: opacity 0.15s;
  user-select: none;
}

.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

/* 404 */
.not-found {
  text-align: center;
  padding: 6rem 1rem;
}

.not-found h1 {
  font-size: 6rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #ccc;
}

.not-found p {
  color: #666;
  margin: 0 0 2rem;
}

.not-found-home {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: 1px solid currentColor;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
}
