/*
Theme Name: Travelers of Madagascar
Theme URI: https://travelersofmadagascar.com/
Author: Travelers of Madagascar
Author URI: https://travelersofmadagascar.com/
Description: A fully editable WordPress theme for Travelers of Madagascar — Gutenberg-friendly with masonry tours, blog, structured content templates (Beaches, National Parks, Sights, Experiences), interactive maps, and itinerary builder. Red→orange gradient accent.
Version: 2.1.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tom
Tags: travel, gutenberg, block-editor, custom-colors, custom-menu, custom-logo, featured-images, full-width-template, threaded-comments, translation-ready
*/

/* ============================================
   ROOT VARIABLES (editable via Customizer)
   ============================================ */
:root {
  --tom-accent-start: #e11d2e;
  --tom-accent-end: #f97316;
  --tom-gradient: linear-gradient(90deg, var(--tom-accent-start) 0%, var(--tom-accent-end) 100%);
  --tom-text: #1a1a1a;
  --tom-muted: #666;
  --tom-bg: #fff;
  --tom-bg-alt: #faf7f2;
  --tom-border: #e5e5e5;
  --tom-radius: 12px;
  --tom-shadow: 0 6px 20px rgba(0,0,0,.08);
  --tom-shadow-lg: 0 12px 40px rgba(0,0,0,.12);
  --tom-font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --tom-font-display: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--tom-font-body);
  color: var(--tom-text);
  background: var(--tom-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--tom-accent-start); text-decoration: none; transition: color .2s; }
a:hover { color: var(--tom-accent-end); }
h1, h2, h3, h4 { font-family: var(--tom-font-display); line-height: 1.2; margin: 0 0 .5em; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ============================================
   HEADER
   ============================================ */
.tom-topbar {
  background: var(--tom-gradient);
  color: #fff;
  font-size: 13px;
  padding: 8px 0;
}
.tom-topbar .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  align-items: center;
}
.tom-topbar a { color: #fff; display: inline-flex; align-items: center; gap: 6px; }
.tom-topbar a:hover { opacity: .85; color: #fff; }
.tom-topbar svg { width: 16px; height: 16px; }

.tom-header {
  background: #fff;
  border-bottom: 1px solid var(--tom-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.tom-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.tom-logo {
  font-family: var(--tom-font-display);
  font-size: 24px;
  font-weight: 700;
  background: var(--tom-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tom-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 24px;
  align-items: center;
}
.tom-nav a {
  color: var(--tom-text);
  font-weight: 500;
  font-size: 15px;
}
.tom-nav a:hover { color: var(--tom-accent-start); }
.tom-itinerary-count {
  background: var(--tom-gradient);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.tom-mobile-toggle { display: none; background: none; border: 0; font-size: 24px; cursor: pointer; }

@media (max-width: 900px) {
  .tom-mobile-toggle { display: block; }
  .tom-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--tom-border); padding: 16px 20px; }
  .tom-nav.open { display: block; }
  .tom-nav ul { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* ============================================
   BUTTONS
   ============================================ */
.tom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  border: 0;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, opacity .2s;
  text-decoration: none;
}
.tom-btn-primary {
  background: var(--tom-gradient);
  color: #fff;
}
.tom-btn-primary:hover { transform: translateY(-2px); box-shadow: var(--tom-shadow); color: #fff; }
.tom-btn-outline {
  background: transparent;
  color: #fff;
  border: 2px solid #fff;
}
.tom-btn-outline:hover { background: #fff; color: var(--tom-accent-start); }
.tom-btn-ghost {
  background: #fff;
  color: var(--tom-accent-start);
  border: 2px solid var(--tom-accent-start);
}
.tom-btn-ghost:hover { background: var(--tom-gradient); color: #fff; border-color: transparent; }

/* ============================================
   HERO
   ============================================ */
.tom-hero {
  position: relative;
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background: #222 center/cover no-repeat;
  overflow: hidden;
}
.tom-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.3) 0%, rgba(0,0,0,.55) 100%);
}
.tom-hero-inner { position: relative; max-width: 800px; padding: 80px 20px; }
.tom-hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  margin: 0 0 16px;
  text-shadow: 0 2px 20px rgba(0,0,0,.4);
}
.tom-hero p {
  font-size: clamp(16px, 2vw, 20px);
  margin: 0 0 32px;
  opacity: .95;
}
.tom-hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Color bar */
.tom-color-bar {
  height: 6px;
  background: var(--tom-gradient);
}

/* ============================================
   SECTIONS
   ============================================ */
.tom-section { padding: 80px 0; }
.tom-section-alt { background: var(--tom-bg-alt); }
.tom-section-head { text-align: center; margin-bottom: 50px; }
.tom-section-head h2 { font-size: clamp(28px, 4vw, 42px); }
.tom-section-head .lead { color: var(--tom-muted); font-size: 17px; max-width: 600px; margin: 0 auto; }
.tom-eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: var(--tom-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  margin-bottom: 12px;
}

/* Intro block */
.tom-intro {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
  font-size: 18px;
  color: var(--tom-muted);
}

/* ============================================
   MASONRY GRID (CSS columns)
   ============================================ */
.tom-masonry {
  column-count: 3;
  column-gap: 20px;
}
.tom-masonry > * {
  break-inside: avoid;
  margin-bottom: 20px;
  display: block;
}
@media (max-width: 900px) { .tom-masonry { column-count: 2; } }
@media (max-width: 600px) { .tom-masonry { column-count: 1; } }

/* Card */
.tom-card {
  background: #fff;
  border-radius: var(--tom-radius);
  overflow: hidden;
  box-shadow: var(--tom-shadow);
  transition: transform .25s, box-shadow .25s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.tom-card:hover { transform: translateY(-4px); box-shadow: var(--tom-shadow-lg); color: inherit; }
.tom-card-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.tom-card-body { padding: 20px; }
.tom-card-title { font-size: 20px; margin: 0 0 8px; }
.tom-card-meta { font-size: 13px; color: var(--tom-muted); display: flex; gap: 12px; margin-bottom: 10px; }
.tom-card-excerpt { color: var(--tom-muted); font-size: 14px; margin: 0 0 14px; }
.tom-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tom-card-actions .tom-btn { padding: 8px 14px; font-size: 13px; }

/* Quick links */
.tom-quicklinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.tom-quicklink {
  position: relative;
  border-radius: var(--tom-radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  text-shadow: 0 2px 10px rgba(0,0,0,.5);
  background: #333 center/cover;
  transition: transform .25s;
}
.tom-quicklink::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.7) 100%);
}
.tom-quicklink span { position: relative; z-index: 1; }
.tom-quicklink:hover { transform: scale(1.03); color: #fff; }

/* Map teaser */
.tom-map-teaser {
  border-radius: var(--tom-radius);
  overflow: hidden;
  box-shadow: var(--tom-shadow);
  position: relative;
  background: var(--tom-bg-alt);
}
.tom-map-teaser .tom-map { width: 100%; height: 420px; }

/* ============================================
   TOUR / DESTINATION TEMPLATE
   ============================================ */
.tom-detail-hero {
  position: relative;
  min-height: 55vh;
  background: #222 center/cover;
  color: #fff;
  display: flex;
  align-items: flex-end;
}
.tom-detail-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.7));
}
.tom-detail-hero .container { position: relative; padding-top: 80px; padding-bottom: 50px; }
.tom-detail-hero h1 { font-size: clamp(34px, 5vw, 56px); margin: 0 0 12px; }
.tom-detail-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.tom-detail-meta span { background: rgba(255,255,255,.15); backdrop-filter: blur(8px); padding: 6px 14px; border-radius: 999px; }

.tom-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  margin-top: 40px;
}
@media (max-width: 900px) { .tom-detail-grid { grid-template-columns: 1fr; } }

.tom-detail-section { margin-bottom: 40px; }
.tom-detail-section h2 {
  font-size: 26px;
  padding-bottom: 10px;
  border-bottom: 3px solid;
  border-image: var(--tom-gradient) 1;
  display: inline-block;
}

.tom-sidebar {
  position: sticky;
  top: 90px;
  align-self: start;
  background: var(--tom-bg-alt);
  border-radius: var(--tom-radius);
  padding: 24px;
}
.tom-sidebar h3 { margin: 0 0 16px; font-size: 18px; }
.tom-sidebar .price {
  font-size: 28px;
  font-weight: 700;
  background: var(--tom-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Itinerary timeline */
.tom-day {
  border-left: 3px solid;
  border-image: var(--tom-gradient) 1;
  padding: 0 0 24px 24px;
  position: relative;
}
.tom-day::before {
  content: '';
  position: absolute;
  left: -8px; top: 6px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--tom-gradient);
}
.tom-day h4 { margin: 0 0 6px; font-size: 18px; }
.tom-day .day-num { font-size: 12px; font-weight: 700; letter-spacing: 1px; color: var(--tom-accent-start); text-transform: uppercase; }

/* Gallery masonry */
.tom-gallery { column-count: 3; column-gap: 12px; }
.tom-gallery img {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 8px;
  break-inside: avoid;
  cursor: pointer;
  transition: opacity .2s;
}
.tom-gallery img:hover { opacity: .85; }
@media (max-width: 700px) { .tom-gallery { column-count: 2; } }

/* Map with pins */
.tom-tour-map { width: 100%; height: 450px; border-radius: var(--tom-radius); overflow: hidden; }

/* ============================================
   ITINERARY BUILDER
   ============================================ */
.tom-builder-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}
@media (max-width: 900px) { .tom-builder-grid { grid-template-columns: 1fr; } }
.tom-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; border-bottom: 2px solid var(--tom-border); }
.tom-tab {
  padding: 10px 18px;
  background: none;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--tom-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tom-tab.active { color: var(--tom-accent-start); border-bottom-color: var(--tom-accent-start); }
.tom-tab-panel { display: none; }
.tom-tab-panel.active { display: block; }

.tom-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tom-item {
  background: #fff;
  border: 1px solid var(--tom-border);
  border-radius: var(--tom-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tom-item img { aspect-ratio: 4/3; object-fit: cover; }
.tom-item-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.tom-item-body h4 { margin: 0 0 6px; font-size: 16px; }
.tom-item-body p { font-size: 13px; color: var(--tom-muted); margin: 0 0 12px; flex: 1; }
.tom-item-actions { display: flex; gap: 6px; }
.tom-item-actions .tom-btn { padding: 6px 12px; font-size: 12px; flex: 1; }

.tom-summary {
  background: var(--tom-bg-alt);
  border-radius: var(--tom-radius);
  padding: 20px;
  position: sticky;
  top: 90px;
}
.tom-summary h3 { margin: 0 0 12px; }
.tom-summary ul { list-style: none; padding: 0; margin: 0 0 16px; }
.tom-summary li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--tom-border);
  font-size: 14px;
}
.tom-summary li button { background: none; border: 0; color: var(--tom-accent-start); cursor: pointer; font-size: 18px; }

/* Form */
.tom-form { display: grid; gap: 14px; }
.tom-form label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 4px; }
.tom-form input, .tom-form textarea, .tom-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--tom-border);
  border-radius: 8px;
  font: inherit;
}
.tom-form input:focus, .tom-form textarea:focus { outline: 2px solid var(--tom-accent-start); border-color: transparent; }
.tom-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .tom-form-row { grid-template-columns: 1fr; } }
.tom-checkbox { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: normal; }
.tom-checkbox input { width: auto; margin-top: 4px; }

/* ============================================
   TESTIMONIALS
   ============================================ */
.tom-testimonials {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.tom-testimonial {
  background: #fff;
  padding: 24px;
  border-radius: var(--tom-radius);
  box-shadow: var(--tom-shadow);
  position: relative;
}
.tom-testimonial::before {
  content: '"';
  position: absolute; top: -10px; left: 20px;
  font-size: 80px; line-height: 1;
  background: var(--tom-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-family: serif;
}
.tom-testimonial p { font-style: italic; margin: 12px 0; }
.tom-testimonial cite { font-style: normal; font-weight: 600; }
.tom-stars { color: #fbbf24; margin-bottom: 8px; }

/* ============================================
   FINAL CTA
   ============================================ */
.tom-final-cta {
  background: var(--tom-gradient);
  color: #fff;
  text-align: center;
  padding: 80px 20px;
}
.tom-final-cta h2 { font-size: clamp(28px, 4vw, 42px); margin: 0 0 16px; color: #fff; }
.tom-final-cta p { font-size: 18px; opacity: .95; margin: 0 0 28px; }

/* ============================================
   FOOTER
   ============================================ */
.tom-footer {
  background: #1a1a1a;
  color: #ccc;
  padding: 40px 0 20px;
  text-align: center;
  font-size: 14px;
}
.tom-footer a { color: #fff; }
.tom-footer-legal { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.tom-footer-copyright { opacity: .6; font-size: 13px; }

/* Tours-that-may-interest-you widget */
.tom-related {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--tom-border);
}
.tom-related h3 { font-size: 22px; margin-bottom: 20px; }
.tom-related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* Lightbox */
.tom-lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
}
.tom-lightbox.open { display: flex; }
.tom-lightbox img { max-width: 95vw; max-height: 92vh; border-radius: 8px; }
.tom-lightbox-close { position: absolute; top: 20px; right: 24px; background: none; border: 0; color: #fff; font-size: 36px; cursor: pointer; }

/* Notice */
.tom-notice {
  padding: 14px 18px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
}
.tom-notice-success { background: #d1fae5; color: #065f46; }
.tom-notice-error { background: #fee2e2; color: #991b1b; }

/* WP block alignments */
.alignwide { max-width: 1100px; margin-left: auto; margin-right: auto; }
.alignfull { width: 100%; }
.aligncenter { text-align: center; }

/* Active map marker */
.tom-marker-active { filter: hue-rotate(60deg) saturate(2); transform: scale(1.2); }
