/* ==========================================================================
   Tour Anywhere Ghost Theme
   Dark elegant theme with gold accents and serif typography.
   Brand tokens sourced from ios/TourAnywhere/Utilities/AppTheme.swift
   ========================================================================== */

/* ---------- Custom Properties (Brand Tokens) ---------- */
:root {
  --color-bg: #151A28;
  --color-surface: #1E2433;
  --color-gold: #C9A84C;
  --color-gold-dark: #AE8F38;
  --color-text: #F0EDE6;
  --color-text-secondary: #8A8578;
  --color-border: #2A3040;

  --font-serif: Georgia, "New York", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --max-width: 1200px;
  --content-width: 720px;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 64px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--color-gold-dark); }

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--color-gold);
  line-height: 1.3;
  font-weight: 700;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

/* ---------- Layout Utilities ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.content-column {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Layout helpers used by templates */
.hero-badges { display: flex; gap: 16px; flex-wrap: wrap; }
.text-center { text-align: center; }
.pt-60 { padding-top: 60px; }
.pb-40 { padding-bottom: 40px; }

.post-header-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.site-logo img { height: 32px; width: auto; }
.btn-nav { padding: 8px 20px; font-size: 0.85rem; }
.btn-mobile-cta { margin-top: 16px; text-align: center; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-height);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-logo {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-gold);
}
.site-logo:hover { color: var(--color-gold); }

.site-nav { display: flex; align-items: center; gap: 28px; }

.site-nav a {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
}
.site-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-gold);
  transition: width 0.2s ease;
}
.site-nav a:hover { color: var(--color-gold); }
.site-nav a:hover::after { width: 100%; }

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: all 0.2s ease;
}

/* Mobile nav overlay */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  background: var(--color-surface);
  z-index: 99;
  padding: 32px 24px;
  flex-direction: column;
  gap: 24px;
}
.mobile-nav.is-open { display: flex; }
.mobile-nav a {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.mobile-nav a:hover { color: var(--color-gold); }

@media (max-width: 767px) {
  .site-nav { display: none; }
  .nav-toggle { display: block; }
}

/* ---------- Hero Section ---------- */
.hero {
  padding: 80px 24px;
  text-align: center;
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 60px;
}

.hero-content {
  flex: 1;
  text-align: left;
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 16px;
}

.hero-tagline {
  font-size: 1.2rem;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero-screenshot {
  flex: 0 0 300px;
  display: flex;
  justify-content: center;
}

.hero-screenshot img {
  max-height: 560px;
  width: auto;
  border-radius: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.screenshot-placeholder {
  width: 270px;
  height: 540px;
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

@media (max-width: 767px) {
  .hero { padding: 48px 24px; }
  .hero-inner { flex-direction: column; gap: 40px; text-align: center; }
  .hero-content { text-align: center; }
  .hero-content h1 { font-size: 2.2rem; }
  .hero-screenshot { flex: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-gold);
  color: var(--color-bg);
}
.btn-primary:hover {
  background: var(--color-gold-dark);
  color: var(--color-bg);
}

.btn-secondary {
  background: transparent;
  color: var(--color-gold);
  border: 1.5px solid var(--color-gold);
}
.btn-secondary:hover {
  background: rgba(201, 168, 76, 0.1);
  color: var(--color-gold);
}

.app-store-badge img {
  height: 52px;
  width: auto;
}

/* ---------- Section Headings ---------- */
.section-heading {
  text-align: center;
  margin-bottom: 48px;
}
.section-heading h2 {
  margin-bottom: 12px;
}
.section-heading p {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
}

/* ---------- Post Card Grid ---------- */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  padding: 60px 0;
}

@media (min-width: 768px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); }
}

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.post-card:hover {
  border-color: var(--color-gold);
  transform: translateY(-2px);
}

.post-card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
}
.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-body {
  padding: 20px;
}

.post-card-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.post-card-tags a,
.post-card-tags span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-gold);
}

.post-card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--color-text);
  margin-bottom: 8px;
  line-height: 1.4;
}
.post-card:hover .post-card-title { color: var(--color-gold); }

.post-card-excerpt {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  display: flex;
  gap: 12px;
}

/* ---------- Single Post / Page ---------- */
.post-header {
  text-align: center;
  padding: 60px 24px 32px;
}
.post-header h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.post-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

.post-feature-image {
  max-width: 960px;
  margin: 0 auto 40px;
  padding: 0 24px;
}
.post-feature-image img {
  width: 100%;
  border-radius: var(--radius);
}

.post-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px 60px;
  font-size: 1.05rem;
}

.post-content p { margin-bottom: 1.5em; }
.post-content h2 { margin: 2em 0 0.75em; }
.post-content h3 { margin: 1.75em 0 0.5em; }

.post-content blockquote {
  border-left: 3px solid var(--color-gold);
  padding-left: 20px;
  margin: 1.5em 0;
  color: var(--color-text-secondary);
  font-style: italic;
}

.post-content pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.9rem;
}
.post-content code {
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.9em;
}
.post-content p code {
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: 4px;
}

.post-content ul, .post-content ol {
  margin: 1em 0;
  padding-left: 1.5em;
}
.post-content li { margin-bottom: 0.5em; }

.post-content a { text-decoration: underline; text-underline-offset: 3px; }

.post-content figure {
  margin: 2em 0;
}
.post-content figcaption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 8px;
}

/* Ghost-specific content cards */
.post-content .kg-image-card img,
.post-content .kg-gallery-image img {
  border-radius: var(--radius-sm);
}

.post-content .kg-width-wide {
  max-width: min(960px, calc(100vw - 48px));
  margin-left: auto;
  margin-right: auto;
}

.post-content .kg-width-full {
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
  width: 100vw;
}

.post-content .kg-bookmark-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.post-content .kg-bookmark-content {
  padding: 20px;
}
.post-content .kg-bookmark-title {
  color: var(--color-text);
  font-weight: 600;
}
.post-content .kg-bookmark-description {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* ---------- App CTA Banner ---------- */
.app-cta {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 60px 24px;
  text-align: center;
}
.app-cta h2 { margin-bottom: 12px; }
.app-cta p {
  color: var(--color-text-secondary);
  margin-bottom: 24px;
  font-size: 1.05rem;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 40px 0 60px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}
.pagination a {
  padding: 8px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.pagination a:hover {
  border-color: var(--color-gold);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 48px 24px;
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
}

.footer-brand {
  flex: 1;
}
.footer-brand .site-logo {
  margin-bottom: 12px;
  display: inline-block;
}
.footer-brand p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  max-width: 300px;
}

.footer-links {
  display: flex;
  gap: 48px;
}

.footer-column h4 {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}
.footer-column ul { list-style: none; }
.footer-column li { margin-bottom: 10px; }
.footer-column a {
  color: var(--color-text);
  font-size: 0.9rem;
}
.footer-column a:hover { color: var(--color-gold); }

.footer-bottom {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

@media (max-width: 767px) {
  .footer-inner { flex-direction: column; }
  .footer-links { flex-direction: column; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
}

/* ---------- Error Page ---------- */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 60px 24px;
}
.error-code {
  font-family: var(--font-serif);
  font-size: 6rem;
  font-weight: 700;
  color: var(--color-gold);
  line-height: 1;
  margin-bottom: 16px;
}
.error-page p {
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  font-size: 1.1rem;
}

/* ---------- Tag / Author Archive ---------- */
.archive-header {
  text-align: center;
  padding: 60px 24px 0;
}
.archive-header h1 {
  margin-bottom: 8px;
}
.archive-header p {
  color: var(--color-text-secondary);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- Ghost Members / Subscribe ---------- */
.gh-subscribe {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  max-width: var(--content-width);
  margin: 40px auto;
}
.gh-subscribe h3 { margin-bottom: 12px; }
.gh-subscribe p {
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

/* ---------- How It Works ---------- */
.how-it-works {
  padding: 80px 24px;
}

.steps-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.step-card {
  text-align: center;
  padding: 0 12px;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-gold);
  color: var(--color-bg);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.step-card h3 {
  color: var(--color-text);
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.step-card p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

@media (max-width: 767px) {
  .steps-grid { grid-template-columns: 1fr; gap: 48px; }
}

/* ---------- Features Grid ---------- */
.features-section {
  padding: 80px 24px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.features-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.feature-card {
  padding: 28px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
}
.feature-card:hover {
  border-color: var(--color-gold);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 {
  color: var(--color-text);
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (max-width: 1023px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .features-grid { grid-template-columns: 1fr; }
}

/* ---------- Screenshot Gallery ---------- */
.screenshot-gallery {
  padding: 80px 24px;
}

.gallery-grid {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 32px;
}

.gallery-item {
  text-align: center;
  flex: 0 0 240px;
}

.gallery-item:nth-child(2) {
  transform: translateY(-20px);
}

.gallery-item img,
.gallery-placeholder {
  width: 220px;
  height: 440px;
  border-radius: 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.gallery-placeholder {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.gallery-item img {
  object-fit: cover;
}

.gallery-caption {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

@media (max-width: 767px) {
  .gallery-grid {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }
  .gallery-item { flex: none; }
  .gallery-item:nth-child(2) { transform: none; }
}

/* ---------- Final CTA ---------- */
.final-cta {
  padding: 80px 24px;
  text-align: center;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.final-cta h2 {
  font-size: 2.2rem;
  margin-bottom: 16px;
}
.final-cta p {
  color: var(--color-text-secondary);
  font-size: 1.05rem;
  margin-bottom: 28px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.final-cta .app-store-badge {
  display: inline-block;
  margin-bottom: 16px;
}
.final-cta .cta-note {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

/* ---------- Blog Section on Homepage ---------- */
.home-blog-section {
  padding: 80px 24px 0;
}
