/*
Theme Name: URALIC Keskus
Theme URI: https://uralic.org
Author: URALIC Centre
Author URI: https://uralic.org
Description: Custom WordPress theme for URALIC Centre - Indigenous peoples' rights organization focusing on Uralic (Finno-Ugric and Samoyed) peoples' linguistic and cultural rights.
Version: 2.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: uralic
Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  /* Brand & Background */
  --color-bg: #F6F1EB;
  --color-bg-dark: #1A1410;
  --color-brand-green: #BAE3B7;
  --color-brand-green-light: #ddf2db;

  /* Text */
  --color-text: #1A1410;
  --color-text-light: #F6F1EB;
  --color-text-primary: #1A1410;
  --color-text-secondary: #8B7E74;
  --color-text-muted: #8B7E74;
  --color-text-inverse: #F6F1EB;

  /* Accents */
  --color-accent: #BAE3B7;
  --color-accent-warm: #a0d69c;
  --color-accent-deep: #3D8B5E;

  /* Borders */
  --color-border: rgba(26, 20, 16, 0.12);
  --color-border-dark: rgba(26, 20, 16, 0.2);

  /* Typography */
  --font-heading: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-primary: var(--font-body);

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 5rem;
  --spacing-3xl: 8rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 12px 40px rgb(0 0 0 / 0.12);

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Transitions */
  --transition-fast: 200ms var(--ease-out);
  --transition-base: 400ms var(--ease-out);
  --transition-slow: 800ms var(--ease-out);

  /* Container */
  --container-max-width: 1400px;
  --container-padding: 3rem;

  /* Header */
  --header-height: 80px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: var(--font-weight-light);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-normal);
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: var(--spacing-md);
}

h1 { font-size: clamp(2.5rem, 6vw, 5rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 3.2rem); }
h3 { font-size: clamp(1.3rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.15rem; }

h2 em, h1 em {
  font-style: italic;
  color: var(--color-brand-green);
}

.section-light h2 em,
.mission-section h2 em {
  color: var(--color-text);
}

p {
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover, a:focus {
  color: var(--color-accent-deep);
}

strong { font-weight: var(--font-weight-medium); }

/* ============================================
   LAYOUT
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.section {
  padding: var(--spacing-3xl) 0;
}

.section-light {
  background-color: var(--color-bg);
  color: var(--color-text);
}

.section-dark {
  background-color: var(--color-bg-dark);
  color: var(--color-text-light);
}

.section-dark h2,
.section-dark h3,
.section-dark h4 {
  color: var(--color-text-light);
}

.section-accent {
  background: var(--color-bg-dark);
  color: var(--color-text-light);
}

/* ============================================
   EYEBROW / LABEL
   ============================================ */
.section-eyebrow {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-eyebrow::before {
  content: '';
  width: 40px;
  height: 1px;
  background: currentColor;
}

.section-eyebrow.light::before {
  background: var(--color-brand-green);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2.5rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--color-brand-green);
  color: var(--color-text-light);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base), gap var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  background: var(--color-brand-green);
  color: var(--color-bg-dark);
  gap: 1.1rem;
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand-green);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-brand-green);
  color: var(--color-bg-dark);
  border-color: var(--color-brand-green);
}

.btn-primary:hover {
  background-color: #a0d69c;
  border-color: #a0d69c;
  color: var(--color-bg-dark);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-text);
}

.btn-outline:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.btn-outline-light {
  background: transparent;
  color: var(--color-text-light);
  border-color: rgba(246, 241, 235, 0.4);
}

.btn-outline-light:hover {
  background: var(--color-text-light);
  color: var(--color-bg-dark);
}

.btn-green {
  background: var(--color-brand-green);
  color: var(--color-bg-dark);
  border-color: var(--color-brand-green);
}

.btn-green:hover {
  background: #a0d69c;
  border-color: #a0d69c;
  color: var(--color-bg-dark);
}

.btn svg {
  width: 14px;
  height: 14px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.5s var(--ease-out), border-color 0.5s, box-shadow 0.5s;
  text-decoration: none;
  color: var(--color-text);
}

/* Cards with white background and subtle shadow */
.section-light .card,
.section-bg-light .card,
.section-dark .card,
.archive-content .card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
}

.section-light .card:hover,
.section-bg-light .card:hover,
.section-dark .card:hover,
.archive-content .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.04);
  border-color: rgba(186, 227, 183, 0.4);
}

/* Dark section card text needs dark color */
.section-dark .card {
  color: var(--color-text);
}

.section-dark .card .card-title a {
  color: var(--color-text);
}

.section-dark .card .card-description {
  color: var(--color-text-secondary);
}

.section-dark .card .card-link {
  color: var(--color-accent-deep);
}

.section-dark .card .card-badge {
  color: var(--color-accent-deep);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(186, 227, 183, 0.3);
}

.card-image-wrapper {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s var(--ease-out);
  filter: saturate(0.85);
}

.card:hover .card-image {
  transform: scale(1.06);
  filter: saturate(1);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26,20,16,0.5), transparent);
  transition: opacity var(--transition-base);
}

/* Homepage projects section: text-only cards */
.projects-section .card-content {
  padding: 1.5rem;
}

/* Single-project "other projects" section: stacked card */
.other-projects-section .card-image-wrapper {
  display: block;
  height: 200px;
  overflow: hidden;
  background: #fff;
}

.other-projects-section .card-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1.5rem;
}

.other-projects-section .card-overlay {
  display: none;
}

.other-projects-section .card:hover .card-image {
  transform: none;
}

/* Project archive: vertical card — logo image top, text below */
.post-type-archive-project .card {
  flex-direction: column;
}

.post-type-archive-project .card-image-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  background: #f9f9f7;
}

.post-type-archive-project .card-image {
  object-fit: cover;
  padding: 0;
}

.post-type-archive-project .card-overlay {
  display: block;
}

.post-type-archive-project .card:hover .card-image {
  transform: scale(1.04);
  filter: saturate(0.9);
}

.post-type-archive-project .card-content {
  justify-content: flex-start;
}

.card-content {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.card-date {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.card-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent-deep);
  background: rgba(61, 139, 94, 0.08);
  border: 1px solid rgba(61, 139, 94, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.card-foot {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.card-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-accent-deep);
  margin-bottom: 0.75rem;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: var(--font-weight-normal);
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-description {
  font-size: 0.85rem;
  font-weight: var(--font-weight-light);
  color: var(--color-text-secondary);
  line-height: 1.6;
  flex: 1;
}

.card-foot .card-link {
  margin-top: 0;
  width: 100%;
  justify-content: center;
}

.hp-proj-card-foot .hp-card-arrow {
  width: 100%;
  justify-content: center;
}

.card-link,
.hp-card-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: var(--font-weight-medium);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text);
  padding: 0.45rem 1rem;
  border: 1px solid var(--color-brand-green);
  border-radius: var(--radius-full);
  transition: gap var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.card-link { margin-top: 1rem; }
.card-foot .card-link,
.hp-proj-card-foot .hp-card-arrow { margin-top: 0; }

.card-link:hover,
.hp-proj-card:hover .hp-card-arrow {
  gap: 0.75rem;
  background: var(--color-brand-green);
  color: var(--color-bg-dark);
}

/* Clickable card (entire card is a link) */
a.card-clickable {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

a.card-clickable:hover {
  color: var(--color-text);
}

a.card-clickable:hover .card-link {
  gap: 0.75rem;
  background: var(--color-brand-green);
  color: var(--color-bg-dark);
}

/* ============================================
   GRID
   ============================================ */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }

/* Section header — centered eyebrow + title + subtitle */
.section-header {
  margin-bottom: var(--spacing-xl);
}

.section-header .section-eyebrow {
  justify-content: center;
}

.section-header-narrow {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--spacing-xl);
}

.section-header-narrow .section-eyebrow {
  justify-content: center;
}

/* ============================================
   REVEAL ANIMATIONS
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Backward compat */
.fade-up { opacity: 0; transform: translateY(30px); transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out); }
.fade-up.is-visible { opacity: 1; transform: translateY(0); }

/* ============================================
   ACCESSIBILITY
   ============================================ */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-brand-green);
  color: var(--color-bg-dark);
  padding: 0.75rem 1rem;
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  z-index: 100000;
}

.skip-link:focus { top: 0; }

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  word-wrap: normal !important;
}

:focus-visible {
  outline: 2px solid var(--color-brand-green);
  outline-offset: 2px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  :root {
    --container-padding: 2rem;
    --spacing-3xl: 5rem;
  }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --container-padding: 1.5rem;
    --spacing-3xl: 4rem;
    --spacing-2xl: 3rem;
  }
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  :root {
    --container-padding: 1.25rem;
  }
}
