/* ==========================================================================
   Perla Makhoul — researcher site
   Palette: very light ochre ground, soft pastel accents, zero rules/gridlines.
   Type:    Fraunces (serif titles) + Figtree (sans body)
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  /* ground */
  --bg:        #faf4e7;
  --bg-deep:   #f3e9d5;
  --surface:   #fffdf8;
  --surface-2: #f7f0e2;

  /* ink */
  --ink:       #332f29;
  --ink-soft:  #6d665b;
  --ink-faint: #9b9384;

  /* pastels */
  --ochre:  #c89a52;
  --rose:   #e3b6ae;
  --sage:   #b3c6ab;
  --lilac:  #c7bbdb;
  --sky:    #aec8d6;
  --clay:   #d9b08c;

  --accent:      #a8763f;
  --accent-soft: #f0e0c6;

  --shadow-sm: 0 2px 10px -6px rgba(90, 70, 40, .35);
  --shadow:    0 18px 40px -30px rgba(90, 70, 40, .75);
  --shadow-lg: 0 30px 60px -35px rgba(90, 70, 40, .65);

  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans:  "Figtree", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --r-sm: 10px;
  --r:    18px;
  --r-lg: 28px;

  --ease: cubic-bezier(.22, .68, .3, 1);
}

/* alternate palettes, toggled by the floating palette button */
:root[data-palette="rose"] {
  --bg: #fbf1ec; --bg-deep: #f6e3dc; --surface: #fffcfa; --surface-2: #f9ece6;
  --accent: #b16a63; --accent-soft: #f3ded8; --ochre: #cf9a8e;
}
:root[data-palette="sage"] {
  --bg: #f3f5ec; --bg-deep: #e6ecdd; --surface: #fdfefa; --surface-2: #eef2e5;
  --accent: #6f8a63; --accent-soft: #e2ead9; --ochre: #96ad86;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.72;
  font-weight: 380;
  letter-spacing: .006em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
figure, figcaption { margin: 0; }   /* UA default is 1em 40px — it breaks every figure */
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- ambient drifting blobs ---------- */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient span {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(80px); opacity: .3;
  animation: drift 34s var(--ease) infinite alternate;
}
.ambient span:nth-child(1) { width: 30vw; height: 30vw; left: -6vw;  top: 8vh;  background: var(--rose);  animation-duration: 38s; }
.ambient span:nth-child(2) { width: 26vw; height: 26vw; right: -5vw; top: 30vh; background: var(--sage);  animation-duration: 46s; animation-delay: -8s; }
.ambient span:nth-child(3) { width: 22vw; height: 22vw; left: 45vw;  top: 72vh; background: var(--lilac); animation-duration: 52s; animation-delay: -20s; }
.ambient span:nth-child(4) { width: 18vw; height: 18vw; right: 18vw; top: -6vh; background: var(--clay);  animation-duration: 41s; animation-delay: -14s; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vw, -6vh, 0) scale(1.18); }
}

/* reading progress — a soft ochre wash, not a rule */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--rose), var(--ochre), var(--sage));
  z-index: 90; border-radius: 0 3px 3px 0;
  transition: width .12s linear;
}

/* ==========================================================================
   Layout — three equal columns: rail = 1, content = 2
   ========================================================================== */
.shell {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 4.5rem);
  max-width: 1460px;
  margin: 0 auto;
  padding: clamp(1.6rem, 3.4vw, 3.4rem) clamp(1.3rem, 4vw, 4rem) 6rem;
}
.rail { grid-column: 1 / 2; }
.main { grid-column: 2 / -1; min-width: 0; }

.rail-inner {
  position: sticky; top: clamp(1.6rem, 3.4vw, 3.4rem);
  display: flex; flex-direction: column; gap: 1.5rem;
  max-height: calc(100vh - 5rem);
}

/* ---------- identity block ---------- */
.brand { text-decoration: none; color: inherit; display: block; }
.brand .name {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 2.5vw, 2.55rem);
  line-height: 1.02;
  font-weight: 500;
  letter-spacing: -.018em;
  margin: 0;
  font-variation-settings: "SOFT" 30, "WONK" 0;
}
.brand .name em { font-style: normal; display: block; color: var(--accent); }
.brand .role {
  margin: .7rem 0 0;
  font-size: .795rem;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  line-height: 1.7;
}

/* ---------- rail portrait, hover to reveal ---------- */
.reveal-photo {
  position: relative; overflow: hidden;
  border-radius: var(--r);
  box-shadow: var(--shadow);
  background: var(--surface-2);
  cursor: pointer;
  isolation: isolate;
}
.reveal-photo img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.1s var(--ease), filter .6s var(--ease);
}
.reveal-photo .veil {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: .35rem;
  padding: 1.15rem 1.25rem;
  background: linear-gradient(to top, rgba(51,47,41,.88) 0%, rgba(51,47,41,.55) 45%, rgba(51,47,41,0) 100%);
  color: #fdf8ee;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.reveal-photo .veil strong {
  font-family: var(--serif); font-weight: 500;
  font-size: 1.12rem; line-height: 1.2; letter-spacing: -.01em;
}
.reveal-photo .veil span { font-size: .82rem; line-height: 1.5; opacity: .88; }
.reveal-photo.is-open img{ transform: scale(1.07); filter: saturate(.82) brightness(.94); }
.reveal-photo.is-open .veil,
.reveal-photo:focus-visible .veil{ opacity: 1; transform: none; }
.reveal-photo::after {
  content: "";
  position: absolute; top: .8rem; right: .8rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 0 rgba(227,182,174,.75);
  animation: ping 2.8s ease-out infinite;
  transition: opacity .3s;
}
.reveal-photo.is-open::after{ opacity: 0; }
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(227,182,174,.7); }
  70%  { box-shadow: 0 0 0 14px rgba(227,182,174,0); }
  100% { box-shadow: 0 0 0 0 rgba(227,182,174,0); }
}

/* ---------- collapsible navigation ---------- */
.nav-toggle {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: .7rem;
  padding: .58rem 1.15rem .58rem .9rem;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--ink-soft);
  font-size: .74rem; letter-spacing: .17em; text-transform: uppercase; font-weight: 650;
  transition: color .3s var(--ease), background-color .3s var(--ease), transform .3s var(--ease);
}
.nav-toggle[aria-expanded="true"] { background: var(--ink); color: #fdf8ee; }
.nav-toggle .bars { position: relative; width: 15px; height: 11px; flex: none; }
.nav-toggle .bars i,
.nav-toggle .bars i::before,
.nav-toggle .bars i::after {
  position: absolute; left: 0; width: 15px; height: 1.6px; border-radius: 2px;
  background: currentColor; transition: transform .35s var(--ease), opacity .2s var(--ease);
}
.nav-toggle .bars i { top: 4.7px; }
.nav-toggle .bars i::before { content: ""; top: -4.7px; }
.nav-toggle .bars i::after  { content: ""; top:  4.7px; }
.nav-toggle[aria-expanded="true"] .bars i { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars i::before { transform: translateY(4.7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars i::after  { transform: translateY(-4.7px) rotate(-45deg); }

.nav { display: flex; flex-direction: column; gap: .1rem; overflow-y: auto; }
.nav[hidden] { display: none; }
.nav { animation: nav-in .4s var(--ease); }
@keyframes nav-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
.nav a {
  position: relative;
  display: flex; align-items: baseline; gap: .6rem;
  padding: .42rem .7rem .42rem .55rem;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: .935rem;
  font-weight: 450;
  letter-spacing: .008em;
  transition: color .3s var(--ease), background-color .3s var(--ease), padding-left .3s var(--ease);
}
.nav a .idx {
  font-family: var(--serif);
  font-size: .72rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  transition: color .3s var(--ease);
}
.nav a[aria-current="page"] {
  color: var(--ink); font-weight: 600;
  background: linear-gradient(90deg, var(--accent-soft), transparent 92%);
}
.nav a[aria-current="page"] .idx { color: var(--accent); }

.rail-foot {
  margin-top: auto;
  font-size: .78rem; color: var(--ink-faint);
  display: flex; flex-direction: column; gap: .3rem;
}
.rail-foot a { color: var(--ink-soft); }

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.016em;
  line-height: 1.14;
  margin: 0;
  font-variation-settings: "SOFT" 28, "WONK" 0;
}
h1 { font-size: clamp(2.5rem, 5.2vw, 4.1rem); }
h2 { font-size: clamp(1.65rem, 2.5vw, 2.2rem); }
h3 { font-size: clamp(1.16rem, 1.5vw, 1.38rem); line-height: 1.25; }
h4 { font-size: 1.02rem; }

p { margin: 0 0 1.05rem; }
p:last-child { margin-bottom: 0; }
.lede {
  font-size: clamp(1.09rem, 1.35vw, 1.24rem);
  line-height: 1.68;
  color: var(--ink);
  font-weight: 400;
}
.muted { color: var(--ink-soft); }
.small { font-size: .87rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: .74rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin-bottom: 1rem;
}
.eyebrow::before {
  content: ""; width: 22px; height: 6px; border-radius: 6px;
  background: linear-gradient(90deg, var(--ochre), var(--rose));
}

/* page head */
.page-head { margin-bottom: clamp(2.2rem, 4vw, 3.4rem); }
.page-head h1 { margin-bottom: .9rem; }
.page-head .lede { max-width: 62ch; }

/* section rhythm — spacing does the dividing, never a line */
section + section { margin-top: clamp(3rem, 6vw, 5.5rem); }
.sec-title { margin-bottom: 1.5rem; }

/* ==========================================================================
   Surfaces
   ========================================================================== */
.card {
  background: var(--surface);
  border-radius: var(--r);
  padding: clamp(1.3rem, 2.3vw, 2rem);
  box-shadow: var(--shadow);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.card.tint  { background: var(--surface-2); box-shadow: none; }
.card > p, .entry .meta { max-width: 78ch; }

.stack   { display: flex; flex-direction: column; gap: 1.1rem; }
.stack-lg{ display: flex; flex-direction: column; gap: clamp(1.4rem, 2.4vw, 2.2rem); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: clamp(1.1rem, 2vw, 1.8rem); }

/* pills / tags */
.tags { display: flex; flex-wrap: wrap; gap: .45rem; }
.tag {
  font-size: .755rem; letter-spacing: .05em; font-weight: 550;
  padding: .3rem .68rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  white-space: nowrap;
}
.tag.sage  { background: #e7eee2; color: #5f7a52; }
.tag.rose  { background: #f8e7e3; color: #a4625a; }
.tag.lilac { background: #ece7f4; color: #6f6088; }
.tag.sky   { background: #e2edf3; color: #4f7285; }

/* soft inline link underline that grows */
.link {
  position: relative; font-weight: 500;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1.2px; background-repeat: no-repeat;
  background-position: 0 95%;
  transition: background-size .35s var(--ease);
}
.link::after { content: " ↗"; font-size: .8em; opacity: .55; }
.link.plain::after { content: ""; }

/* ==========================================================================
   Landing
   ========================================================================== */
.hero { padding-top: clamp(.5rem, 3vw, 2.6rem); }
.hero h1 { letter-spacing: -.028em; }
.hero h1 .flip {
  color: var(--accent); font-style: italic;
  display: inline-block; min-width: 5ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 2rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .72rem 1.35rem; border-radius: 999px;
  font-size: .89rem; font-weight: 550; letter-spacing: .02em;
  background: var(--ink); color: #fdf8ee;
  box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), background-color .3s var(--ease);
}
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn .arw { transition: transform .3s var(--ease); }

/* numbers strip */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1.4rem 1.1rem; }
.figure .n {
  font-family: var(--serif); font-size: clamp(2rem, 3.4vw, 2.9rem);
  line-height: 1; color: var(--accent); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.figure .l {
  margin-top: .45rem; font-size: .79rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft); font-weight: 500; line-height: 1.5;
}

/* portrait on the landing page — horizontal crop, kept modest */
.portrait-solo { max-width: 420px; aspect-ratio: 3 / 2; }

/* quick-jump grid on landing */
.jump { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1rem; }
.jump a {
  display: flex; flex-direction: column; gap: .3rem;
  padding: 1.25rem 1.3rem 1.35rem;
  border-radius: var(--r); background: var(--surface);
  box-shadow: var(--shadow); color: var(--ink);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), background-color .4s var(--ease);
}
.jump a strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; }
.jump a span { font-size: .845rem; color: var(--ink-soft); line-height: 1.55; }
.jump a .go { margin-top: .5rem; font-size: .78rem; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }

/* ==========================================================================
   Research
   ========================================================================== */
.project { position: relative; }
.project-figure {
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--surface); padding: clamp(.7rem, 1.4vw, 1.15rem);
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.project-figure img { border-radius: var(--r-sm); width: 100%; }
.project-figure figcaption {
  margin-top: .75rem; padding: 0 .35rem .15rem;
  font-size: .795rem; color: var(--ink-soft); line-height: 1.55;
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
}
.project-figure figcaption em { font-style: normal; color: var(--ink-faint); white-space: nowrap; }

/* expandable abstract */
.disclose { margin-top: 1.1rem; }
.disclose-btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem 1rem .5rem 1.05rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft);
  font-size: .81rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.disclose-btn .chev { transition: transform .35s var(--ease); font-size: .95rem; }
.disclose-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.disclose-body {
  overflow: hidden; height: 0;
  transition: height .5s var(--ease);
}
.disclose-body > div {
  padding: 1.3rem 0 .2rem;
  color: var(--ink-soft); font-size: .955rem;
  max-width: 74ch;
}
.disclose-body h4 { color: var(--ink); margin-bottom: .5rem; }

/* ==========================================================================
   Publications
   ========================================================================== */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.8rem; }
.chip {
  padding: .42rem 1rem; border-radius: 999px;
  background: var(--surface); color: var(--ink-soft);
  font-size: .82rem; font-weight: 550;
  box-shadow: var(--shadow-sm);
  transition: all .3s var(--ease);
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fdf8ee; }

.pub {
  display: grid; grid-template-columns: 4.2rem 1fr; gap: 0 1.4rem;
  padding: 1.35rem 1.5rem 1.4rem;
  border-radius: var(--r); background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), opacity .35s, filter .35s;
}
.pub.is-hidden { display: none; }
.pub .yr {
  font-family: var(--serif); font-size: 1.5rem; color: var(--accent);
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.pub .yr small { display: block; font-family: var(--sans); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); margin-top: .3rem; }
.pub h3 { margin-bottom: .5rem; }
.pub .authors { font-size: .875rem; color: var(--ink-soft); margin-bottom: .55rem; }
.pub .authors b { color: var(--ink); font-weight: 650; }
.pub .venue { font-size: .875rem; color: var(--ink-soft); font-style: italic; }
.pub .pub-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; align-items: center; }
.mini {
  font-size: .765rem; font-weight: 600; letter-spacing: .06em;
  padding: .34rem .8rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-soft);
  transition: background-color .3s, color .3s, transform .3s;
}
.mini.ok { background: #e7eee2; color: #5f7a52; }

.patent {
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%);
  border-radius: var(--r-lg);
  padding: clamp(1.5rem, 2.6vw, 2.3rem);
  box-shadow: var(--shadow);
}
.patent .seal {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface); color: var(--accent);
  display: grid; place-items: center; font-size: 1.3rem;
  box-shadow: var(--shadow-sm); margin-bottom: 1rem;
}

/* ==========================================================================
   CV timeline
   ========================================================================== */
.tl { display: flex; flex-direction: column; gap: .55rem; }
.tl-item {
  display: grid; grid-template-columns: 6.6rem 1fr; gap: 0 1.5rem;
  padding: 1.05rem 1.3rem 1.15rem;
  border-radius: var(--r);
  background: transparent;
  transition: background-color .4s var(--ease), transform .4s var(--ease);
}
.tl-when {
  font-size: .8rem; font-weight: 600; letter-spacing: .04em;
  color: var(--accent); font-variant-numeric: tabular-nums;
  padding-top: .3rem;
}
.tl-what h3 { margin-bottom: .25rem; }
.tl-where { font-size: .875rem; color: var(--ink-soft); margin-bottom: .55rem; }
.tl-what ul { display: flex; flex-direction: column; gap: .3rem; margin-top: .6rem; }
.tl-what li {
  position: relative; padding-left: 1.1rem;
  font-size: .9rem; color: var(--ink-soft);
}
.tl-what li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--rose);
}

.lang { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 1rem; }
.lang-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: .7rem;
  padding: 1.4rem 1.5rem 1.5rem;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.lang-card h3 { font-size: 1.35rem; }
.lang-card .tag { white-space: normal; line-height: 1.45; }

/* ==========================================================================
   Gallery / conferences / workshops
   ========================================================================== */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: clamp(.85rem, 1.6vw, 1.25rem); }
.gallery .reveal-photo { aspect-ratio: 4 / 5; }
.gallery .reveal-photo.wide { grid-column: span 2; aspect-ratio: 16 / 10; }

.entry {
  padding: 1.4rem 1.6rem 1.5rem;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.entry .kicker {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-bottom: .7rem;
}
.entry h3 { font-style: italic; font-weight: 400; margin-bottom: .6rem; }
.entry .meta { font-size: .885rem; color: var(--ink-soft); }
.entry .meta b { color: var(--ink); font-weight: 600; }

/* media grouped per talk — two across, deliberately large */
.talk + .talk { margin-top: clamp(2.4rem, 4.5vw, 4rem); }
.talk-head { margin-bottom: 1.2rem; }
.talk-head h3 { margin-bottom: .4rem; }
.talk-head .where { font-size: .875rem; color: var(--ink-soft); }
.media-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: clamp(1rem, 2vw, 1.7rem);
  align-items: start;
  justify-items: center;
}
.media-2 > * { width: 100%; margin-inline: auto; }
.media-2 .reveal-photo { aspect-ratio: 3 / 4; }
.media-2 .reveal-photo.land { aspect-ratio: 4 / 3; }
.media-2 .project-figure { cursor: zoom-in; }

/* ==========================================================================
   Contact
   ========================================================================== */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; }
.contact-card {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1.5rem 1.6rem 1.6rem;
  border-radius: var(--r); background: var(--surface);
  box-shadow: var(--shadow); color: var(--ink);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.contact-card .ic { font-size: 1.5rem; margin-bottom: .45rem; }
.contact-card .k { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.contact-card .v { font-size: 1.02rem; font-weight: 500; word-break: break-word; }
.contact-card .hint { font-size: .8rem; color: var(--ink-soft); margin-top: .35rem; }

.field { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1rem; }
.field label { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }
.field input, .field textarea {
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--surface-2); border: 0; border-radius: var(--r-sm);
  padding: .8rem .95rem; outline: none;
  transition: box-shadow .3s var(--ease), background-color .3s var(--ease);
}
.field input:focus, .field textarea:focus {
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 130px; }

/* ==========================================================================
   Floating action buttons
   ========================================================================== */
.fab-dock {
  position: fixed; right: clamp(1rem, 2.2vw, 1.8rem); bottom: clamp(1rem, 2.2vw, 1.8rem);
  z-index: 70;
  display: flex; flex-direction: column-reverse; align-items: center; gap: .65rem;
}
.fab {
  position: relative;
  width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg), var(--shadow-sm);
  font-size: 1.12rem;
  transition: transform .4s var(--ease), background-color .35s var(--ease), color .35s var(--ease), opacity .35s var(--ease);
}
.fab.primary { background: var(--ink); color: #fdf8ee; }
.fab[hidden] { display: none; }

/* staggered pop-in for the secondary fabs */
.fab-stack { display: none; flex-direction: column-reverse; gap: .6rem; align-items: center; }
body.fabs-open .fab-stack { display: flex; }
.fab-stack .fab {
  width: 44px; height: 44px; font-size: 1rem;
  animation: fab-pop .4s var(--ease) backwards;
}
.fab-stack .fab:nth-child(1) { animation-delay: .00s; }
.fab-stack .fab:nth-child(2) { animation-delay: .06s; }
.fab-stack .fab:nth-child(3) { animation-delay: .12s; }
.fab-stack .fab:nth-child(4) { animation-delay: .18s; }
@keyframes fab-pop {
  from { opacity: 0; transform: translateY(16px) scale(.55); }
  to   { opacity: 1; transform: none; }
}
body.fabs-open #fab-main { transform: rotate(135deg); }

/* tooltip */
.fab .tip {
  position: absolute; right: calc(100% + 12px); top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: var(--ink); color: #fdf8ee;
  font-size: .74rem; font-weight: 550; letter-spacing: .04em;
  padding: .32rem .68rem; border-radius: 999px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translate(-50%, 20px);
  background: var(--ink); color: #fdf8ee;
  padding: .7rem 1.3rem; border-radius: 999px;
  font-size: .85rem; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; z-index: 120;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(43, 39, 33, .93);
  display: grid; place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0; pointer-events: none;
  transition: opacity .4s var(--ease);
}
.lightbox.show { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: 100%; max-height: 82vh;
  border-radius: var(--r); box-shadow: 0 40px 90px -30px rgba(0,0,0,.7);
  transform: scale(.96); transition: transform .45s var(--ease);
}
.lightbox.show img { transform: scale(1); }
.lightbox .cap {
  color: #f2e9d9; font-size: .87rem; text-align: center;
  margin-top: 1rem; max-width: 60ch;
}
.lightbox .x {
  position: absolute; top: 1.4rem; right: 1.6rem;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(253,248,238,.14); color: #fdf8ee;
  display: grid; place-items: center; font-size: 1.1rem;
  transition: background-color .3s;
}

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
.rise { opacity: 0; transform: translateY(22px); }
.rise.in { opacity: 1; transform: none; transition: opacity .8s var(--ease), transform .8s var(--ease); }
.rise.d1.in { transition-delay: .07s; }
.rise.d2.in { transition-delay: .14s; }
.rise.d3.in { transition-delay: .21s; }
.rise.d4.in { transition-delay: .28s; }


/* ==========================================================================
   Hover states, pointer devices only.
   On touch, a :hover rule that moves an element makes the browser treat the
   first tap as a hover and swallow the click, so everything needs tapping
   twice. Touch feedback is handled by :active below instead.
   ========================================================================== */
@media (hover: hover) and (pointer: fine) {
  .reveal-photo:hover img { transform: scale(1.07); filter: saturate(.82) brightness(.94); }
  .reveal-photo:hover .veil { opacity: 1; transform: none; }
  .reveal-photo:hover::after { opacity: 0; }
  .nav-toggle:hover { color: var(--ink); transform: translateY(-2px); }
  .nav a:hover { color: var(--ink); background: var(--surface-2); padding-left: .95rem; }
  .rail-foot a:hover { color: var(--accent); }
  .card.lift:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
  .link:hover { background-size: 100% 1.2px; }
  .btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
  .btn.ghost:hover { background: var(--surface); color: var(--accent); }
  .btn:hover .arw { transform: translateX(4px); }
  .jump a:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); background: var(--surface); }
  .project-figure:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .disclose-btn:hover { background: var(--accent-soft); color: var(--accent); }
  .chip:hover { color: var(--ink); transform: translateY(-2px); }
  .pub:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .mini:hover { background: var(--accent-soft); color: var(--accent); transform: translateY(-2px); }
  .tl-item:hover { background: var(--surface); transform: translateX(5px); }
  .lang-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
  .entry:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .contact-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
  .fab:hover { transform: translateY(-4px) scale(1.06); background: var(--ink); color: #fdf8ee; }
  .fab.primary:hover { background: var(--accent); }
  body.fabs-open #fab-main:hover { transform: rotate(135deg) translateY(-4px) scale(1.06); }
  .fab:hover .tip { opacity: 1; transform: translateY(-50%); }
  .lightbox .x:hover { background: rgba(253,248,238,.28); }
}

/* tap feedback for touch, :active does not block the click */
@media (hover: none) {
  .btn:active, .fab:active, .chip:active, .mini:active, .disclose-btn:active,
  .nav-toggle:active, .jump a:active, .contact-card:active, .lang-card:active,
  .project-figure:active, .pub:active, .entry:active { transform: scale(.978); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 2.2rem; }
  .rail, .main { grid-column: 1 / -1; }
  .rail-inner { position: static; max-height: none; gap: 1.1rem; }
  .rail-foot { flex-direction: row; gap: 1.2rem; }
  /* one line: "Perla Makhoul" (nbsp keeps the two halves together) */
  .brand .name em { display: inline; }
  .brand .name em::before { content: "\00a0"; }
  .gallery .reveal-photo.wide { grid-column: span 1; aspect-ratio: 4 / 5; }
  /* single column: keep portrait photos from becoming full-width and enormous.
     Posters stay full width so they read as large as possible before tapping. */
  .media-2 .reveal-photo { max-width: 430px; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .pub { grid-template-columns: 1fr; gap: .6rem; }
  .pub .yr { display: flex; align-items: baseline; gap: .6rem; font-size: 1.2rem; }
  .pub .yr small { margin-top: 0; }
  .tl-item { grid-template-columns: 1fr; gap: .4rem; }
  .tl-when { padding-top: 0; }
  .gallery { grid-template-columns: 1fr; }
  .media-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .rise { opacity: 1; transform: none; }
}

/* ==========================================================================
   Print — the CV page doubles as the PDF
   ========================================================================== */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; }
  .ambient, .fab-dock, .nav-toggle, .progress, .lightbox, .toast, .nav, .rail-foot, .no-print { display: none !important; }
  body { background: #fff; font-size: 10.5pt; line-height: 1.5; }
  .shell { display: block; max-width: none; padding: 0; }
  .card, .tl-item, .entry, .pub { box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; }
  .tl-item { padding: .35rem 0; }
  section + section { margin-top: 1.6rem; }
  h1 { font-size: 24pt; }
  h2 { font-size: 14pt; }
  a { color: var(--ink); }
  .reveal-photo .veil { display: none; }
  .rail-inner { display: block; margin-bottom: 1.4rem; }
  .brand .name { font-size: 22pt; }
  .page-head .hero-actions { display: none; }
}
