/* ============================================================
   HIKING JOURNAL — style.css
   Global styles for all pages
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --black:       #0a0a0a;
  --off-black:   #111111;
  --surface:     #181818;
  --border:      #2a2a2a;
  --text:        #e8e0d4;
  --text-muted:  #7a7268;
  --text-dim:    #4a4540;
  --accent:      #c8b98a;
  --accent-dim:  #5c5240;
  --white:       #f5f0e8;

  --font:        'EB Garamond', Georgia, 'Times New Roman', serif;
  --max-width:   1040px;
  --nav-height:  56px;
}

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--black);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  min-height: 100vh;
}

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

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

/* --- Navigation ------------------------------------------- */
nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: var(--black);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.nav-logo:hover {
  color: var(--white);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

/* --- Page Shell ------------------------------------------- */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* --- Homepage Hero ---------------------------------------- */
.home-hero {
  padding: 3rem 0 2rem;
  margin-bottom: 2.5rem;
}

.home-hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 400;
  font-style: italic;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 1rem;
}

.home-hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* --- Trip Grid -------------------------------------------- */
.trips-section h2 {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
}

.trip-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

/* --- Trip Card -------------------------------------------- */
.trip-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
}

.trip-card:first-child {
  border-top: 1px solid var(--border);
}

.trip-card:hover .trip-card-title {
  color: var(--accent);
}

.trip-card-title {
  font-size: 1.45rem;
  font-weight: 500;
  color: var(--white);
  margin-bottom: 0.35rem;
  transition: color 0.2s;
}

.trip-card-dates {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

.trip-card-stats {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
}

.trip-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.trip-stat-value {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
}

.trip-stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.trip-card-arrow {
  font-size: 1.2rem;
  color: var(--text-dim);
  padding-top: 0.5rem;
  transition: color 0.2s, transform 0.2s;
}

.trip-card:hover .trip-card-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* --- Trip tags -------------------------------------------- */
.trip-tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.trip-tag {
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
}

/* --- Loading / Error States ------------------------------- */
.loading-state,
.error-state {
  padding: 3rem 0;
  color: var(--text-muted);
  font-style: italic;
  font-size: 1rem;
}

.error-state {
  color: #a05050;
}

/* --- Trip Page Header ------------------------------------- */
.trip-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
}

.trip-header-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.trip-header-back:hover {
  color: var(--accent);
}

.trip-header h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 400;
  font-style: italic;
  color: var(--white);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.trip-header-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 2rem;
}

/* --- Trip Overview Stats ---------------------------------- */
.trip-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0;
  border: 1px solid var(--border);
}

.trip-stat-block {
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--border);
}

.trip-stat-block:last-child {
  border-right: none;
}

.trip-stat-block .label {
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.trip-stat-block .value {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--white);
  line-height: 1.2;
  white-space: nowrap;
}

.trip-stat-block .unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* --- Map Section ------------------------------------------ */
.map-section {
  margin-bottom: 2.5rem;
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

#trip-map {
  width: 100%;
  height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.map-error {
  width: 100%;
  height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-style: italic;
}

/* --- Day Legend ------------------------------------------- */
.day-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.legend-swatch {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* --- Days Table ------------------------------------------- */
.days-section {
  margin-bottom: 3rem;
}

.days-section h2 {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.days-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.days-table thead tr {
  border-bottom: 1px solid var(--border);
}

.days-table th {
  text-align: left;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 0 0.75rem 0;
  font-weight: 400;
}

.days-table th:not(:first-child) {
  text-align: right;
}

.days-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.days-table tbody tr:hover {
  background: var(--surface);
}

.days-table td {
  padding: 0.9rem 0;
  color: var(--text);
}

.days-table td:not(:first-child) {
  text-align: right;
  color: var(--text-muted);
}

.day-color-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.6rem;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* --- Footer ----------------------------------------------- */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

/* --- Leaflet Overrides ------------------------------------ */
.leaflet-container {
  background: #1a1a1a !important;
  font-family: var(--font) !important;
}

.leaflet-tooltip {
  background: var(--off-black) !important;
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
  color: var(--text) !important;
  font-family: var(--font) !important;
  font-size: 0.85rem !important;
  padding: 0.5rem 0.75rem !important;
  box-shadow: none !important;
}

.leaflet-tooltip::before {
  display: none !important;
}

.tooltip-day {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.tooltip-stats {
  display: flex;
  gap: 1rem;
}

.tooltip-stat {
  display: flex;
  flex-direction: column;
}

.tooltip-stat-val {
  font-weight: 500;
  color: var(--white);
}

.tooltip-stat-lbl {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
}

.leaflet-control-zoom a {
  background: var(--off-black) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  font-family: var(--font) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface) !important;
  color: var(--text) !important;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 680px) {
  .page-wrapper {
    padding: 2.5rem 1.25rem;
  }

  nav .nav-inner {
    padding: 0 1.25rem;
  }

  .trip-stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .trip-stat-block {
    border-bottom: 1px solid var(--border);
  }

  .trip-stat-block:nth-child(even) {
    border-right: none;
  }

  .trip-stat-block:last-child,
  .trip-stat-block:nth-last-child(2):nth-child(odd) {
    border-bottom: none;
  }

  #trip-map {
    height: 340px;
  }

  .trip-card {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .trip-card-arrow {
    display: none;
  }

  .days-table {
    font-size: 0.85rem;
  }
}

/* --- Skeleton loading cards ------------------------------- */
.trip-skeleton {
  display: block;
  background: var(--surface);
  border-radius: 2px;
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

.trip-card--loading {
  pointer-events: none;
  cursor: default;
}

/* ============================================================
   JOURNAL SECTION
   Appears below the Day-by-Day table on each trip page.
   ============================================================ */

.journal-section {
  margin-bottom: 3.5rem;
}

.journal-section h2 {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2rem;
  padding-top: 0.5rem;
}

/* --- Prose blocks ----------------------------------------- */
.journal-entry {
  max-width: 100%;
}

.journal-entry p {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text);
  margin-bottom: 1.6rem;
}

.journal-entry p:last-child {
  margin-bottom: 0;
}

/* --- Full-width photo ------------------------------------- */
.journal-photo {
  margin: 3rem 0;
  display: block;
}

.journal-photo img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  /* Optional: constrain very tall portrait shots */
  max-height: 75vh;
  object-fit: cover;
  object-position: center;
}

.journal-photo figcaption {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-dim);
  line-height: 1.5;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 680px) {
  .journal-photo {
    margin: 2rem 0;
  }

  .journal-entry p {
    font-size: 1rem;
  }
}

/* ============================================================
   GEAR LIST SECTION
   ============================================================ */

#gear-section {
  display: none;
  margin-bottom: 3.5rem;
}

#gear-section h2 {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

/* Small muted subtitle above the summary table */
.gear-sheet-title {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 1rem;
  font-style: normal;
}

/* --- Summary table ----------------------------------------
   Width is auto so it only takes as much space as it needs.
   Both columns left-aligned.
   Total rows are bold + white with a top border separator.
   ---------------------------------------------------------- */
.gear-summary-table {
  width: auto;
  min-width: 300px;
  border-collapse: collapse;
  margin-bottom: 3rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.gear-summary-table th,
.gear-summary-table td {
  padding: 0.55rem 2rem 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.gear-summary-table th:last-child,
.gear-summary-table td:last-child {
  padding-right: 0.75rem;
  min-width: 100px;
}

/* Header row */
.gear-summary-header th {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 400;
  background: var(--surface);
}

/* Total rows — bold, bright, separated */
.gear-summary-total td {
  font-weight: 600;
  color: var(--white);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.gear-summary-total:last-child td {
  border-bottom: none;
}

/* --- Category sections ------------------------------------ */
.gear-category {
  margin-bottom: 2.75rem;
}

.gear-category-name {
  font-size: 1rem;
  font-weight: 500;
  font-style: italic;
  color: var(--white);
  margin-bottom: 0.75rem;
}

/* Fixed layout ensures identical column widths across all sections */
.gear-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

.gear-items-table thead tr {
  border-bottom: 1px solid var(--border);
}

.gear-items-table th {
  text-align: left;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 400;
  padding: 0 1.5rem 0.6rem 0;
}

.gear-items-table tbody tr {
  border-bottom: 1px solid var(--border);
}

.gear-items-table td {
  padding: 0.65rem 1.5rem 0.65rem 0;
  color: var(--text);
  vertical-align: top;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Weight column — muted, no ellipsis needed */
.gear-items-table td:last-child,
.gear-items-table th:last-child {
  padding-right: 0;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
}

.gear-subtotal td {
  font-weight: 500;
  color: var(--accent);
  border-bottom: none;
  padding-top: 0.75rem;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 680px) {
  .gear-items-table {
    font-size: 0.82rem;
    table-layout: auto; /* Override fixed layout so remaining columns fill width naturally */
  }

  /* Hide "Item Type" and "Qty" columns on small screens */
  .gear-items-table th:nth-child(2),
  .gear-items-table td:nth-child(2),
  .gear-items-table th:nth-child(3),
  .gear-items-table td:nth-child(3) {
    display: none;
  }
}

/* ============================================================
   MAP — PULSE MARKERS
   ============================================================ */

.pulse-marker {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pulse-marker--start { background: #5cba5c; }
.pulse-marker--end   { background: #d45c5c; }

.pulse-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulse-expand 2s ease-out infinite;
}

.pulse-marker--start .pulse-ring { border: 2px solid #5cba5c; }
.pulse-marker--end   .pulse-ring { border: 2px solid #d45c5c; }

@keyframes pulse-expand {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0;   }
}
