/* ==========================================
   CoDA Lietuva — Main Stylesheet
   Warm, organic, nature-inspired design system
   for a recovery support community.
   ========================================== */

/* --- Light Mode Tokens --- */
:root {
  --color-bg: #F8F5F0;
  --color-surface: #FFFFFF;
  --color-primary: #5B8A72;
  --color-primary-dark: #3D6B53;
  --color-accent: #C4834A;
  --color-accent-light: #F5E6D5;
  --color-text: #1F2D1F;
  --color-text-muted: #5A6B5A;
  --color-border: #DDD6CB;
  --color-nav-bg: #1A2518;
  --color-nav-text: #F0EDE8;
  --color-footer-bg: #1A2518;

  --font-heading: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Outfit', system-ui, -apple-system, sans-serif;

  --shadow-sm: 0 1px 3px rgba(31, 45, 31, 0.06);
  --shadow-md: 0 4px 16px rgba(31, 45, 31, 0.08);
  --shadow-lg: 0 8px 32px rgba(31, 45, 31, 0.1);
  --shadow-glow: 0 0 40px rgba(91, 138, 114, 0.15);

  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-xl: 2rem;
}

/* --- Dark Mode Tokens --- */
.dark {
  --color-bg: #0F160F;
  --color-surface: #1A221A;
  --color-primary: #7AAF94;
  --color-primary-dark: #5B8A72;
  --color-accent: #D99B66;
  --color-accent-light: #2A2018;
  --color-text: #E4DFD8;
  --color-text-muted: #8A9A8A;
  --color-border: #2D3A2D;
  --color-nav-bg: #0A100A;
  --color-nav-text: #E4DFD8;
  --color-footer-bg: #0A100A;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(122, 175, 148, 0.1);
}

/* --- Base Reset & Typography --- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  transition: background-color 0.4s ease, color 0.4s ease;
  line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.2;
}

/* --- Sticky Nav --- */
.nav-sticky {
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

/* --- Dropdown Animation --- */
.dropdown-enter {
  animation: dropIn 0.2s ease-out forwards;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Hero Overlay Gradient --- */
.hero-overlay {
  background: linear-gradient(
    135deg,
    rgba(26, 37, 24, 0.75) 0%,
    rgba(91, 138, 114, 0.55) 50%,
    rgba(196, 131, 74, 0.3) 100%
  );
}

.hero-overlay-interior {
  background: linear-gradient(
    180deg,
    rgba(26, 37, 24, 0.65) 0%,
    rgba(26, 37, 24, 0.8) 100%
  );
}

/* --- Step List (numbered items with circles) --- */
.step-list {
  counter-reset: step-counter;
  list-style: none;
  padding-left: 0;
}

.step-list > li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 1.5rem;
  min-height: 2.5rem;
}

.step-list > li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 2.25rem;
  height: 2.25rem;
  background-color: var(--color-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* --- Behavior Pattern Tables --- */
.behavior-section {
  margin-bottom: 2.5rem;
}

.behavior-section h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
}

.behavior-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background-color: var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.behavior-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  background-color: var(--color-bg);
}

.behavior-row:nth-child(even) {
  background-color: var(--color-surface);
}

.behavior-row .row-num {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-primary);
  min-width: 3rem;
}

.behavior-row .col-unhealthy,
.behavior-row .col-healthy {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.behavior-row .col-unhealthy {
  border-right: 1px solid var(--color-border);
}

.behavior-header {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  background-color: var(--color-primary);
  color: white;
  font-family: var(--font-heading);
  font-weight: 600;
}

.behavior-header > div {
  padding: 0.75rem 1rem;
}

@media (min-width: 768px) {
  .behavior-row,
  .behavior-header {
    grid-template-columns: 4rem 1fr 1fr;
  }

  .behavior-row .row-num {
    min-width: 4rem;
  }
}

/* --- Affirmation Cards --- */
.affirmation-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .affirmation-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.affirmation-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.affirmation-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.affirmation-card .aff-num {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* --- FAQ Accordion --- */
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.faq-item[open] {
  box-shadow: var(--shadow-sm);
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--color-surface);
  transition: background-color 0.2s ease;
}

.faq-item summary:hover {
  background-color: var(--color-accent-light);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary .faq-icon {
  transition: transform 0.2s ease;
}

.faq-item[open] summary .faq-icon {
  transform: rotate(180deg);
}

.faq-item .faq-content {
  padding: 1rem 1.25rem;
  line-height: 1.7;
  border-top: 1px solid var(--color-border);
}

/* --- Link Cards (homepage) --- */
.link-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.link-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* --- Section Divider --- */
.section-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-border) 50%,
    transparent 100%
  );
}

/* --- External Link Indicator --- */
.external-link::after {
  content: ' ↗';
  font-size: 0.75em;
}

/* --- Custom Selection --- */
::selection {
  background-color: var(--color-primary);
  color: white;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark);
}

/* --- Grain Overlay (subtle texture) --- */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}

.dark .grain-overlay {
  opacity: 0.04;
}

/* --- Print Styles --- */
@media print {
  .nav-sticky, footer, .grain-overlay {
    display: none !important;
  }
  body {
    background: white;
    color: black;
  }
}
