/* ============================================
   Maalaisjarki.com — Style System
   Aesthetic: Editorial / Refined Industrial
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* --- Custom Properties --- */
:root {
  /* Palette: Deep charcoal + warm copper accent */
  --color-bg: #f5f2ed;
  --color-bg-alt: #eae5dd;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-secondary: #5a5550;
  --color-accent: #b8652a;
  --color-accent-hover: #9e5522;
  --color-accent-light: rgba(184, 101, 42, 0.08);
  --color-dark: #1a1a1a;
  --color-dark-surface: #242220;
  --color-border: #d4cfc7;
  --color-border-light: #e8e4dc;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 8rem;

  /* Layout */
  --max-width: 1200px;
  --nav-height: 72px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-accent-hover);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  letter-spacing: -0.005em;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
}

h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}

p {
  max-width: 65ch;
}

.lead {
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--color-text-secondary);
}

/* --- Layout Utilities --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-2xl) 0;
}

.section--dark {
  background-color: var(--color-dark);
  color: #e8e4dc;
  position: relative;
  overflow: hidden;
}

.section--dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(184, 101, 42, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 30%, rgba(184, 101, 42, 0.08) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1' height='1' fill='%23ffffff' opacity='0.06'/%3E%3C/svg%3E");
  background-size: 100% 100%, 100% 100%, 4px 4px;
  pointer-events: none;
}

.section--dark::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: 10%;
  width: 500px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(184, 101, 42, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.section--dark h2,
.section--dark h3 {
  color: #f5f2ed;
}

.section--dark .lead,
.section--dark p {
  color: #a8a29e;
}

.section--dark h4 {
  color: var(--color-accent);
}

.section--alt {
  background-color: var(--color-bg-alt);
  position: relative;
}

.section--alt::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 0%, rgba(184, 101, 42, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 70% 100%, rgba(184, 101, 42, 0.07) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='0.8' fill='%23b8652a' opacity='0.12'/%3E%3C/svg%3E");
  background-size: 100% 100%, 100% 100%, 40px 40px;
  pointer-events: none;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(245, 242, 237, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-light);
  transition: background 0.3s ease;
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav__logo:hover {
  color: var(--color-accent);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.nav__links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--color-text);
}

.nav__links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
}

.nav__lang {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: var(--color-text-secondary);
  transition: all 0.2s ease;
}

.nav__lang:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Mobile menu */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 6px 0;
  transition: all 0.3s ease;
}

.nav__toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.nav__toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav__toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* --- Hero --- */
.hero {
  padding-top: calc(var(--nav-height) + var(--space-3xl));
  padding-bottom: var(--space-3xl);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(184, 101, 42, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 10% 85%, rgba(184, 101, 42, 0.08) 0%, transparent 40%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 30h60M30 0v60' stroke='%23d4cfc7' stroke-width='0.5' fill='none' opacity='0.4'/%3E%3C/svg%3E");
  background-size: 100% 100%, 100% 100%, 60px 60px;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  top: 10%;
  right: 5%;
  width: 400px;
  height: 400px;
  border: 1.5px solid rgba(184, 101, 42, 0.15);
  border-radius: 50%;
  box-shadow: 0 0 80px rgba(184, 101, 42, 0.06);
  pointer-events: none;
}

@media (max-width: 700px) {
  .hero::after {
    display: none;
  }
}

.hero__label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-accent);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
  display: inline-block;
}

.hero h1 {
  margin-bottom: var(--space-lg);
  max-width: 800px;
}

.hero h1 em {
  font-style: italic;
  color: var(--color-accent);
}

.hero .lead {
  max-width: 600px;
  margin-bottom: var(--space-xl);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.85rem 1.8rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
}

.btn--primary {
  background: var(--color-accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(184, 101, 42, 0.3);
}

.btn--outline {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn--outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn--dark {
  background: var(--color-dark);
  color: #f5f2ed;
}

.btn--dark:hover {
  background: #2d2a27;
  color: #f5f2ed;
}

.btn-group {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* --- Service Cards --- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.service-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  padding: var(--space-xl) var(--space-lg);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.service-card:hover {
  border-color: var(--color-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-card__icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  color: var(--color-accent);
}

.service-card__number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-accent);
  margin-bottom: var(--space-lg);
}

.service-card h3 {
  margin-bottom: var(--space-md);
}

.service-card p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

.service-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  background: var(--color-accent-light);
  color: var(--color-accent);
  border-radius: 3px;
}

/* --- Results / Stats --- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.result-item {
  text-align: center;
  padding: var(--space-xl) var(--space-lg);
}

.result-item__icon {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

.result-item h3 {
  margin-bottom: var(--space-sm);
  color: #f5f2ed;
}

.result-item p {
  color: #a8a29e;
  font-size: 0.9rem;
  margin: 0 auto;
}

/* --- Profile Image --- */
.profile-img {
  width: 100%;
  max-width: 320px;
  border-radius: 8px;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--color-border-light);
  opacity: 0.85;
  filter: brightness(1.1);
}

.about-intro .profile-img {
  float: right;
  max-width: 200px;
  margin: 0.3rem 0 var(--space-lg) var(--space-xl);
}

@media (max-width: 700px) {
  .about-intro .profile-img {
    float: none;
    max-width: 160px;
    margin: 0 0 var(--space-lg) 0;
  }
}

/* --- About Preview --- */
.about-preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
}

.about-preview__content h4 {
  margin-bottom: var(--space-sm);
}

.about-preview__content h2 {
  margin-bottom: var(--space-lg);
}

.about-preview__content p {
  margin-bottom: var(--space-lg);
  color: var(--color-text-secondary);
}

.about-preview__visual {
  position: relative;
}

.about-preview__card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  padding: var(--space-xl);
}

.experience-list {
  list-style: none;
}

.experience-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 0.95rem;
}

.experience-list li:last-child {
  border-bottom: none;
}

.experience-list__year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-accent);
  white-space: nowrap;
  min-width: 50px;
}

/* --- CTA Section --- */
.cta {
  text-align: center;
  padding: var(--space-3xl) 0;
}

.cta h2 {
  margin-bottom: var(--space-md);
}

.cta .lead {
  margin: 0 auto var(--space-xl);
}

/* --- Footer --- */
.footer {
  background: var(--color-dark);
  color: #a8a29e;
  padding: var(--space-xl) 0;
  border-top: 1px solid #2d2a27;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer__logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #f5f2ed;
}

.footer__links {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
}

.footer__links a {
  font-size: 0.85rem;
  color: #a8a29e;
}

.footer__links a:hover {
  color: #f5f2ed;
}

.footer__copy {
  font-size: 0.8rem;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid #2d2a27;
  text-align: left;
}

/* --- Page Header (inner pages) --- */
.page-header {
  padding-top: calc(var(--nav-height) + var(--space-2xl));
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border-light);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(184, 101, 42, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.page-header h4 {
  margin-bottom: var(--space-sm);
}

.page-header h1 {
  margin-bottom: var(--space-md);
}

.page-header .lead {
  max-width: 600px;
}

/* --- Services Page --- */
.service-detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.service-detail:last-child {
  border-bottom: none;
}

.service-detail__label h3 {
  margin-bottom: var(--space-sm);
}

.service-detail__label .service-card__number {
  display: block;
  margin-bottom: var(--space-sm);
}

.service-detail__content p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.service-detail__content ul {
  list-style: none;
  margin-bottom: var(--space-lg);
}

.service-detail__content li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
}

.service-detail__content li::before {
  content: '\2014';
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

/* --- About Page --- */
.about-intro {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-2xl);
  padding: var(--space-xl) 0;
}

.about-intro p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  max-width: none;
}

.about-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: 8px;
  padding: var(--space-lg);
  height: fit-content;
}

.about-sidebar h4 {
  margin-bottom: var(--space-md);
}

.about-sidebar ul {
  list-style: none;
}

.about-sidebar li {
  font-size: 0.9rem;
  padding: var(--space-sm) 0;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-light);
}

.about-sidebar li:last-child {
  border-bottom: none;
}

/* --- Publications Page --- */
.publication-item {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.publication-item:last-child {
  border-bottom: none;
}

.publication-item__meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.publication-item h3 {
  margin-bottom: var(--space-sm);
}

.publication-item p {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
}

/* --- Contact Page --- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  padding: var(--space-xl) 0;
}

.contact-info h3 {
  margin-bottom: var(--space-lg);
}

.contact-info__item {
  margin-bottom: var(--space-lg);
}

.contact-info__item h4 {
  margin-bottom: var(--space-xs);
}

.contact-info__item p {
  color: var(--color-text-secondary);
}

.contact-info__item a {
  font-weight: 500;
}

.contact-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--color-text);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s ease;
  margin-bottom: var(--space-md);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.contact-form textarea {
  min-height: 160px;
  resize: vertical;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0.1s; }
.animate-in:nth-child(2) { animation-delay: 0.2s; }
.animate-in:nth-child(3) { animation-delay: 0.3s; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .services-grid,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .about-preview {
    grid-template-columns: 1fr;
  }

  .service-detail {
    grid-template-columns: 1fr;
  }

  .about-intro {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .footer__inner {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }
}

@media (max-width: 700px) {
  .nav__links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(245, 242, 237, 0.98);
    backdrop-filter: blur(12px);
    padding: var(--space-lg);
    gap: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
  }

  .nav__links.open {
    display: flex;
  }

  .nav__toggle {
    display: block;
  }

  .hero {
    padding-top: calc(var(--nav-height) + var(--space-xl));
    padding-bottom: var(--space-xl);
  }

  .section {
    padding: var(--space-xl) 0;
  }
}
