/* ============================================================
   royf.com — The Royf Family
   Warm family-modern: paper, ink, clay. From רופא — "healer."
   ============================================================ */

:root {
  --paper: #f6efe1;
  --paper-deep: #eee3cd;
  --paper-card: #fbf7ee;
  --ink: #2e241a;
  --ink-soft: #6f6050;
  --ink-faint: #a2907c;
  --clay: #b9502e;
  --clay-deep: #94391d;
  --olive: #67683b;
  --gold: #c19a4b;
  --line: rgba(46, 36, 26, 0.16);

  --font-display: "Fraunces", "Frank Ruhl Libre", Georgia, serif;
  --font-body: "Instrument Sans", "Helvetica Neue", sans-serif;
  --font-hebrew: "Frank Ruhl Libre", "Fraunces", serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Paper grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.14 0 0 0 0 0.10 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--clay); color: var(--paper-card); }

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

a { color: var(--clay-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--clay); }

.wrap {
  width: min(1120px, calc(100% - 3rem));
  margin-inline: auto;
}

/* ---------- Typography ---------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.display {
  font-size: clamp(3rem, 8.5vw, 6.5rem);
  font-variation-settings: "opsz" 144;
}

.display em, h2 em {
  font-style: italic;
  font-weight: 480;
  color: var(--clay);
}

h2 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  margin-bottom: 1.25rem;
}

h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }

.kicker {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--clay);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.kicker::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: var(--clay);
}

.lede {
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  color: var(--ink-soft);
  max-width: 34em;
  text-wrap: pretty;
}

.hebrew {
  font-family: var(--font-hebrew);
  font-weight: 500;
  direction: rtl;
  unicode-bidi: isolate;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.9rem;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark .dot { color: var(--clay); }

.site-nav { display: flex; gap: 1.75rem; }

.site-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.site-nav a:hover { color: var(--ink); }

.site-nav a[aria-current="page"] {
  color: var(--clay-deep);
  border-bottom-color: var(--clay);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-block: clamp(4.5rem, 11vh, 8.5rem) clamp(4rem, 9vh, 7rem);
  overflow: clip;
}

/* Giant faint רופא watermark */
.hero::before {
  content: "רופא";
  position: absolute;
  top: 50%;
  right: -0.05em;
  transform: translateY(-52%);
  font-family: var(--font-hebrew);
  font-weight: 700;
  font-size: clamp(14rem, 34vw, 26rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(46, 36, 26, 0.10);
  pointer-events: none;
  user-select: none;
}

.hero .wrap { position: relative; }

.hero .display { max-width: 9em; margin-bottom: 1.5rem; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.4rem;
  margin-top: 2.25rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.hero-meta .sep { color: var(--clay); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  background: transparent;
  transition: background 0.25s var(--ease-out), color 0.25s, transform 0.25s var(--ease-out), border-color 0.25s;
}

.btn:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }

.btn-clay {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--paper-card);
}

.btn-clay:hover { background: var(--clay-deep); border-color: var(--clay-deep); color: var(--paper-card); }

.btn .arrow { transition: transform 0.25s var(--ease-out); }
.btn:hover .arrow { transform: translateX(4px); }

/* ---------- Sections ---------- */

.section { padding-block: clamp(3.5rem, 8vh, 6.5rem); }

.section-deep {
  background: var(--paper-deep);
  border-block: 1px solid var(--line);
}

/* ---------- People cards (home) ---------- */

.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.person-card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2.5rem 2.25rem 2.25rem;
  box-shadow: 0 1px 2px rgba(46, 36, 26, 0.05);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.person-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px -18px rgba(46, 36, 26, 0.3);
}

.person-card:nth-child(2) { transform: translateY(1.5rem); }
.person-card:nth-child(2):hover { transform: translateY(calc(1.5rem - 6px)); }

.monogram {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--paper-card);
  background: var(--clay);
  margin-bottom: 1.4rem;
}

.monogram.olive { background: var(--olive); }
.monogram.gold { background: var(--gold); }
.monogram.small { width: 48px; height: 48px; font-size: 1.25rem; }

.person-card .role {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: 0.9rem;
}

.person-card p { color: var(--ink-soft); margin-bottom: 1.5rem; }

.card-link {
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid var(--clay);
  padding-bottom: 2px;
}

.card-link:hover { color: var(--clay-deep); }

/* ---------- Name origin strip ---------- */

.origin {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
}

.origin .hebrew-big {
  font-family: var(--font-hebrew);
  font-size: clamp(4rem, 9vw, 7rem);
  font-weight: 700;
  color: var(--clay);
  line-height: 1;
}

.origin blockquote {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  font-style: italic;
  font-weight: 460;
  line-height: 1.45;
  max-width: 26em;
}

.origin cite {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 1rem;
}

/* ---------- Timeline (Michael) ---------- */

.timeline {
  list-style: none;
  margin-top: 2.5rem;
  border-left: 2px solid var(--line);
  padding-left: 0;
}

.timeline li {
  position: relative;
  padding: 0 0 2.25rem 2.25rem;
}

.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.45em;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--clay);
}

.timeline .when {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clay);
}

.timeline h3 { margin-top: 0.3rem; }
.timeline p { color: var(--ink-soft); max-width: 42em; }

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.stat {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
}

.stat .num {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 600;
  color: var(--clay-deep);
  line-height: 1.1;
}

.stat .label {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 0.4rem;
}

/* ---------- Link list (profiles) ---------- */

.link-list {
  list-style: none;
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.link-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  background: var(--paper-card);
  transition: border-color 0.2s, transform 0.25s var(--ease-out);
}

.link-list a:hover { border-color: var(--clay); transform: translateY(-2px); }

/* ---------- Prose ---------- */

.prose { max-width: 46em; }
.prose p + p { margin-top: 1.1rem; }
.prose p { color: var(--ink-soft); }
.prose strong { color: var(--ink); }

/* ---------- Family tree ---------- */

.tree {
  margin-top: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tree-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.tree-node {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  min-width: 220px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(46, 36, 26, 0.05);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.tree-node:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px -16px rgba(46, 36, 26, 0.3);
}

.tree-node .monogram { margin: 0 auto 0.8rem; }

.tree-node .name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.tree-node .name a { color: inherit; text-decoration: none; }
.tree-node .name a:hover { color: var(--clay-deep); }

.tree-node .note { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.2rem; }

.tree-node.ghost {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
  color: var(--ink-faint);
}

.tree-node.ghost .name { color: var(--ink-faint); }

.tree-connector {
  width: 2px;
  height: 2.5rem;
  background: var(--line);
}

.tree-node.pet {
  border-radius: 999px;
  min-width: auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.tree-node.pet .name { font-size: 1rem; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 3rem;
  background: var(--paper-deep);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.site-footer p { font-size: 0.9rem; color: var(--ink-soft); }

.site-footer .origin-line .hebrew { color: var(--clay-deep); }

/* ---------- Reveal animations ---------- */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal.in { opacity: 1; transform: none; }

.hero .reveal { transition-duration: 0.9s; }
.hero .reveal:nth-child(1) { transition-delay: 0.05s; }
.hero .reveal:nth-child(2) { transition-delay: 0.18s; }
.hero .reveal:nth-child(3) { transition-delay: 0.31s; }
.hero .reveal:nth-child(4) { transition-delay: 0.44s; }

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

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .site-nav { gap: 1.1rem; }
  .site-nav a { font-size: 0.85rem; }
  .hero::before { font-size: 15rem; opacity: 0.6; }
  .person-card:nth-child(2) { transform: none; }
  .person-card:nth-child(2):hover { transform: translateY(-6px); }
  .origin { grid-template-columns: 1fr; text-align: left; }
}
