/* ---------------------------------------------------------------
   W6CMY — ham radio field log
   Fraunces (display) · IBM Plex Mono (utility) · IBM Plex Sans (body)
   Palette: logsheet / india ink / ionospheric blue / S-meter orange
--------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500&display=swap');

/* ---- Custom properties ---- */

:root {
  --paper:  #E9E5DA;
  --field:  #DDD8CB;   /* slightly darker for inset areas */
  --ink:    #1A1814;
  --muted:  #5E584E;
  --rule:   #BEB9AA;
  --blue:   #1B4F82;
  --orange: #B85C00;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --max-w: 68ch;
  --gap:   1.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:  #141210;
    --field:  #1D1B17;
    --ink:    #E5E0D4;
    --muted:  #8A8378;
    --rule:   #2E2B25;
    --blue:   #4E88D0;
    --orange: #D47030;
  }
}

/* ---- Reset ---- */

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

/* ---- Base ---- */

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  padding: 1.25rem 1rem;
}

a { color: var(--blue); }
a:visited { color: var(--blue); }

/* ---- Site header ---- */

.site-header {
  max-width: var(--max-w);
  margin: 0 auto 2.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.site-call {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration: none;
}

.site-call__de {
  color: var(--orange);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-right: 0.5em;
}

.site-nav {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--blue); }

/* ---- Main ---- */

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

/* ---- Site footer ---- */

.site-footer {
  max-width: var(--max-w);
  margin: 3rem auto 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  gap: 1.25rem;
}

.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--blue); }

/* ====================================================================
   LOG ENTRY — the signature element
   A bordered form card mimicking a paper radio log entry
==================================================================== */

.log-entry {
  border: 1px solid var(--rule);
  border-top: 3px solid var(--blue);
  margin-bottom: 1.75rem;
}

.log-entry__fields {
  display: grid;
  grid-template-columns: 13ch 14ch 1fr;
}

.log-entry__cell {
  padding: 0.6rem 0.85rem;
  border-right: 1px solid var(--rule);
}

.log-entry__cell:last-child { border-right: none; }

.log-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.57rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--blue);
  margin-bottom: 0.25rem;
}

.log-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  display: block;
}

.log-entry__summit-cell {
  border-right: none;
  padding-top: 0.5rem;
  padding-bottom: 0.65rem;
}

.log-entry__summit {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 1.95rem);
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
  font-optical-sizing: auto;
}

.log-entry__summit a {
  color: inherit;
  text-decoration: none;
}

.log-entry__summit a:hover { color: var(--blue); }

.log-entry__tags {
  border-top: 1px solid var(--rule);
  background: var(--field);
  padding: 0.4rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.log-tag {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  letter-spacing: 0.05em;
  color: var(--blue);
  text-decoration: none;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.log-tag:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--paper);
}

.log-tag--map {
  margin-left: auto;
  border-color: var(--blue);
  color: var(--blue);
}

/* Responsive: stack on narrow screens */
@media (max-width: 42em) {
  .log-entry__fields {
    grid-template-columns: 1fr 1fr;
  }
  .log-entry__summit-cell {
    grid-column: 1 / -1;
    border-right: none;
    border-top: 1px solid var(--rule);
  }
}

/* ====================================================================
   Post body
==================================================================== */

.post-body {
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.7;
}

.post-body > * + * { margin-top: 1em; }

.post-body h1, .post-body h2, .post-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin-top: 1.8em;
  margin-bottom: 0.35em;
  font-optical-sizing: auto;
}

.post-body h2 { font-size: 1.2rem; }
.post-body h3 { font-size: 1.05rem; }

.post-body a { color: var(--blue); }

.post-body ul, .post-body ol { padding-left: 1.4em; }
.post-body li + li { margin-top: 0.3em; }

.post-body blockquote {
  border-left: 2px solid var(--rule);
  padding: 0.25em 1em;
  color: var(--muted);
  font-style: italic;
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.875rem;
  font-family: var(--font-mono);
  overflow-x: auto;
  display: block;
}

.post-body th, .post-body td {
  border: 1px solid var(--rule);
  padding: 0.3em 0.6em;
  text-align: left;
}

.post-body th {
  background: var(--field);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--blue);
}

.post-body pre {
  background: var(--field);
  padding: 0.85em 1em;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  border-left: 2px solid var(--blue);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--field);
  padding: 0.1em 0.35em;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* ---- Post navigation ---- */

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.post-nav a {
  color: var(--muted);
  text-decoration: none;
  max-width: 44%;
}

.post-nav a:hover { color: var(--blue); }
.post-nav-next { text-align: right; }

/* ====================================================================
   Images & carousel
==================================================================== */

.single-image {
  margin-bottom: 1.75rem;
}

.single-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* No-JS: vertical stack */
.carousel figure {
  margin: 0 0 0.5rem;
}

.carousel figure img {
  width: 100%;
  height: auto;
  display: block;
}

/* JS-enhanced carousel */
.js-carousel { margin-bottom: 1.25rem; }

.carousel-main {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #000;
  position: relative;
}

.js-carousel figure {
  display: flex;
  margin: 0;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.js-carousel figure.active {
  opacity: 1;
  pointer-events: auto;
}

.js-carousel figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.carousel-controls {
  display: flex;
  gap: 1px;
  margin-top: 1px;
  background: var(--rule);
}

.carousel-btn {
  background: var(--field);
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
}

.carousel-btn:hover { background: var(--blue); color: var(--paper); }

/* Film strip thumbnails */
.carousel-thumbs {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.carousel-thumb {
  border: 2px solid transparent;
  padding: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
  flex-shrink: 0;
}

.carousel-thumb.active { border-color: var(--orange); }

.carousel-thumb img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  display: block;
  filter: saturate(0.85);
}

.carousel-thumb:hover img,
.carousel-thumb.active img { filter: saturate(1); }

/* ====================================================================
   Archive, tags, post lists
==================================================================== */

.page-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 1.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.post-list { list-style: none; }

.post-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-list li:last-child { border-bottom: none; }

.post-list a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.post-list a:hover { color: var(--blue); }

.post-date {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  display: block;
  margin-top: 0.1rem;
}

@media (min-width: 40em) {
  .post-date { display: inline; margin-top: 0; margin-left: 0.75em; }
}

/* Archive */
.archive-year { margin-bottom: 2rem; }

.archive-year > h2 {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--blue);
  margin-bottom: 0.6rem;
}

.archive-month { margin: 0 0 1rem 0; }

.archive-month > h3 {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

/* Tags */
.tag-cloud {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  background: var(--field);
  border: 1px solid var(--rule);
  padding: 0.25rem 0.6rem;
  text-decoration: none;
  color: var(--ink);
}

.tag-pill:visited { color: var(--ink); }
.tag-pill:hover { border-color: var(--blue); color: var(--blue); }

.tag-count {
  color: var(--muted);
  font-size: 0.85em;
}

.back-link {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.back-link a { color: var(--muted); }
.back-link a:hover { color: var(--blue); }

/* Recent posts on index */
.recent-section {
  margin-top: 2.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.recent-section__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

/* ---- Focus / accessibility ---- */

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- Wider screens ---- */

@media (min-width: 56em) {
  body { padding: 2rem 1.5rem; }
  .carousel-thumb img { width: 60px; height: 60px; }
}
