/* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */

/* TailwindCSS is loaded via app/styles/tailwind.css (linked directly in index.html) */

/* ══════════════════════════════════════════════════════════════════════
   BOTANIST FIELD JOURNAL — styles globaux
   ══════════════════════════════════════════════════════════════════════ */

/* ── Base typographique ───────────────────────────────────────────────── */

html {
  font-family: var(--font-serif);
  color: var(--color-ink);
  /* Grid couvre tout le viewport (scrollbar track inclus) */
  background-color: var(--color-parchment);
  background-image:
    linear-gradient(color-mix(in oklch, var(--color-pencil-light) 45%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklch, var(--color-pencil-light) 45%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
}

body {
  background-color: transparent;
}

/* ── Grille de papier (fond principal) ───────────────────────────────── */

.grid-paper {
  background-color: var(--color-parchment);
  background-image:
    linear-gradient(color-mix(in oklch, var(--color-pencil-light) 45%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklch, var(--color-pencil-light) 45%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── Texture parchemin (avec bruit SVG) ──────────────────────────────── */

.parchment-texture {
  /* Seul le bruit SVG ici — la grille est portée par html */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 300px 300px;
}

/* ── Panneau de contenu (fond lecture, masque la grille) ──────────────── */

.content-panel {
  background-color: var(--color-parchment);
  padding: 1.75rem 1.25rem;
  box-shadow: 0 1px 6px color-mix(in oklch, var(--color-ink) 5%, transparent);
}

@media (min-width: 640px) {
  .content-panel {
    padding: 2.5rem 2rem;
  }
}

@media (min-width: 1024px) {
  .content-panel {
    padding: 3.5rem 3rem;
  }
}

/* ── Carte spécimen (double bordure) ─────────────────────────────────── */
/*
 * Ne pas mettre overflow-hidden sur .specimen-card directement.
 * Les wrappers internes qui nécessitent un clip utilisent overflow-hidden.
 * Raison : le pseudo-élément ::before (inset border) serait coupé.
 */

.specimen-card {
  background-color: var(--color-parchment);
  border: 1px solid var(--color-pencil);
  position: relative;
}

.specimen-card::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid var(--color-pencil-light);
  pointer-events: none;
  z-index: 0;
}

.specimen-card > * {
  position: relative;
  z-index: 1;
}

/* ── Séparateur de section ────────────────────────────────────────────── */

.field-divider {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-pencil) 20%,
    var(--color-pencil) 80%,
    transparent
  );
  position: relative;
}

.field-divider::after {
  content: '\2726';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-parchment);
  color: var(--color-pencil-dark);
  padding: 0 0.5rem;
  font-size: 0.6rem;
}

/* ── Prose journal (contenu markdown) ────────────────────────────────── */

.journal-prose h1,
.journal-prose h2,
.journal-prose h3 {
  font-family: var(--font-serif);
  color: var(--color-forest);
}

.journal-prose p {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.55;
  margin-bottom: 1.75em;
  color: var(--color-ink);
}

.journal-prose p:last-child {
  margin-bottom: 0;
}

.journal-prose a {
  color: var(--color-forest);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Sidebar admin ────────────────────────────────────────────────────── */

.admin-sidebar {
  background-color: var(--color-forest);
  min-height: 100vh;
}

/* ── Layout journal (centrage responsive) ────────────────────────────── */

.journal-layout {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (min-width: 768px) {
  .journal-layout {
    padding-inline: 3rem;
  }
}

@media (min-width: 1024px) {
  .journal-layout {
    padding-inline: 5rem;
  }
}

/* ── Focus visible ────────────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-forest);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Animations de chargement ─────────────────────────────────────────── */

@keyframes loading-bar-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

@keyframes loading-spinner-draw {
  0%   { stroke-dashoffset: 88; }
  50%  { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -88; }
}

@keyframes loading-overlay-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes loading-overlay-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── Impression ───────────────────────────────────────────────────────── */

@media print {
  .parchment-texture,
  .grid-paper {
    background-image: none;
    background-color: white;
  }

  .admin-sidebar {
    display: none;
  }
}

/* ── Mouvement réduit ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
