/* ===========================================================
   Fernando B. Mello — personal site
   =========================================================== */

:root {
  --bg:        #fbfaf7;
  --bg-alt:    #f3efe8;
  --ink:       #1a1714;
  --ink-soft:  #4b463f;
  --muted:     #8a8378;
  --line:      #e3ddd2;
  --accent:    #9c4221;   /* clay / oxblood */
  --accent-2:  #b5552f;
  --max:       1120px;
  --pad:       clamp(1.25rem, 5vw, 4rem);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

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

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.05rem var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.nav__links { display: flex; gap: 1.55rem; }
.nav__links a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding: 2px 0;
  transition: color .2s ease;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 0; height: 1.5px;
  background: var(--accent);
  transition: width .25s ease;
}
.nav__links a:hover { color: var(--accent); }
.nav__links a:hover::after { width: 100%; }

/* nav button (Presentations) */
.nav__links a.nav__btn {
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.38rem 0.95rem;
}
.nav__links a.nav__btn::after { display: none; }
.nav__links a.nav__btn:hover { background: var(--accent); color: #fff; }

/* back link (separate pages) */
.nav__back {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color .2s ease;
}
.nav__back:hover { color: var(--accent); }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.nav__toggle span {
  width: 24px; height: 2px;
  background: var(--ink);
  transition: transform .3s ease, opacity .3s ease;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1){ transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2){ opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3){ transform: translateY(-7px) rotate(-45deg); }

/* ---------- WhatsApp welcome ---------- */
.welcome {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--pad) clamp(2.5rem, 5vw, 3.5rem);
}
.welcome__inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.welcome__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem;
}
.welcome__heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.3rem;
}
.welcome__sub {
  font-size: clamp(1rem, 1.7vw, 1.16rem);
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 1.9rem;
  max-width: 44ch;
}
.welcome__cta { margin-top: 0.2rem; }

.welcome__phone { display: flex; justify-content: center; }

/* scroll cue */
.welcome__scroll {
  display: block;
  width: 26px; height: 42px;
  margin: clamp(1.5rem, 4vw, 2.5rem) auto 0;
  border: 2px solid var(--muted);
  border-radius: 14px;
  position: relative;
}
.welcome__scroll span {
  position: absolute;
  top: 8px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  background: var(--accent);
  border-radius: 2px;
  animation: scrollcue 1.6s ease-in-out infinite;
}
@keyframes scrollcue {
  0% { opacity: 0; transform: translateY(0); }
  40% { opacity: 1; }
  80% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 0; }
}

/* phone frame */
.phone {
  position: relative;
  width: min(340px, 86vw);
  background: #0b141a;
  border-radius: 40px;
  padding: 12px;
  box-shadow: 0 40px 80px -30px rgba(20,30,25,.55), 0 0 0 1px rgba(0,0,0,.2);
}
.phone__cam {
  position: absolute;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  width: 54px; height: 7px;
  background: #000;
  border-radius: 99px;
  z-index: 5;
}

/* whatsapp app */
.wa {
  height: clamp(500px, 68vh, 580px);
  border-radius: 30px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #efe7de;
}
.wa__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #008069;
  color: #fff;
  padding: 32px 14px 10px;
}
.wa__back { font-size: 1.5rem; line-height: 1; opacity: .9; }
.wa__avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }
.wa__id { display: flex; flex-direction: column; line-height: 1.2; margin-right: auto; }
.wa__name { font-weight: 600; font-size: 0.95rem; font-family: var(--sans); }
.wa__status { font-size: 0.72rem; opacity: .85; min-height: 0.9em; }
.wa__icons { display: flex; gap: 16px; opacity: .92; }

.wa__chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #efe7de;
  background-image: radial-gradient(rgba(0,0,0,.035) 1px, transparent 1px);
  background-size: 16px 16px;
  scrollbar-width: thin;
}
.wa__day {
  align-self: center;
  background: #ffffff;
  color: #54656f;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 4px 11px;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
  margin-bottom: 4px;
}
.wa__msg {
  position: relative;
  max-width: 80%;
  padding: 6px 9px 7px;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #111b21;
  border-radius: 9px;
  box-shadow: 0 1px 1px rgba(0,0,0,.12);
  animation: wapop .3s cubic-bezier(.2,.8,.2,1) both;
  word-wrap: break-word;
}
.wa__msg .wa__t {
  display: inline-block;
  float: right;
  font-size: 0.62rem;
  color: #667781;
  margin: 6px 0 -2px 8px;
}
.wa__msg--in {
  align-self: flex-start;
  background: #ffffff;
  border-top-left-radius: 2px;
}
.wa__msg--out {
  align-self: flex-end;
  background: #d9fdd3;
  border-top-right-radius: 2px;
}
.wa__msg--out .wa__check { color: #53bdeb; font-size: 0.7rem; margin-left: 2px; }
@keyframes wapop {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* typing indicator */
.wa__typing {
  align-self: flex-start;
  background: #fff;
  border-radius: 9px;
  border-top-left-radius: 2px;
  padding: 10px 12px;
  box-shadow: 0 1px 1px rgba(0,0,0,.12);
  display: inline-flex;
  gap: 4px;
}
.wa__typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #9aa0a6;
  animation: watype 1.2s infinite ease-in-out;
}
.wa__typing span:nth-child(2) { animation-delay: .2s; }
.wa__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes watype {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6.5rem) var(--pad) clamp(3rem, 7vw, 5.5rem);
}
.hero__inner {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem;
}
.hero__name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1.4rem;
}
.hero__lede {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
  max-width: 38ch;
}
.hero__affil {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 2rem;
}
.hero__affil span { color: var(--ink-soft); font-weight: 500; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-bottom: 1.8rem; }

.btn {
  display: inline-block;
  padding: 0.72rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all .22s ease;
  background: transparent;
}
.btn:hover { background: var(--ink); color: var(--bg); transform: translateY(-2px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn--small { padding: 0.55rem 1.05rem; font-size: 0.84rem; }

.hero__links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  padding: 0; margin: 0;
}
.hero__links a {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: color .2s, border-color .2s;
}
.hero__links a:hover { color: var(--accent); border-color: var(--accent); }

/* portrait */
.hero__portrait { display: flex; justify-content: center; }
.portrait {
  position: relative;
  width: min(320px, 78vw);
  aspect-ratio: 4 / 5;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, #e9e2d6, #cdbfa9);
  box-shadow: 0 30px 60px -28px rgba(60, 40, 20, 0.45);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait__mono {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 5rem;
  color: var(--accent);
  background: linear-gradient(160deg, #efe8da, #ddd0ba);
}
.portrait--placeholder .portrait__mono { display: flex; }

/* ---------- Marquee venues ---------- */
.marquee {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 1.5rem;
}
.marquee__label {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}
.marquee ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  padding: 0; margin: 0;
}
.marquee li {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-soft);
  position: relative;
}
.marquee li:not(:last-child)::after {
  content: "·";
  position: absolute;
  right: -0.85rem;
  color: var(--accent);
  font-style: normal;
}

/* identity + venues merged into About */
.about__intro { margin-bottom: 2.6rem; }
#about .marquee.about__venues {
  max-width: none;
  margin: 0 0 2.6rem;
  padding: 1.6rem 0 0;
  border-top: 1px solid var(--line);
}

/* ---------- Sections ---------- */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) var(--pad);
}
.section--alt {
  max-width: none;
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section--alt > * { max-width: var(--max); margin-left: auto; margin-right: auto; }

.section__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.4rem;
}
.section__num {
  font-family: var(--serif);
  font-size: 0.95rem;
  color: var(--accent);
  font-weight: 600;
}
.section__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  letter-spacing: -0.015em;
  margin: 0;
}

/* ---------- About ---------- */
.prose { max-width: 64ch; }
.prose p { margin: 0 0 1.25rem; color: var(--ink-soft); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color .2s ease; }
.prose a:hover { border-color: var(--accent); }

.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 2.6rem 0;
}
.fact { background: var(--bg); padding: 1.3rem 1.5rem; }
.fact__k {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.fact__v { font-size: 0.98rem; color: var(--ink); font-weight: 500; }

/* education */
.edu { margin-top: 2.6rem; }
.edu__title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1rem;
}
.edu__list { list-style: none; padding: 0; margin: 0; }
.edu__list li {
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}
.edu__list li:last-child { border-bottom: 1px solid var(--line); }
.edu__deg { display: block; font-weight: 600; color: var(--ink); }
.edu__school { display: block; color: var(--ink-soft); font-size: 0.95rem; }

.awards__title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 0.8rem;
}
.awards ul {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.awards li {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  transition: border-color .2s ease, color .2s ease;
}
.awards li a { color: inherit; text-decoration: none; }
.awards li a span { color: var(--accent); font-size: 0.82em; margin-left: 1px; }
.awards li:has(a):hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Research ---------- */
.feature {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 1.8rem;
  margin-bottom: 3rem;
  max-width: 70ch;
}
.feature__tag {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.7rem;
}
.feature__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}
.feature__body { color: var(--ink-soft); margin: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}
.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.7rem;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px -30px rgba(60,40,20,.4);
  border-color: #d8cdbb;
}
.card__tag {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.7rem;
}
.card__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.25;
  margin: 0 0 0.7rem;
}
.card__body { color: var(--ink-soft); font-size: 0.96rem; margin: 0; }

/* flip cards */
.cards__hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.flip {
  perspective: 1500px;
  min-height: 300px;
  cursor: pointer;
  background: transparent;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}
.flip:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 16px; }
.flip__inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  transition: transform .6s cubic-bezier(.2,.75,.2,1);
  transform-style: preserve-3d;
}
.flip.is-flipped .flip__inner { transform: rotateY(180deg); }
.flip__face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.6rem;
  overflow: hidden;
  transition: box-shadow .25s ease, border-color .25s ease;
}
.flip:hover .flip__face { box-shadow: 0 24px 48px -30px rgba(60,40,20,.4); border-color: #d8cdbb; }
.flip__back {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fffdf9, #f1e9dd);
}
.flip__face .card__body { font-size: 0.92rem; }
.flip__hint {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--accent);
}
.flip__paper {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.06rem;
  line-height: 1.28;
  margin: 0 0 0.55rem;
  color: var(--ink);
}
.flip__authors { margin: 0; font-size: 0.88rem; color: var(--muted); }
.flip__venue { margin: 0.3rem 0 0; font-size: 0.92rem; color: var(--ink-soft); }
@media (max-width: 680px) {
  .flip { min-height: 360px; }
}

/* ---------- Publications ---------- */
.pubs__note { font-size: 0.85rem; color: var(--muted); margin: 0 0 1.5rem; }
.pubs__cat {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 2.4rem 0 0.4rem;
  color: var(--ink);
}
.pubs__cat:first-of-type { margin-top: 0; }
.dagger { color: var(--accent); font-weight: 600; }
.pubs { list-style: none; counter-reset: none; padding: 0; margin: 0; }
.pub {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
}
.pub:last-child { border-bottom: 1px solid var(--line); }
.pub__year {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--accent);
  padding-top: 2px;
}
.pub__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.3;
  margin: 0 0 0.35rem;
}
.pub__title a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color .2s ease, border-color .2s ease;
}
.pub__title a:hover { color: var(--accent); border-color: var(--accent); }
.pub__authors { margin: 0; font-size: 0.92rem; color: var(--muted); }
.pub__venue { margin: 0.15rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }
.pub__flag {
  display: inline-block;
  margin-left: 0.45rem;
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(156, 66, 33, 0.1);
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  vertical-align: middle;
}
.pubs__more { margin-top: 1.8rem; color: var(--ink-soft); font-size: 0.96rem; }
.pubs__more a { color: var(--accent); }

/* ---------- Books ---------- */
.book {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.book__cover {
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  background: linear-gradient(150deg, var(--accent), #6e2d16);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: #f6e9df;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.15;
  box-shadow: 0 26px 48px -26px rgba(80,30,10,.6);
}
.book__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  line-height: 1.2;
  margin: 0 0 0.5rem;
}
.book__sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.95rem; }
.book__body { margin: 0 0 1.4rem; color: var(--ink-soft); max-width: 52ch; }
.book__links { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- Teaching ---------- */
.teach {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}
.teach__col h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 0.9rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}
.teach__col h3 span { color: var(--muted); font-weight: 500; font-size: 0.92rem; }
.teach__col ul { list-style: none; padding: 0; margin: 0; }
.teach__col li { padding: 0.4rem 0; color: var(--ink-soft); font-size: 0.96rem; }
.teach__col li em { color: var(--muted); font-style: normal; font-size: 0.85rem; }

/* teaching stats */
.teach-stats {
  margin-top: 2.4rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
}
.tstat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.9rem 1.4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 200px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.tstat:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -30px rgba(60,40,20,.4); }
.tstat__num {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.tstat__num--sm { font-size: clamp(1.25rem, 2.6vw, 1.55rem); color: var(--ink); }
.tstat__label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-width: 22ch;
}

/* circular evaluation gauge */
@property --tpct {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}
.tstat__ring {
  --tpct: 0;
  position: relative;
  width: 112px; height: 112px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) calc(var(--tpct) * 1%), #e3ddd2 0);
  transition: --tpct 1.3s cubic-bezier(.2,.8,.2,1);
}
.tstat__ring.is-on { --tpct: 94; }
.tstat__ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--bg);
}
.tstat__ringval {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--ink);
}
.tstat__ringval small { font-size: 0.85rem; color: var(--muted); font-weight: 500; }

/* award medal */
.tstat__badge {
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(156, 66, 33, 0.08);
  color: var(--accent);
}

@media (max-width: 680px) {
  .teach-stats { grid-template-columns: 1fr; }
}

/* ---------- Student comments (Teaching) ---------- */
.comments { margin-top: 2.8rem; }
.comments__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.65rem 1.3rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: border-color .2s ease, transform .2s ease;
}
.comments__toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.comments__chev { transition: transform .3s ease; }
.comments__toggle[aria-expanded="true"] .comments__chev { transform: rotate(180deg); }
.comments__panel { margin-top: 1.7rem; }
.comments__panel[hidden] { display: none; }
.comments__grid { columns: 3 250px; column-gap: 1.2rem; }
.quote {
  break-inside: avoid;
  margin: 0 0 1.2rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.35rem 1.4rem 1.2rem;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.quote.in { opacity: 1; transform: none; }
.quote blockquote {
  margin: 0 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.quote blockquote::before {
  content: "\201C";
  color: var(--accent);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.9rem;
  line-height: 0;
  vertical-align: -0.35em;
  margin-right: 3px;
}
.quote figcaption {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Selected media ---------- */
.media-lead {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  margin-bottom: 2.8rem;
}
.media-lead__intro {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 34ch;
  margin: 0;
}
.media-lead__portrait { width: min(300px, 72vw); justify-self: end; }
@media (max-width: 860px) {
  .media-lead { grid-template-columns: 1fr; }
  .media-lead__portrait { order: -1; justify-self: start; width: min(240px, 60vw); }
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
}
.media {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.7rem;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.media:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -30px rgba(60,40,20,.4); border-color: #d8cdbb; }
.media--wide { grid-column: 1 / -1; }
.media__cover {
  margin: -1.7rem -1.7rem 1.3rem;
  height: 210px;
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  background: var(--bg-alt);
}
.media__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
}
.media__tag {
  text-transform: uppercase;
  letter-spacing: 0.13em;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.6rem;
}
.media__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  line-height: 1.25;
  margin: 0 0 0.6rem;
}
.media__body { color: var(--ink-soft); font-size: 0.95rem; margin: 0 0 1.2rem; }
.media__link {
  margin-top: auto;
  align-self: flex-start;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.media__link span { display: inline-block; transition: transform .2s ease; }
.media__link:hover span { transform: translate(2px, -2px); }
.media__links {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.3rem;
}
.media__links a {
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color .2s ease;
}
.media__links a:hover { border-color: var(--accent); }
@media (max-width: 680px) { .media-grid { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.section--contact {
  text-align: center;
  padding-top: clamp(4rem, 9vw, 7rem);
  padding-bottom: clamp(4rem, 9vw, 7rem);
}
.contact .section__num { display: block; margin-bottom: 0.8rem; }
.contact__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.contact__body {
  max-width: 46ch;
  margin: 0 auto 2rem;
  color: var(--ink-soft);
}
.contact__email {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 4vw, 2rem);
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color .2s ease;
}
.contact__email:hover { border-color: var(--accent); }
.contact__links {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.6rem;
  padding: 0;
  margin: 2.2rem 0 0;
}
.contact__links a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color .2s ease;
}
.contact__links a:hover { color: var(--accent); }

/* ---------- Presentations ---------- */
.pres__note { color: var(--ink-soft); margin: 0 0 1.7rem; max-width: 60ch; }
.pres-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.pres__open {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.6rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.pres__open:hover { transform: translateY(-3px); box-shadow: 0 22px 44px -30px rgba(60,40,20,.4); border-color: #d8cdbb; }
.pres__open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pres__info { display: flex; flex-direction: column; gap: 3px; }
.pres__title { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; }
.pres__meta { font-size: 0.85rem; color: var(--muted); }
.pres__lock { color: var(--accent); display: grid; place-items: center; flex: none; }

/* password gate modal */
.pwgate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1.25rem; }
.pwgate[hidden] { display: none; }
.pwgate__overlay { position: absolute; inset: 0; background: rgba(26,23,20,.55); backdrop-filter: blur(3px); }
.pwgate__box {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 2.3rem 2rem 2rem;
  text-align: center;
  box-shadow: 0 40px 80px -30px rgba(20,15,10,.6);
  animation: pwpop .25s ease both;
}
@keyframes pwpop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.pwgate__close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: 0;
  font-size: 1.7rem; line-height: 1;
  color: var(--muted); cursor: pointer;
}
.pwgate__close:hover { color: var(--ink); }
.pwgate__lock {
  display: inline-grid; place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(156,66,33,.1);
  color: var(--accent);
  margin-bottom: 0.9rem;
}
.pwgate__title { font-family: var(--serif); font-weight: 600; font-size: 1.4rem; margin: 0 0 0.4rem; }
.pwgate__sub { color: var(--ink-soft); font-size: 0.92rem; margin: 0 0 1.4rem; }
.pwgate__form { display: flex; flex-direction: column; gap: 0.7rem; }
.pwgate__input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  font-size: 1rem;
  text-align: center;
  background: #fff;
  color: var(--ink);
}
.pwgate__input:focus { outline: none; border-color: var(--accent); }
.pwgate__form .btn { width: 100%; cursor: pointer; }
.pwgate__err { color: #b3261e; font-size: 0.85rem; margin: 0.9rem 0 0; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 2rem var(--pad);
  text-align: center;
}
.footer p { margin: 0; font-size: 0.85rem; color: var(--muted); }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .welcome__inner { grid-template-columns: 1fr; }
  .welcome__phone { order: -1; }
  .welcome__intro { text-align: center; }
  .welcome__sub { margin-left: auto; margin-right: auto; }
  .hero__inner { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; justify-content: flex-start; }
  .portrait { width: min(220px, 55vw); }
  .cards { grid-template-columns: 1fr; }
  .teach { grid-template-columns: 1fr; }
  .book { grid-template-columns: 130px 1fr; }
}

@media (max-width: 1120px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem var(--pad) 1.2rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
  }
  .nav__links.is-open { max-height: 480px; }
  .nav__links a { padding: 0.75rem 0; font-size: 1rem; }
  .nav__links a.nav__btn { align-self: flex-start; margin-top: 0.5rem; padding: 0.5rem 1.1rem; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .facts { grid-template-columns: 1fr; }
  .book { grid-template-columns: 1fr; }
  .book__cover { width: 150px; }
}
