/*
 * global.css — CGR · DAD Partnership Portal
 * Shared design tokens, reset, nav, footer, animations
 * Author: Oren Gal — 2026 · cgr-dad.com
 */

/* ——— Design Tokens ——— */
:root {
  --bg: #fbf8f1;
  --surface: #ffffff;
  --tint: #fdfaf3;
  --tan: #ece2cd;
  --tan-bd: #ddd0b3;
  --ink: #1e1d1a;
  --ink2: #504c46;
  --muted: #837e74;
  --line: #e8e1d1;
  --line2: #d9d1bf;
  --green: #1f4d3c;
  --green2: #163b2d;
  --green-soft: #e9f0ea;
  --pos: #2c7a52;
  --caution: #b07a1e;
  --caution-bg: #fbf0d8;
  --bad: #b0402f;
  --bad-bg: #f8ebe7;
  --serif: 'Fraunces', 'Frank Ruhl Libre', Georgia, serif;
  --sans: 'Assistant', 'Heebo', -apple-system, 'Segoe UI', sans-serif;

  /* Elevation */
  --shadow-rest: 0 1px 2px rgba(40, 36, 28, .04), 0 0 0 1px rgba(40, 36, 28, .015);
  --shadow-raised: 0 4px 14px rgba(31, 77, 60, .07), 0 1.5px 4px rgba(31, 77, 60, .04);
  --shadow-hover: 0 12px 32px rgba(31, 77, 60, .11), 0 4px 8px rgba(31, 77, 60, .05);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.28s;
  --dur-slow: 0.5s;
}

/* ——— Reset & Base ——— */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
html { background: var(--bg) }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Paper grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

a { color: inherit; text-decoration: none }
::selection { background: rgba(31, 77, 60, .14) }

:focus-visible {
  outline: 2.5px solid var(--green);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ——— Entrance Animations ——— */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(18px) }
  to   { opacity: 1; transform: translateY(0) }
}

@keyframes revealDown {
  from { opacity: 0; transform: translateY(-10px) }
  to   { opacity: 1; transform: translateY(0) }
}

/* ——— Navigation ——— */
.nav {
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 241, .88);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 1px 3px rgba(40, 36, 28, .03);
  position: sticky;
  top: 0;
  z-index: 20;
  animation: revealDown 0.6s var(--ease) both;
}

.nav-in {
  max-width: 660px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.01em;
  transition: opacity var(--dur) var(--ease);
}

.brand:hover { opacity: 0.78 }

.brand .mk {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--green);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 1px 4px rgba(31, 77, 60, .25);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.brand:hover .mk {
  transform: scale(1.06);
  box-shadow: 0 2px 8px rgba(31, 77, 60, .3);
}

.brand .mk svg { width: 16px; height: 16px; display: block }

/* Back button — shared across sub-pages */
.back-btn {
  cursor: pointer;
  color: var(--green);
  background: transparent;
  border: 1.5px solid var(--line2);
  border-radius: 9px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.back-btn:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(31, 77, 60, .22);
}

.back-btn:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(31, 77, 60, .18) }
[dir="rtl"] .back-btn svg { transform: scaleX(-1) }

/* ——— Nav Actions (shared: lang toggle + back button) ——— */
.nav-actions { display: flex; align-items: center; gap: 8px }

.lang-btn {
  font: 700 13px var(--sans);
  cursor: pointer;
  color: var(--green);
  background: transparent;
  border: 1.5px solid var(--line2);
  border-radius: 9px;
  padding: 7px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  letter-spacing: .01em;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.lang-btn:hover {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(31, 77, 60, .22);
}

.lang-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(31, 77, 60, .18);
}

/* ——— Main Content ——— */
main {
  max-width: 660px;
  margin: 0 auto;
  padding: 32px 20px 16px;
  width: 100%;
  flex: 1;
}

h1 {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.08;
  animation: revealUp 0.7s var(--ease) 0.06s both;
}

.lede {
  color: var(--ink2);
  font-size: 17px;
  margin-top: 12px;
  max-width: 54ch;
  line-height: 1.6;
  animation: revealUp 0.7s var(--ease) 0.12s both;
}

/* ——— Footer ——— */
.site-footer {
  background: var(--green);
  color: #d8e4dc;
  margin-top: 36px;
  padding: 36px 20px;
  animation: revealUp 0.8s var(--ease) 0.44s both;
}

.ft-in { max-width: 660px; margin: 0 auto }

.ft-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  letter-spacing: -.01em;
}

.ft-brand .mk {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .13);
  display: grid;
  place-items: center;
}

.ft-brand .mk svg { width: 16px; height: 16px }

.ft-desc {
  font-size: 14px;
  margin-top: 14px;
  max-width: 50ch;
  color: rgba(255, 255, 255, .6);
  line-height: 1.6;
}

.ft-meta {
  margin-top: 20px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .38);
  letter-spacing: .01em;
}

/* ——— Shared Responsive ——— */
@media (max-width: 680px) {
  .nav-in, .ft-in, main { max-width: 100% }
}

@media (max-width: 500px) {
  h1 { font-size: clamp(24px, 7vw, 29px) }
  .lede { font-size: 15px }
  main { padding: 22px 16px 12px }
  .site-footer { padding: 28px 16px }
}

@media (max-width: 380px) {
  h1 { font-size: 22px }
  .brand { font-size: 17px }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .brand:hover .mk { transform: none }
  body::after { display: none }
}
