/* Løffeblogg - Warm Travel Blog Design */

/* ===== CSS Variables ===== */
:root {
  /* Warm color palette inspired by Southeast Asian sunsets */
  --color-primary: #d35400;
  --color-primary-dark: #a04000;
  --color-primary-light: #e67e22;
  --color-accent: #f39c12;
  --color-warm-bg: #fef9f3;
  --color-warm-cream: #fff8f0;
  --color-text: #2d2a26;
  --color-text-muted: #6b6560;
  --color-text-light: #8a8580;
  --color-border: #e8e0d8;
  --color-card-bg: #ffffff;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --content-width: 720px;
  --content-width-wide: 900px;
  --sidebar-width: 150px;
  --indicator-height: 44px;
  --header-height: 52px;
}

/* ===== Font Loading ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Source+Sans+3:wght@300;400;500;600&display=swap');

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-warm-bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--color-text);
}

h1 { font-size: 2.4rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }

p {
  margin: 0 0 1.2em;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* ===== Site Header ===== */
.site-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  padding: 0.8rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.site-header.hidden {
  transform: translateY(-100%);
}

.site-header nav {
  max-width: calc(var(--sidebar-width) + 2rem + var(--content-width));
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.site-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.site-title:hover {
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
}

.site-tagline {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  margin-left: auto;
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
  color: #fff;
  padding: 3rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.4;
}

.hero-content {
  position: relative;
  max-width: var(--content-width);
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.02em;
}

.hero .tagline {
  font-size: 1.15rem;
  font-weight: 300;
  opacity: 0.95;
  margin: 0;
  line-height: 1.6;
}

/* ===== Main Content ===== */
main {
  max-width: calc(var(--sidebar-width) + 2rem + var(--content-width));
  margin: 0 auto;
  padding: 1.5rem 0;
}

/* Fallback padding when no sidebar */
main:not(:has(.post-layout)) {
  max-width: var(--content-width);
  padding: 2.5rem 1rem;
}

/* ===== Intro Section ===== */
.intro {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--color-border);
}

.intro h1 {
  margin-top: 0;
  font-size: 2.2rem;
  color: var(--color-primary-dark);
}

.lead {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ===== Posts List (Homepage) ===== */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

a.post-card {
  background: var(--color-card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  text-decoration: none;
  color: inherit;
}

a.post-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.08);
  text-decoration: none;
}

.post-card-thumbnail {
  width: 200px;
  min-height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  position: relative;
}

.post-card-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card:hover .post-card-thumbnail img {
  transform: scale(1.05);
}

.post-card-thumbnail .no-image {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.6);
}

.post-card-content {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.post-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-text);
}

a.post-card:hover h2 {
  color: var(--color-primary);
}

.post-dates {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.3rem;
  font-weight: 500;
}

.post-summary {
  color: var(--color-text-light);
  font-size: 0.85rem;
  margin: 0 0 0.8rem;
}

.read-more {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.read-more:hover {
  text-decoration: none;
  gap: 0.5rem;
}

.no-posts {
  color: var(--color-text-muted);
  font-style: italic;
  padding: 2rem;
  background: var(--color-card-bg);
  border-radius: 12px;
  text-align: center;
}

.no-posts code {
  background: var(--color-warm-cream);
  padding: 0.2em 0.5em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ===== Individual Post ===== */
.post-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--color-border);
}

.post-header h1 {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 2.5rem;
  color: var(--color-primary-dark);
}

/* ===== Post Layout - Sidebar + Content ===== */
.post-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.post-main {
  flex: 1;
  min-width: 0;
}

/* ===== Day Sidebar ===== */
.day-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  width: var(--sidebar-width);
  flex-shrink: 0;
  z-index: 50;
}

/* Stack date and location vertically in sidebar */
.day-sidebar .day-nav li a {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.day-sidebar .day-nav .location {
  font-size: 0.75rem;
  line-height: 1.3;
  opacity: 0.7;
}

/* Mobile indicator - hidden on larger screens */
.day-indicator {
  display: none;
}

/* ===== Day Navigation - Vertical Timeline ===== */
.day-nav {
  padding: 0;
  margin: 0;
}

.day-nav p {
  display: none;
}

.day-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  padding-left: 1rem;
}

/* Vertical timeline line */
.day-nav ul::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 3px;
  width: 1px;
  background: var(--color-border);
}

.day-nav li {
  position: relative;
}

.day-nav li a {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.25rem 0;
  text-decoration: none;
  transition: all 0.15s ease;
  font-size: 0.85rem;
}

/* Timeline dot */
.day-nav li a::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  background: var(--color-warm-bg);
  border: 1.5px solid var(--color-text-light);
  border-radius: 50%;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.day-nav li a:hover::before {
  border-color: var(--color-primary);
}

.day-nav li a .date {
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.day-nav li a:hover .date {
  color: var(--color-primary);
}

.day-nav .location {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

.day-nav li a:hover .location {
  color: var(--color-text-muted);
}

/* Active state for current day */
.day-nav li.active a::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.day-nav li.active a .date {
  color: var(--color-primary);
  font-weight: 600;
}

.day-nav li.active a .location {
  color: var(--color-text-muted);
}

/* ===== Day Sections ===== */
.day-section {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--color-border);
}

.day-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.day-heading {
  font-family: var(--font-display);
  color: var(--color-primary);
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 0;
  padding-top: 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.day-heading .location-name {
  color: var(--color-text);
}

.day-heading .date-text {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

.day-heading .dot {
  color: var(--color-primary);
  margin-right: 0.3rem;
}

/* ===== Day Content ===== */
.day-content {
  font-size: 1.05rem;
}

.day-content p {
  margin-bottom: 1.2em;
}

/* Clean up Google Docs HTML */
.day-content span {
  font-family: inherit !important;
  font-size: inherit !important;
}

.day-content [style*="font-family"] {
  font-family: inherit !important;
}

.day-content [style*="font-size"] {
  font-size: inherit !important;
}

/* Remove empty paragraphs */
.day-content p:empty,
.day-content p span:empty {
  display: none;
}

/* ===== Images ===== */
.day-content img {
  display: block;
  max-width: 100%;
  max-height: var(--content-width);
  height: auto;
  margin: 1.5rem auto 0.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Image captions */
.image-caption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0 0 1.5rem;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-light);
  font-size: 0.9rem;
  background: linear-gradient(to bottom, var(--color-warm-cream), var(--color-warm-bg));
  border-top: 1px solid var(--color-border);
}

.footer-content {
  max-width: var(--content-width);
  margin: 0 auto;
}

.footer-route {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
}

.route-stop {
  color: var(--color-text-muted);
}

a.route-stop {
  color: var(--color-primary);
  text-decoration: none;
}

a.route-stop:hover {
  text-decoration: underline;
}

.route-arrow {
  color: var(--color-text-light);
}

.footer-links {
  margin: 0;
  color: var(--color-text-light);
}

.footer-links a {
  color: var(--color-text-muted);
}

.footer-links a:hover {
  color: var(--color-primary);
}

/* ===== Responsive Design ===== */

/* Sidebar layout breakpoint (≥900px: sidebar visible, <900px: mobile indicator) */
@media (max-width: 899px) {
  main {
    padding: 1.5rem 1rem;
  }

  .post-layout {
    flex-direction: column;
    gap: 0;
  }

  .day-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--color-card-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 90;
  }

  /* Mobile indicator button */
  .day-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: var(--indicator-height);
    padding: 0 1rem;
    background: var(--color-card-bg);
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text);
  }

  .day-indicator .indicator-text {
    font-weight: 600;
    color: var(--color-primary);
  }

  .day-indicator .indicator-chevron {
    transition: transform 0.2s ease;
  }

  .day-indicator[aria-expanded="true"] .indicator-chevron {
    transform: rotate(180deg);
  }

  /* Day nav dropdown (hidden by default) */
  .day-nav {
    display: none;
    position: absolute;
    top: var(--indicator-height);
    left: 0;
    right: 0;
    background: var(--color-card-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - var(--indicator-height) - var(--header-height));
    overflow-y: auto;
    padding: 0.5rem 1rem 1rem;
    margin: 0;
  }

  .day-nav.open {
    display: block;
  }

  .day-nav ul {
    padding-left: 1.5rem;
  }

  /* Mobile dropdown: inline layout */
  .day-sidebar .day-nav li a {
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.95rem;
  }

  .day-sidebar .day-nav .location {
    font-size: 0.85rem;
    opacity: 1;
  }

  /* Space for fixed indicator */
  .post-main {
    padding-top: var(--indicator-height);
  }

  /* Adjust scroll offset for sections */
  .day-section[id] {
    scroll-margin-top: calc(var(--indicator-height) + 1rem);
  }
}

@media (max-width: 700px) {
  html {
    font-size: 16px;
  }

  .hero {
    padding: 2rem 1rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  main {
    padding: 1.5rem 1rem;
  }

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

  .post-card-thumbnail {
    width: 100%;
    height: 200px;
    min-height: 200px;
  }

  .post-header h1 {
    font-size: 2rem;
  }

  .day-heading {
    flex-direction: column;
    gap: 0.2rem;
  }

}

/* Larger screens: ensure sidebar scroll offset */
@media (min-width: 900px) {
  .day-section[id] {
    scroll-margin-top: calc(var(--header-height) + 1rem);
  }
}

/* ===== Print Styles ===== */
@media print {
  .site-header,
  .site-footer,
  .day-nav {
    display: none;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .day-section {
    break-inside: avoid;
  }

  .day-content img {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
