/* ============================================
   David Novak — Custom Styles
   (Layered on top of Tailwind utilities)
   ============================================ */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* offset for fixed header anchor jumps */
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Header scroll state ---------- */
#site-header.is-scrolled {
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
}

/* ---------- Hero slider ---------- */
.hero-slider {
  /* Lock the section so absolutely-positioned controls anchor correctly */
}

.hero-viewport {
  overflow: hidden;
  position: relative;
}

.hero-track {
  transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
  touch-action: pan-y;
}

.hero-track.is-dragging {
  transition: none;
  cursor: grabbing;
}

.hero-slide {
  min-width: 100%;
}

/* Arrows */
.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.9);
  color: #0a0a0a;
  border: 1px solid #e4e4e7;
  box-shadow: 0 6px 20px rgba(10, 10, 10, 0.08);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.hero-arrow:hover {
  background-color: #facc15;
  color: #0a0a0a;
  box-shadow: 0 10px 24px rgba(250, 204, 21, 0.35);
}
.hero-arrow:active {
  transform: translateY(-50%) scale(0.95);
}
.hero-prev { left: 0.75rem; }
.hero-next { right: 0.75rem; }

@media (min-width: 768px) {
  .hero-arrow { width: 52px; height: 52px; }
  .hero-prev  { left: 1.5rem; }
  .hero-next  { right: 1.5rem; }
}

/* Dots */
.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background-color: #d4d4d8;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.25s, width 0.25s, transform 0.2s;
}
.hero-dot:hover {
  background-color: #a1a1aa;
}
.hero-dot.is-active {
  background-color: #0a0a0a;
  width: 28px;
}

/* ---------- GHL form wrapper ---------- */
.ghl-form-wrapper {
  position: relative;
  width: 100%;
}

.ghl-form-wrapper iframe {
  display: block;
  width: 100%;
  background: transparent;
}

/* Hide static placeholder note once the iframe gets a real src */
.ghl-form-wrapper:has(iframe[src]:not([src="about:blank"])) .ghl-placeholder {
  display: none;
}

/* ---------- Reveal-on-scroll utility ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Custom scrollbar (subtle) ---------- */
@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 10px;
  }
  ::-webkit-scrollbar-track {
    background: #f5f7fa;
  }
  ::-webkit-scrollbar-thumb {
    background: #cfd8e3;
    border-radius: 8px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #a6b6cb;
  }
}

/* ---------- Focus styles ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid #facc15;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Details/summary cleanup ---------- */
summary::-webkit-details-marker {
  display: none;
}

/* ---------- Form fields ---------- */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e4e4e7;
  background-color: #ffffff;
  color: #0a0a0a;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: #a1a1aa;
}

.form-input:hover {
  border-color: #d4d4d8;
}

.form-input:focus {
  outline: none;
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22);
  background-color: #ffffff;
}

.form-input:disabled {
  background-color: #fafafa;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Native select arrow */
select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2371717a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

/* Checkbox group */
.form-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #3f3f46;
  cursor: pointer;
  padding: 0.5rem 0.25rem;
  border-radius: 0.5rem;
  transition: color 0.15s ease;
}

.form-check:hover {
  color: #0a0a0a;
}

.form-check input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #0a0a0a;
  cursor: pointer;
  flex-shrink: 0;
}

/* Form status messages */
.form-status {
  padding: 1rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.form-status--success {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.form-status--error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

.form-status--error a {
  text-decoration: underline;
  font-weight: 600;
}

/* Spinner */
@keyframes form-spin {
  to { transform: rotate(360deg); }
}

.form-spinner {
  display: inline-block;
  width: 1.125rem;
  height: 1.125rem;
  margin-left: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: form-spin 0.7s linear infinite;
}

/* Editor drag-and-drop indicator (Quill's .ql-editor while files are dragged over) */
.ql-editor.is-drop-target {
  outline: 2px dashed #facc15;
  outline-offset: -8px;
  background-color: #fefce8;
  transition: background-color 0.15s ease;
}

.ql-editor.is-drop-target::before {
  content: 'Drop images here to upload';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #facc15;
  color: #0a0a0a;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 6px 20px rgba(250, 204, 21, 0.45);
}

/* Responsive embeds inside blog post bodies (e.g. YouTube) */
.post-body iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 0;
  border-radius: 0.75rem;
  margin: 1.75rem 0;
  box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.25);
}

/* ============================================================
   Admin — blog editor: Quill polish
   ============================================================ */

/* Toolbar */
.ql-toolbar.ql-snow {
  border: 1px solid #e4e4e7 !important;
  border-bottom: 0 !important;
  border-radius: 0.75rem 0.75rem 0 0;
  background: #fafafa;
  padding: 10px 12px;
  font-family: inherit;
}
.ql-toolbar.ql-snow .ql-formats {
  margin-right: 14px;
}
.ql-snow .ql-stroke { stroke: #3f3f46; }
.ql-snow .ql-fill, .ql-snow .ql-stroke.ql-fill { fill: #3f3f46; }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow.ql-toolbar button:focus .ql-stroke {
  stroke: #0a0a0a;
}
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow.ql-toolbar button:focus .ql-fill {
  fill: #0a0a0a;
}
.ql-snow.ql-toolbar button.ql-active,
.ql-snow.ql-toolbar .ql-picker-label.ql-active,
.ql-snow.ql-toolbar .ql-picker-item.ql-selected {
  color: #0a0a0a;
}

/* Editor surface */
.ql-container.ql-snow {
  border: 1px solid #e4e4e7 !important;
  border-radius: 0 0 0.75rem 0.75rem;
  background: #ffffff;
  font-family: inherit;
}
.ql-editor {
  min-height: 460px;
  padding: 1.5rem 1.75rem;
  font-family: inherit;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #18181b;
}
.ql-editor.ql-blank::before {
  font-style: normal;
  color: #a1a1aa;
  font-size: 1.05rem;
  left: 1.75rem;
  right: 1.75rem;
}
.ql-editor:focus {
  outline: none;
}
.ql-container.ql-snow:has(.ql-editor:focus) {
  border-color: #facc15 !important;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22);
}

/* Headings inside the editor — match the public post body's typography rhythm */
.ql-editor h1 { font-size: 1.875rem; font-weight: 700; margin: 1.5rem 0 0.75rem; }
.ql-editor h2 { font-size: 1.5rem;   font-weight: 700; margin: 1.4rem 0 0.6rem; }
.ql-editor h3 { font-size: 1.25rem;  font-weight: 700; margin: 1.2rem 0 0.5rem; }
.ql-editor p { margin: 0.5rem 0; }
.ql-editor blockquote {
  border-left: 3px solid #facc15;
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  color: #3f3f46;
}
.ql-editor pre.ql-syntax,
.ql-editor pre {
  background: #18181b;
  color: #fafafa;
  padding: 1rem;
  border-radius: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.875rem;
}
.ql-editor img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
}
.ql-editor iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto !important;
  border: 0;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* Drop-target highlight when dragging an image over the editor body */
.ql-editor.is-drop-target,
.ql-container.ql-snow:has(.ql-editor.is-drop-target) {
  background: #fef9c3;
}
.ql-editor.is-drop-target {
  outline: 2px dashed #facc15;
  outline-offset: -10px;
}

/* ============================================================
   Admin — cover image uploader (click + drag-drop)
   ============================================================ */

.cover-uploader {
  position: relative;
}

.cover-uploader__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2.5rem 1.5rem;
  border: 2px dashed #d4d4d8;
  border-radius: 1rem;
  background: #fafafa;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
  font-family: inherit;
}
.cover-uploader__empty:hover {
  border-color: #a1a1aa;
  background: #f4f4f5;
}
.cover-uploader__empty:focus-visible {
  outline: 2px solid #facc15;
  outline-offset: 3px;
}
.cover-uploader__empty.is-drop-target {
  border-color: #facc15;
  background: #fef9c3;
  border-style: solid;
  transform: scale(1.005);
}
.cover-uploader__empty.is-uploading { opacity: 0.5; pointer-events: none; }

/* Allow drop-onto-preview to replace the current cover */
.cover-uploader__preview.is-drop-target {
  outline: 3px solid #facc15;
  outline-offset: -3px;
  position: relative;
}
.cover-uploader__preview.is-drop-target::after {
  content: 'Drop to replace';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(254, 249, 195, 0.85);
  color: #0a0a0a;
  font-weight: 700;
  font-size: 1.125rem;
  pointer-events: none;
  z-index: 2;
}

.cover-uploader__preview {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  background: #fafafa;
  border: 1px solid #e4e4e7;
}
.cover-uploader__preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.cover-uploader__preview.is-uploading img { opacity: 0.4; }

.cover-uploader__actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
}
.cover-uploader__action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  background: rgba(10, 10, 10, 0.85);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  border: 0;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background-color 0.15s;
}
.cover-uploader__action-btn:hover {
  background: rgba(10, 10, 10, 1);
}
.cover-uploader__action-btn--danger:hover {
  background: #b91c1c;
}

.cover-uploader__loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #18181b;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 1rem;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1;
  pointer-events: none;
}

.cover-uploader__spinner {
  margin-left: 0;
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: #0a0a0a;
}

/* sr-only utility for the hidden file input */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
