/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 *
 *= require ../builds/tailwind
 *= require home
 */

/* Import Quill CSS from CDN */
/* Quill editor CSS: loaded by the layout for admins only (it blocked rendering on every page) */

/* Font Family Configuration - Using Apple system fonts for magazine style */

/* Apply system fonts to blog content for clean, modern look */
.blog-container h1,
.blog-container h2,
.blog-container h3,
.blog-container h4,
.blog-container h5,
.blog-container h6 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

.blog-container h1,
.blog-container h2 {
  font-weight: 400;
}

/* Body text uses system fonts for magazine-quality typography */
.blog-container,
.blog-container p,
.blog-container li,
.blog-container span {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

/* Custom Button Ripple Effects */
.btn-ripple {
  position: relative;
  overflow: hidden;
  transition: all 150ms;
}

.btn-ripple:active {
  transform: scale(0.9);
}

.btn-ripple::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: white;
  opacity: 0;
  pointer-events: none;
}

.btn-ripple:active::before {
  opacity: 0.3;
  animation: ripple 0.6s ease-out;
}

.btn-ripple-secondary {
  position: relative;
  overflow: hidden;
  transition: all 150ms;
}

.btn-ripple-secondary:active {
  transform: scale(0.9);
}

.btn-ripple-secondary::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #111827;
  opacity: 0;
  pointer-events: none;
}

.btn-ripple-secondary:active::before {
  opacity: 0.1;
  animation: ripple 0.6s ease-out;
}

/* Link Underline Animation */
.link-underline {
  position: relative;
  transition: all 150ms;
  display: inline-block;
  padding-bottom: 2px;
}

/* Full width variant for wrap/grid highlights */
.link-underline-block {
  position: relative;
  transition: all 150ms;
  display: block;
  padding-bottom: 2px;
}

.link-underline::before,
.link-underline-block::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background-color: #111827;
  transition: transform 300ms;
}

/* Reveal underline on scroll */
.link-underline.reveal-underline::before,
.link-underline-block.reveal-underline::before {
  transform: scaleX(1);
}

/* Keep hover effect */
.link-underline:hover::before,
.link-underline-block:hover::before {
  transform: scaleX(1);
}

/* Red underline for blog navigation */
.link-underline-red::before {
  background-color: #dc2626 !important; /* Red-600 - Japan red */
}

/* Separator Line Animation (for wrap/grid highlights) */
.separator-line {
  height: 1px;
  width: 100%;
  background-color: #111827;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms;
  margin-bottom: 16px; /* Same as mb-4 on title */
}

.separator-line.reveal-underline {
  transform: scaleX(1);
}

/* Document Preview Styles */
.document-preview-thumbnail {
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  border-radius: 8px;
}

.document-preview-thumbnail:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.document-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
}

.document-info {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Profile Settings Styles */
.needs-validation .form-control:invalid {
  border-color: #dc3545;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.needs-validation .form-control:valid {
  border-color: #198754;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.profile-settings .card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  border: 1px solid rgba(0, 0, 0, 0.125);
}

.profile-settings .card-header {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

@media (max-width: 768px) {
  .document-preview-thumbnail {
    max-height: 120px !important;
  }

  .modal-lg {
    max-width: 95%;
  }

  .profile-settings .col-md-6 {
    margin-bottom: 1rem;
  }
}

/* Quill Editor Styles */
.quill-editor-wrapper {
  background: white;
}

.quill-editor-wrapper .ql-container {
  min-height: 400px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.quill-editor-wrapper .ql-editor {
  min-height: 400px;
  max-width: 64rem; /* max-w-5xl = 1024px = 64rem - matches blog post content width */
  margin-left: auto;
  margin-right: auto;
}

.quill-editor-wrapper .ql-editor h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.quill-editor-wrapper .ql-editor h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.quill-editor-wrapper .ql-editor h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.quill-editor-wrapper .ql-editor p {
  margin-bottom: 1rem;
}

.quill-editor-wrapper .ql-editor ul,
.quill-editor-wrapper .ql-editor ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.quill-editor-wrapper .ql-editor blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: #6b7280;
}

.quill-editor-wrapper .ql-editor p:has(img) {
  clear: both;
}

.quill-editor-wrapper .ql-editor img {
  float: left;
  max-width: 400px;
  width: 100%;
  height: auto;
  margin-right: 2rem;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .quill-editor-wrapper .ql-editor img {
    float: none;
    max-width: 100%;
    margin-right: 0;
  }
}

.quill-editor-wrapper .ql-toolbar {
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  border-color: #d1d5db;
  background: #f9fafb;
}

/* Blog post content display styles (for Quill-generated content) */
.blog-content {
  line-height: 1.6;
}

@media (min-width: 768px) {
  /* On desktop, account for floated TOC width */
  .blog-post-layout .blog-content {
    /* Let content naturally flow, don't set width */
    width: auto;
  }
}

.blog-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 1.5rem 0 1rem;
  line-height: 1.2;
}

.blog-content h2 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1.75rem;
  font-weight: 400;
  margin: 2rem 0 1rem; /* Match highlights */
  line-height: 1.3;
}

/* Reduce h2 top spacing on mobile */
@media (max-width: 767px) {
  .blog-content h2 {
    margin: 1.5rem 0 1rem;
  }
}

.blog-content h3 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1.25rem; /* 20px */
  font-weight: 400;
  margin: 1.5rem 0 1rem; /* Match highlights */
  line-height: 1.4;
}

.blog-content p {
  margin-bottom: 1rem;
  font-size: 1.125rem; /* 18px */
  line-height: 1.75;
}

.blog-content a {
  text-decoration: underline;
  color: inherit;
}

.blog-content a:hover {
  opacity: 0.8;
}

.blog-content ul,
.blog-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.blog-content blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: #6b7280;
}

/* Images float within content, alternating left/right */
.blog-content img {
  max-width: 400px;
  width: 100%;
  height: auto;
}

/* Paragraphs with images clear floats */
.blog-content p:has(img) {
  clear: both;
}

/* Odd images float left */
.blog-content p:has(img):nth-of-type(odd) img {
  float: left;
  margin-right: 2rem;
  margin-bottom: 1rem;
}

/* Even images float right */
.blog-content p:has(img):nth-of-type(even) img {
  float: right;
  margin-left: 2rem;
  margin-bottom: 1rem;
}

/* DON'T clear floats on headings - it would break TOC wrapping */

@media (max-width: 768px) {
  .blog-content img {
    float: none;
    max-width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Blog post layout - Simple float on desktop, stack on mobile */
.blog-post-layout {
  display: block;
}

/* Table of Contents Styles - Magazine Style */
.toc-wrapper {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  margin-bottom: 2rem;
  float: none;
  width: 100%;
}

@media (min-width: 768px) {
  .toc-wrapper {
    float: left;
    width: 20rem;
    margin-right: 2rem;
    margin-bottom: 2rem;
  }
}

/* Ensure content displays properly and wraps around float */
.blog-content {
  display: block;
}

/* Override blog-container font rules for TOC */
.toc-wrapper,
.toc-wrapper li,
.toc-wrapper span,
.toc-wrapper a {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif !important;
}

.toc-link {
  transition: all 0.2s ease;
  color: #374151;
}

.toc-link:hover {
  color: #111827;
}

.toc-link.text-blue-600 {
  color: #111827;
  font-weight: 600;
}

.toc-link .toc-number {
  font-variant-numeric: tabular-nums;
  min-width: 2rem;
}

.toc-link:hover .toc-number,
.toc-link.text-blue-600 .toc-number {
  color: #111827;
}

/* Ensure blog content has proper spacing for headings */
.blog-content h2,
.blog-content h3 {
  scroll-margin-top: 120px; /* Offset for fixed header + padding */
}

/* Consistent typography across blog index and article pages */
/* Highlighted articles, gem/hub cards, and regular post cards */
.blog-index-h2 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 2.25rem; /* 36px - larger than preview content h2 */
  font-weight: 400;
  line-height: 1.2;
}

.blog-index-h3 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1.375rem; /* 22px - for gem/hub cards */
  font-weight: 400;
  line-height: 1.3;
}

.blog-index-excerpt {
  font-size: 1.125rem; /* 18px - matches article page p */
  line-height: 1.75;
}

/* Preview content inside highlighted articles - match article page styling */
.blog-index-preview {
  font-size: 1.125rem; /* 18px - matches article page p */
  line-height: 1.75;
}

.blog-index-preview h2 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1.75rem; /* 28px - smaller than main title */
  font-weight: 400;
  margin: 2rem 0 1rem;
  line-height: 1.3;
}

/* Remove top margin from first heading in preview content */
.blog-index-preview h2:first-child,
.blog-index-preview h3:first-child {
  margin-top: 0;
}

.blog-index-preview h3 {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1.125rem; /* 18px - matches article page h3 */
  font-weight: 400;
  margin: 1.5rem 0 1rem;
  line-height: 1.4;
}

.blog-index-preview p {
  font-size: 1.125rem; /* 18px */
  line-height: 1.75;
  margin-bottom: 1rem;
}

@media (max-width: 767px) {
  .blog-index-h2 {
    font-size: 1.75rem; /* 28px on mobile */
  }

  .blog-index-h3 {
    font-size: 1.25rem; /* 20px on mobile - gem/hub cards */
  }

  .blog-index-excerpt,
  .blog-index-preview,
  .blog-index-preview p {
    font-size: 1rem; /* 16px on mobile */
  }

  .blog-index-preview h2 {
    font-size: 1.5rem; /* 24px on mobile */
  }

  .blog-index-preview h3 {
    font-size: 1rem; /* 16px on mobile */
  }
}

/* Page Swap Animation (Mobile-style) */
@keyframes slideOutLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-30%);
    opacity: 0;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(30%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Cookie Consent Banner - Add padding when visible to prevent banner from covering content */
body.cookie-banner-visible {
  padding-bottom: 6rem !important; /* ~96px - ensure content is scrollable past banner on mobile */
}

body.cookie-banner-visible main,
body.cookie-banner-visible section:last-of-type {
  margin-bottom: 6rem !important;
}

@media (min-width: 640px) {
  body.cookie-banner-visible {
    padding-bottom: 5rem !important; /* ~80px - height of desktop banner */
  }

  body.cookie-banner-visible main,
  body.cookie-banner-visible section:last-of-type {
    margin-bottom: 5rem !important;
  }
}

/* Review card flip animation */
.review-flip-inner {
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.review-flip-inner.is-flipped {
  transform: rotateY(180deg);
}
.review-flip-face {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Keep the 3D scene through descendants so a child's `transform`
     utility (e.g. Tailwind's `transform hover:-translate-y-1` on the
     package card link) can't flatten the parent's preserve-3d and
     leak the front face through the back during the flip. */
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  /* Nudge the back face slightly forward in 3D space so the painter
     always resolves it above the front when both faces share the same z. */
}
.review-flip-back {
  transform: rotateY(180deg) translateZ(1px);
}

/* Travel Protection sticker badge — sits at top-right corner of the package card,
   peeking just above the card edge for a "sticker" feel. */
.tp-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 10px;
  background: linear-gradient(135deg, #d4002f 0%, #BC002D 50%, #9a0024 100%);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 2px solid #ffffff;
  border-radius: 9999px;
  box-shadow: 0 6px 14px rgba(188, 0, 45, 0.35), 0 2px 4px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  animation: tp-badge-pulse 2.4s ease-in-out infinite;
  transition: transform 0.18s ease, filter 0.18s ease;
}
.tp-badge::before {
  /* Sheen that sweeps across to signal "tap me" */
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.45) 50%, transparent 100%);
  animation: tp-badge-sheen 3.2s ease-in-out infinite;
  pointer-events: none;
}
.tp-badge:hover {
  filter: brightness(1.08);
  transform: scale(1.04);
  animation: none;
}
.tp-badge:hover::before {
  animation-duration: 1.2s;
}
.tp-badge:active {
  transform: scale(0.97);
}
.tp-badge > span,
.tp-badge > svg {
  position: relative;
  z-index: 1;
}
.tp-badge-arrow {
  animation: tp-badge-arrow-nudge 1.6s ease-in-out infinite;
}
.tp-badge:hover .tp-badge-arrow {
  animation-duration: 0.8s;
}
@keyframes tp-badge-pulse {
  0%, 100% { box-shadow: 0 6px 14px rgba(188, 0, 45, 0.35), 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 0 0 rgba(188, 0, 45, 0.45); }
  50%      { box-shadow: 0 6px 16px rgba(188, 0, 45, 0.4), 0 2px 4px rgba(0, 0, 0, 0.14), 0 0 0 8px rgba(188, 0, 45, 0); }
}
@keyframes tp-badge-sheen {
  0%   { left: -80%; }
  60%  { left: 110%; }
  100% { left: 110%; }
}
@keyframes tp-badge-arrow-nudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .tp-badge { animation: none; }
  .tp-badge::before { display: none; }
  .tp-badge-arrow { animation: none; }
}



/* Review form star rating (shared/_review_form): radios 5..1 laid out right-to-left */
.rv-stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.rv-stars input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.rv-stars label { cursor: pointer; color: #D1D5DB; line-height: 0; transition: color .12s; }
.rv-stars label svg { width: 32px; height: 32px; }
.rv-stars label:hover, .rv-stars label:hover ~ label, .rv-stars input:checked ~ label { color: #F59E0B; }
.rv-stars input:focus-visible + label { outline: 2px solid #BC002D; outline-offset: 2px; border-radius: 4px; }
