/* ---------- Tokens ---------- */
:root {
  --sand: #f6f1ea;
  --sand-2: #ede4d6;
  --paper: #fffdf9;
  --ink: #2a2420;
  --muted: #6b6058;
  --line: #e2d8c9;
  --sky-1: #a9cbe9;
  --sky-2: #e6f0f8;
  --accent: #b4612a;       /* desert rock */
  --accent-ink: #8f4a1d;
  --mustard: #d9a42b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(42, 36, 32, .06), 0 8px 24px rgba(42, 36, 32, .08);
  --shadow-hover: 0 2px 4px rgba(42, 36, 32, .08), 0 16px 40px rgba(42, 36, 32, .14);
  --serif: "Fraunces", "Frank Ruhl Libre", Georgia, serif;
  --sans: "Heebo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--sand);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0; }
[lang="he"] { font-family: "Heebo", var(--sans); }
h1[lang="he"], h2[lang="he"], h3[lang="he"], .he-serif { font-family: "Frank Ruhl Libre", var(--serif); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {   /* hidden above the page; never off to the side, which widens RTL pages */
  position: absolute; top: -100px; inset-inline-start: 8px; z-index: 100;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: min(var(--max), 100% - 40px); margin-inline: auto; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  transition: background .25s, box-shadow .25s, backdrop-filter .25s;
}
.topbar.scrolled, .topbar.solid {
  background: rgba(246, 241, 234, .88);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  box-shadow: 0 1px 0 var(--line);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { text-decoration: none; font-family: var(--serif); font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.brand span { font-family: "Frank Ruhl Libre", var(--serif); letter-spacing: .04em; margin-inline-start: .6em; opacity: .7; }
@media (max-width: 480px) {
  .brand { font-size: .92rem; letter-spacing: .08em; }
  .brand span { display: none; }
}
.nav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 6px 10px; border-radius: 999px;
  text-decoration: none; font-size: .86rem; color: var(--ink); opacity: .85;
  transition: background .2s, opacity .2s;
}
.nav a:hover { background: rgba(42, 36, 32, .07); opacity: 1; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--ink); }
.nav-toggle svg { width: 26px; height: 26px; }

@media (max-width: 1000px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 64px; inset-inline: 12px;
    flex-direction: column; padding: 10px;
    background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-hover);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 14px; font-size: 1rem; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(100vh, 920px);
  padding: 110px 0 140px;
  display: grid; align-items: center;
  background: linear-gradient(180deg, var(--sky-1) 0%, #c7ddf0 35%, var(--sky-2) 62%, var(--sand) 100%);
}
.hero::after {               /* desert panorama along the bottom */
  content: ""; position: absolute; inset: auto 0 0 0; height: 46%;
  background: url("assets/img/desert.webp") center bottom / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 45%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 45%);
  opacity: .95; pointer-events: none;
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 5fr 6fr; gap: clamp(28px, 5vw, 64px); align-items: center;
}
.portrait {
  border-radius: 24px; overflow: hidden; box-shadow: 0 24px 60px rgba(42, 36, 32, .22);
  aspect-ratio: 900 / 975; max-width: 440px; justify-self: end; width: 100%;
  transform: rotate(-1.5deg);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.hero-panel {
  background: rgba(255, 253, 249, .72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 24px; padding: clamp(24px, 4vw, 44px);
  box-shadow: var(--shadow);
}
.eyebrow { font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; margin: 0 0 10px; }
.hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); letter-spacing: -.01em; }
.hero h1 .he { display: block; font-family: "Frank Ruhl Libre", var(--serif); font-size: .5em; color: var(--muted); margin-top: 6px; }
.tagline { font-size: 1.15rem; color: var(--muted); margin: 14px 0 26px; }
.tagline b { color: var(--ink); font-weight: 600; }
.pill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 26px; }
.pill {
  display: flex; align-items: center; gap: .35em;
  padding: 11px 16px; border-radius: 12px;
  background: var(--paper); border: 1px solid var(--line);
  text-decoration: none; font-size: .92rem; font-weight: 500;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.pill:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pill::after { content: "→"; color: var(--accent); margin-inline-start: auto; padding-inline-start: 8px; transition: transform .15s; }
.pill:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.pill:hover::after { transform: translateX(3px); }

@media (max-width: 820px) {
  .hero { padding-top: 96px; min-height: 0; }
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { justify-self: center; max-width: 280px; transform: none; }
  .pill-grid { grid-template-columns: 1fr; }
}

/* ---------- Socials ---------- */
.socials { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.socials a { display: block; width: 40px; height: 40px; border-radius: 50%; transition: transform .15s, opacity .15s; }
.socials a:hover { transform: translateY(-2px); opacity: .8; }
.socials img { width: 100%; height: 100%; }
@media (max-width: 420px) {
  .socials { gap: 6px; }
  .socials a { width: 32px; height: 32px; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section.alt { background: var(--paper); }
.section-head { max-width: 880px; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.section-head h2::after {
  content: ""; display: block; width: 48px; height: 3px; border-radius: 2px;
  background: var(--mustard); margin-top: 14px;
}
.section-head[dir="rtl"] { margin-inline-start: auto; }
.section-head p { color: var(--muted); margin: 16px 0 0; font-size: 1.05rem; }
.section-head a { color: var(--accent-ink); }

.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; max-width: 820px; } }

/* ---------- Cards ---------- */
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--paper); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
.section.alt .card { background: var(--sand); }
a.card:hover, .card:focus-within { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.card-media { aspect-ratio: 16 / 10; background: #fff; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card-media.contain img { object-fit: contain; padding: 10px; }
a.card:hover .card-media img { transform: scale(1.03); }
.card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.kicker { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; }
.card h3 { font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.5; }
.card[dir="rtl"] .kicker { letter-spacing: .02em; }

.card.more {
  align-items: center; justify-content: center; text-align: center; min-height: 180px;
  background: transparent; box-shadow: none; border: 2px dashed var(--line);
  font-family: var(--serif); font-size: 1.2rem; color: var(--accent-ink); gap: 6px;
}
.section.alt .card.more { background: transparent; }
.card.more span { font-size: 1.6rem; transition: transform .2s; }
.card.more:hover { border-color: var(--accent); background: rgba(180, 97, 42, .05); }
.card.more:hover span { transform: translateX(4px); }
[dir="rtl"] .card.more:hover span, .card.more[dir="rtl"]:hover span { transform: translateX(-4px); }

/* GitHub repo cards */
.card.repo { border-top: 4px solid var(--ink); }
.card.repo .card-body { padding: 22px 22px 20px; gap: 10px; }
.repo-owner { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.repo-owner img { width: 20px; height: 20px; }
.card.repo h3 { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
.card.repo p { flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tags li { font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: rgba(180, 97, 42, .1); color: var(--accent-ink); }
.lang { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.lang i { width: 10px; height: 10px; border-radius: 50%; }

/* YouTube facade */
.yt {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0;
  background: #000 center / cover no-repeat; cursor: pointer;
}
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: .92; transition: opacity .2s; }
.yt:hover img { opacity: 1; }
.yt::after {
  content: ""; position: absolute; inset: 50% auto auto 50%; width: 68px; height: 48px; transform: translate(-50%, -50%);
  border-radius: 14px; background: rgba(42, 36, 32, .82) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center / 28px no-repeat;
  transition: background-color .2s;
}
.yt:hover::after { background-color: #c4302b; }
.yt-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Spotify */
.spotify { width: 100%; height: 152px; border: 0; border-radius: 12px; display: block; }
.podcast-card { padding: 12px; }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: 180px 1fr; gap: 36px; align-items: center;
  background: var(--paper); border-radius: 24px; padding: clamp(24px, 4vw, 44px); box-shadow: var(--shadow);
}
.about > img { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; object-position: center 20%; }
.about p { margin: 0 0 14px; font-size: 1.1rem; }
.about .muted { color: var(--muted); font-size: 1rem; }
@media (max-width: 640px) {
  .about { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .about .socials { justify-content: center; }
}

/* ---------- Footer ---------- */
.footer { padding: 32px 0 40px; color: var(--muted); font-size: .9rem; }
.footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a { color: var(--muted); }

/* ---------- Sub-pages ---------- */
.page-hero {
  position: relative; padding: 120px 0 70px; overflow: hidden;
  background: linear-gradient(180deg, var(--sky-1), var(--sky-2) 70%, var(--sand));
}
.page-hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 70%;
  background: url("assets/img/desert.webp") center bottom / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 60%); mask-image: linear-gradient(180deg, transparent, #000 60%);
  opacity: .55; pointer-events: none;
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.page-hero p { max-width: 680px; font-size: 1.12rem; color: var(--ink); margin: 16px 0 0; }
.page-hero a { color: var(--accent-ink); }
.num {
  position: absolute; top: 10px; inset-inline-start: 10px; z-index: 1;
  background: rgba(42, 36, 32, .82); color: #fff; font-size: .78rem; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
}
.prose { max-width: 760px; }
.prose h2 { font-size: 1.5rem; margin: 36px 0 10px; }
.prose p, .prose li { color: var(--ink); }

/* Blur is costly on phones; use a solid panel instead */
@media (max-width: 820px) {
  .hero-panel, .topbar.scrolled, .topbar.solid { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .hero-panel { background: rgba(255, 253, 249, .94); }
  .topbar.scrolled, .topbar.solid { background: rgba(246, 241, 234, .97); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
