/* ============================================================
   ferrer.ch — Style v2
   More visual punch · Dramatic hero · Texture & depth
   ============================================================ */

:root {
  --color-bg: #F5F0EB;
  --color-bg-alt: #EDE7DF;
  --color-bg-dark: #1A1A2E;
  --color-text: #1A1A2E;
  --color-text-muted: #5A5A6E;
  --color-gold: #C9963B;
  --color-gold-light: #D4A84E;
  --color-gold-glow: rgba(201, 150, 59, 0.15);
  --color-steel: #3A506B;
  --color-teal: #5C8A8A;
  --color-white: #FDFBF8;
  --color-border: #D8D0C6;
  --font-heading: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
  --max-width: 820px;
  --section-padding: clamp(5rem, 12vh, 9rem);
  --side-padding: clamp(1.5rem, 5vw, 3rem);
  --transition: 0.3s ease;
  --transition-slow: 0.6s ease;
}

.dark-mode {
  --color-bg: #1A1A2E;
  --color-bg-alt: #22223A;
  --color-text: #E8E2DA;
  --color-text-muted: #A09A90;
  --color-white: #2A2A3E;
  --color-border: #3A3A4E;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; font-size:100%; -webkit-text-size-adjust:100%; }

body {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--color-gold); color: var(--color-white); }
img { max-width:100%; height:auto; display:block; }

a {
  color: var(--color-steel);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), color var(--transition);
}
a:hover, a:focus { color: var(--color-gold); border-bottom-color: var(--color-gold); }

h1,h2,h3,h4 { font-family: var(--font-heading); font-weight:700; line-height:1.25; color: var(--color-text); }
h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom:1rem; }
h3 { font-size: clamp(1.3rem, 2.5vw, 1.6rem); margin-bottom:0.75rem; }
p { margin-bottom:1.25rem; }
p:last-child { margin-bottom:0; }

blockquote {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  border-left: 3px solid var(--color-gold);
  padding-left: 1.5rem;
  margin: 2rem 0;
}

/* Grain texture */
body::after {
  content: '';
  position: fixed;
  top:0; left:0; width:100%; height:100%;
  pointer-events: none;
  z-index: 9999;
  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.9' 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;
  background-size: 256px;
}

/* ===== NAVIGATION ===== */
.nav {
  position:fixed; top:0; left:0; right:0; z-index:1000;
  padding: 0 var(--side-padding);
  background: rgba(245,240,235,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  transition: transform 0.4s ease;
}
.dark-mode .nav { background: rgba(26,26,46,0.85); }
.nav--hidden { transform: translateY(-100%); }

.nav__inner {
  max-width:1100px; margin:0 auto;
  display:flex; align-items:center; justify-content:space-between; height:64px;
}

.nav__logo {
  font-family: var(--font-heading);
  font-size:1.35rem; font-weight:700; color: var(--color-text);
  border:none; letter-spacing:0.02em;
}
.nav__logo:hover { color: var(--color-gold); border:none; }

.nav__links { display:flex; align-items:center; gap:2rem; list-style:none; }
.nav__links a {
  font-size:0.85rem; font-weight:600; letter-spacing:0.06em;
  text-transform:uppercase; color: var(--color-text-muted);
  border:none; position:relative; padding-bottom:4px;
}
.nav__links a::after {
  content:''; position:absolute; bottom:0; left:0;
  width:0; height:2px; background: var(--color-gold);
  transition: width var(--transition);
}
.nav__links a:hover, .nav__links a.active { color: var(--color-text); border:none; }
.nav__links a:hover::after, .nav__links a.active::after { width:100%; }

.nav__dark-toggle {
  background:none; border:1px solid var(--color-border); border-radius:50%;
  width:36px; height:36px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  font-size:1rem; color: var(--color-text-muted);
  transition: all var(--transition);
}
.nav__dark-toggle:hover {
  border-color: var(--color-gold); color: var(--color-gold);
  box-shadow: 0 0 12px var(--color-gold-glow);
}

.nav__hamburger {
  display:none; background:none; border:none; cursor:pointer;
  width:36px; height:36px; position:relative; z-index:1001;
}
.nav__hamburger span {
  display:block; width:22px; height:2px; background: var(--color-text);
  margin:5px auto; transition: all 0.3s ease; border-radius:1px;
}
.nav__hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav__hamburger.open span:nth-child(2) { opacity:0; }
.nav__hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* ===== HERO — DARK & DRAMATIC ===== */
.hero {
  min-height:100vh;
  display:flex; flex-direction:column; justify-content:center; align-items:center;
  text-align:center;
  padding: 6rem var(--side-padding) 4rem;
  position:relative; overflow:hidden;
  background: var(--color-bg-dark);
  color: #E8E2DA;
}

.hero::before {
  content:''; position:absolute; top:0; left:0; right:0; bottom:0;
  background:
    radial-gradient(ellipse at 25% 20%, rgba(201,150,59,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 80%, rgba(58,80,107,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(92,138,138,0.06) 0%, transparent 70%);
  pointer-events:none; z-index:1;
}

.hero::after {
  content:''; position:absolute; top:0; left:0; right:0; bottom:0;
  background-image:
    linear-gradient(rgba(201,150,59,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,150,59,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events:none; z-index:1;
}

.hero > * { position:relative; z-index:2; }

.hero__rule {
  width:80px; height:3px; background: var(--color-gold); border:none;
  margin-bottom:2rem;
  animation: expandRule 1s ease 0.3s both;
}
@keyframes expandRule { from { width:0; opacity:0; } to { width:80px; opacity:1; } }

.hero__name {
  font-family: var(--font-heading);
  font-size: clamp(3.2rem, 10vw, 6rem);
  font-weight:700; letter-spacing:-0.02em;
  margin-bottom:0.3rem; color:#FDFBF8;
  animation: fadeInUp 0.8s ease 0.5s both;
}

.hero__phd {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight:400; font-style:italic;
  color: var(--color-gold);
  margin-bottom:1.5rem; letter-spacing:0.05em;
  animation: fadeInUp 0.8s ease 0.7s both;
}

.hero__tagline {
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight:400; color: rgba(232,226,218,0.7);
  max-width:600px; line-height:1.6; margin-bottom:2.5rem;
  animation: fadeInUp 0.8s ease 0.9s both;
}

.hero__scroll-hint {
  position:absolute; bottom:2.5rem; left:50%;
  transform:translateX(-50%);
  display:flex; flex-direction:column; align-items:center; gap:0.5rem;
  color: rgba(232,226,218,0.4);
  font-size:0.75rem; letter-spacing:0.15em; text-transform:uppercase;
  animation: gentleBounce 2.5s ease-in-out infinite, fadeIn 1s ease 1.5s both;
  z-index:2;
}
.hero__scroll-hint svg { width:20px; height:20px; stroke: var(--color-gold); opacity:0.6; }

@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes gentleBounce {
  0%,100% { transform:translateX(-50%) translateY(0); }
  50% { transform:translateX(-50%) translateY(6px); }
}

/* Dark-to-light transition */
.hero-transition {
  height:120px;
  background: linear-gradient(to bottom, var(--color-bg-dark), var(--color-bg));
  margin-top:-1px;
}

/* ===== SECTIONS ===== */
.section { padding: var(--section-padding) var(--side-padding); position:relative; }
.section--alt { background: var(--color-bg-alt); }

.section--alt::before {
  content:''; position:absolute; top:0; left:50%; transform:translateX(-50%);
  width:60px; height:3px; background: var(--color-gold); opacity:0.4;
}

.section__inner { max-width: var(--max-width); margin:0 auto; }

.section__label {
  font-family: var(--font-body);
  font-size:0.78rem; font-weight:700; letter-spacing:0.18em;
  text-transform:uppercase; color: var(--color-gold); margin-bottom:0.5rem;
}

.section__title {
  margin-bottom:2.5rem; position:relative; display:inline-block;
}
.section__title::after {
  content:''; display:block; width:50px; height:3px;
  background: var(--color-gold); margin-top:0.75rem;
  transition: width var(--transition-slow);
}

/* ===== STORY CHAPTERS ===== */
.story-chapter {
  margin-bottom:3.5rem; padding-bottom:3rem;
  border-bottom:1px solid var(--color-border); position:relative;
}
.story-chapter:last-child { border-bottom:none; margin-bottom:0; padding-bottom:0; }

.story-chapter__number {
  font-family: var(--font-heading);
  font-size: clamp(4rem, 8vw, 5.5rem);
  font-weight:700; line-height:1; margin-bottom:0.25rem;
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text; opacity:0.3;
}

.story-chapter h3 {
  font-family: var(--font-heading);
  font-style:italic; font-weight:400; color: var(--color-steel);
  font-size: clamp(1.25rem, 2.5vw, 1.5rem); margin-bottom:1.25rem;
}

/* ===== PROJECT CARDS ===== */
.projects-grid { display:grid; grid-template-columns:1fr; gap:1.5rem; margin-top:2.5rem; }

.project-card {
  background: var(--color-white);
  border:1px solid var(--color-border); border-radius:12px;
  padding: 2rem 2rem 1.75rem;
  transition: all var(--transition-slow);
  position:relative; overflow:hidden;
}

.project-card::before {
  content:''; position:absolute; top:0; left:0;
  width:4px; height:100%;
  background: linear-gradient(to bottom, var(--color-gold), var(--color-teal));
  transform:scaleY(0); transform-origin:bottom;
  transition: transform 0.5s ease;
}

.project-card::after {
  content:''; position:absolute; top:-50%; right:-50%;
  width:100%; height:100%;
  background: radial-gradient(circle, var(--color-gold-glow) 0%, transparent 70%);
  opacity:0; transition: opacity var(--transition-slow); pointer-events:none;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(26,26,46,0.08), 0 0 0 1px var(--color-gold-glow);
  border-color: rgba(201,150,59,0.3);
}
.project-card:hover::before { transform:scaleY(1); }
.project-card:hover::after { opacity:1; }

.project-card__icon { font-size:2rem; margin-bottom:0.75rem; position:relative; z-index:1; }
.project-card h3 {
  font-family: var(--font-heading); color: var(--color-text);
  margin-bottom:0.5rem; font-size:1.35rem; position:relative; z-index:1;
}

.project-card__tag {
  display:inline-block; font-size:0.7rem; font-weight:700;
  letter-spacing:0.1em; text-transform:uppercase;
  color: var(--color-gold); background: var(--color-gold-glow);
  padding:0.25rem 0.7rem; border-radius:3px; margin-bottom:1rem;
  position:relative; z-index:1;
}

.project-card p { color: var(--color-text-muted); font-size:1rem; position:relative; z-index:1; }
.project-card__placeholder { font-style:italic; color: var(--color-teal); font-size:0.95rem; }

.project-card__link {
  display:inline-flex; align-items:center; gap:0.4rem;
  margin-top:1rem; font-weight:600; font-size:0.9rem;
  color: var(--color-steel); border:none; position:relative; z-index:1;
}
.project-card__link:hover { color: var(--color-gold); border:none; }
.project-card__link svg { width:16px; height:16px; transition: transform var(--transition); }
.project-card__link:hover svg { transform:translateX(4px); }

/* ===== PUBLICATIONS ===== */
.publication {
  padding:1.5rem 0; border-bottom:1px solid var(--color-border);
  transition: all var(--transition); position:relative;
}
.publication:hover { padding-left:1rem; }
.publication:last-child { border-bottom:none; }

.publication__year {
  font-family: var(--font-heading);
  font-size:0.85rem; font-weight:700; color: var(--color-gold);
  letter-spacing:0.05em;
}
.publication__title { font-weight:600; color: var(--color-text); margin-top:0.35rem; font-size:1.05rem; }
.publication__authors { font-size:0.95rem; color: var(--color-text-muted); margin-top:0.15rem; }
.publication__venue { font-size:0.9rem; font-style:italic; color: var(--color-text-muted); margin-top:0.1rem; }

.profiles-links { display:flex; flex-wrap:wrap; gap:1rem; margin-top:2.5rem; }
.profiles-links a {
  display:inline-flex; align-items:center; gap:0.5rem;
  padding:0.65rem 1.3rem; border:1px solid var(--color-border);
  border-radius:8px; font-size:0.9rem; font-weight:600;
  color: var(--color-steel); transition: all var(--transition);
}
.profiles-links a:hover {
  border-color: var(--color-gold); color: var(--color-gold);
  background: var(--color-gold-glow);
  box-shadow: 0 4px 16px rgba(201,150,59,0.1);
  transform: translateY(-2px);
}
.profiles-links a svg { width:18px; height:18px; }

/* ===== TOOLBOX ===== */
.toolbox-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:2.5rem; margin-top:2.5rem; }

.toolbox-category h3 {
  font-family: var(--font-heading);
  font-size:1.15rem; color: var(--color-steel);
  margin-bottom:1rem; display:flex; align-items:center; gap:0.5rem;
}
.toolbox-category h3 span { font-size:1.3rem; }
.toolbox-tags { display:flex; flex-wrap:wrap; gap:0.5rem; }

.toolbox-tag {
  font-size:0.85rem; font-weight:500;
  padding:0.35rem 0.85rem;
  background: var(--color-white); border:1px solid var(--color-border);
  border-radius:20px; color: var(--color-text-muted);
  transition: all var(--transition); cursor:default;
}
.toolbox-tag:hover {
  border-color: var(--color-gold); color: var(--color-gold);
  background: var(--color-gold-glow);
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(201,150,59,0.1);
}

/* ===== THE HUMAN ===== */
.human-content { display:grid; grid-template-columns:1fr; gap:2rem; }

.human-quote {
  text-align:center; margin:3rem 0; padding:3rem 2rem;
  position:relative; background: var(--color-bg-alt); border-radius:12px;
}
.human-quote::before {
  content:'\201C'; position:absolute; top:-0.15em; left:50%;
  transform:translateX(-50%);
  font-family: var(--font-heading); font-size:8rem;
  color: var(--color-gold); opacity:0.15; line-height:1; pointer-events:none;
}
.human-quote blockquote {
  border-left:none; padding-left:0;
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  color: var(--color-text); max-width:550px;
  margin:0 auto; position:relative; z-index:1;
}

/* ===== CONTACT — DARK ===== */
.contact-section {
  text-align:center;
  background: var(--color-bg-dark); color:#E8E2DA;
  position:relative; overflow:hidden;
}
.contact-section::before {
  content:''; position:absolute; top:0; left:0; right:0; bottom:0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(201,150,59,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 30%, rgba(58,80,107,0.1) 0%, transparent 50%);
  pointer-events:none;
}
.contact-section > .section__inner { position:relative; z-index:1; }
.contact-section .section__label { color: var(--color-gold); }
.contact-section .section__title { color:#FDFBF8; }
.contact-section .section__title::after { margin-left:auto; margin-right:auto; }
.contact-section p { color: rgba(232,226,218,0.7); max-width:500px; margin-left:auto; margin-right:auto; }

.contact-email {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  color: var(--color-gold);
  border-bottom:2px solid rgba(201,150,59,0.3);
  padding-bottom:4px; display:inline-block; margin:2rem 0;
  transition: all var(--transition);
}
.contact-email:hover {
  color: var(--color-gold-light);
  border-bottom-color: var(--color-gold);
  text-shadow: 0 0 30px rgba(201,150,59,0.3);
}

.contact-links { display:flex; justify-content:center; flex-wrap:wrap; gap:1.5rem; margin-top:1.5rem; }
.contact-links a {
  display:inline-flex; align-items:center; gap:0.4rem;
  font-size:0.95rem; font-weight:600; color: rgba(232,226,218,0.6); border:none;
  transition: all var(--transition);
}
.contact-links a:hover { color: var(--color-gold); border:none; }

.contact-transition {
  height:80px;
  background: linear-gradient(to bottom, var(--color-bg), var(--color-bg-dark));
}

/* ===== FOOTER ===== */
.footer {
  text-align:center; padding:2rem var(--side-padding);
  background: var(--color-bg-dark);
  font-size:0.85rem; color: rgba(232,226,218,0.4);
}
.footer a { color: rgba(232,226,218,0.5); }
.footer a:hover { color: var(--color-gold); }

/* ===== CV BUTTON ===== */
.btn-cv {
  display:inline-flex; align-items:center; gap:0.5rem;
  padding:0.75rem 1.6rem; border:2px solid var(--color-gold);
  border-radius:8px; font-family: var(--font-body);
  font-weight:700; font-size:0.9rem; color: var(--color-gold);
  letter-spacing:0.04em; transition: all var(--transition);
}
.btn-cv:hover {
  background: var(--color-gold); color: var(--color-bg-dark);
  border-color: var(--color-gold); border-bottom-color: var(--color-gold);
  box-shadow: 0 4px 20px rgba(201,150,59,0.25);
  transform: translateY(-2px);
}
.btn-cv svg { width:16px; height:16px; }

/* ===== SCROLL ANIMATIONS ===== */
.reveal { opacity:0; transform:translateY(28px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.visible { opacity:1; transform:translateY(0); }

.reveal-children > * { opacity:0; transform:translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal-children.visible > *:nth-child(1) { transition-delay:0s; }
.reveal-children.visible > *:nth-child(2) { transition-delay:0.15s; }
.reveal-children.visible > *:nth-child(3) { transition-delay:0.3s; }
.reveal-children.visible > *:nth-child(4) { transition-delay:0.45s; }
.reveal-children.visible > * { opacity:1; transform:translateY(0); }

/* ===== RESPONSIVE ===== */
@media (min-width:700px) { .projects-grid { grid-template-columns:repeat(3,1fr); } }

@media (max-width:768px) {
  .nav__links {
    position:fixed; top:0; right:0; bottom:0; width:280px;
    background: var(--color-bg);
    flex-direction:column; justify-content:center; padding:2rem; gap:1.5rem;
    transform:translateX(100%); transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1); z-index:999;
  }
  .nav__links.open { transform:translateX(0); }
  .nav__hamburger { display:block; }
  .nav__dark-toggle { order:-1; }
  .toolbox-grid { grid-template-columns:1fr; }
  .projects-grid { grid-template-columns:1fr; }
  .hero__name { font-size: clamp(2.5rem, 12vw, 3.5rem); }
  .hero-transition { height:60px; }
  .contact-transition { height:40px; }
  .human-quote { padding:2rem 1.5rem; }
  .human-quote::before { font-size:5rem; }
}

.nav__overlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background: rgba(26,26,46,0.4); z-index:998;
  opacity:0; pointer-events:none; transition: opacity 0.3s ease;
}
.nav__overlay.active { opacity:1; pointer-events:all; }

@media print {
  .nav, .hero__scroll-hint, .nav__dark-toggle, .hero-transition, .contact-transition { display:none; }
  .hero { min-height:auto; background:white; color:black; padding:3rem 0; }
  .hero__name { color:black; }
  .contact-section { background:white; color:black; }
  .section { padding:2rem 0; }
  .reveal, .reveal-children > * { opacity:1; transform:none; }
}
