:root {
  --bg: #100d0b;
  --bg-soft: #1a1512;
  --ink: #efe6d6;
  --ink-dim: #a99c88;
  --ochre: #d98a2b;
  --ember: #c4472a;
  --teal: #2f8f8a;
  --line: rgba(239, 230, 214, .14);
  --display: "Karantina", "Heebo", sans-serif;
  --text: "Heebo", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ראש הדף */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--gutter);
  background: linear-gradient(var(--bg) 55%, transparent);
}

.mark {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
  letter-spacing: .02em;
}
.mark { display: inline-flex; align-items: center; }
.mark img { display: block; margin-inline-end: .4em; }
.mark-text { white-space: nowrap; font-size: clamp(24px, 3.2vw, 40px); letter-spacing: .015em; }
.mark-text i { font-style: normal; color: var(--ochre); }

.top nav { display: flex; gap: 26px; font-size: 15px; font-weight: 400; }
.top nav a { color: var(--ink-dim); transition: color .2s; }
.top nav a:hover, .top nav a:focus-visible { color: var(--ink); }

/* פתיחה */

.hero {
  padding: clamp(48px, 8vw, 120px) var(--gutter) 0;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  column-gap: var(--gutter);
  align-items: end;
}

.eyebrow {
  grid-column: 1 / -1;
  margin: 0 0 6px;
  font-size: 14px; font-weight: 500;
  letter-spacing: .08em;
  color: var(--ochre);
}
.eyebrow span { letter-spacing: .28em; margin-inline-start: .9em; }

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(74px, 12vw, 210px);
  white-space: nowrap;
  line-height: .8;
  letter-spacing: .005em;
}

.lead {
  margin: 0 0 .5em;
  max-width: 30ch;
  font-size: clamp(17px, 1.5vw, 21px);
  color: var(--ink-dim);
}

/* הפסיפס */

.mosaic, .years { scroll-margin-top: 64px; }

.mosaic { padding: 0 var(--gutter); }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ar, 110 / 67);
  background: var(--bg-soft);
  overflow: hidden;
  cursor: zoom-in;
  touch-action: pan-y;
  user-select: none;
}
.stage.zoomed { cursor: grab; touch-action: none; }
.stage.dragging { cursor: grabbing; }

#canvas { display: block; width: 100%; height: 100%; }

.tip {
  position: absolute; z-index: 2;
  padding: 2px 9px;
  background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 500; line-height: 1.6;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  white-space: nowrap;
}

.controls {
  position: absolute; z-index: 3;
  inset-block-end: 14px; inset-inline-start: 14px;
  display: flex; gap: 1px;
  background: var(--line);
}
.controls button {
  min-width: 44px; height: 44px;
  border: 0; padding: 0 14px;
  background: rgba(16, 13, 11, .86);
  color: var(--ink);
  font: 500 20px/1 var(--text);
  cursor: pointer;
  transition: background .2s;
}
.controls button.wide { font-size: 14px; }
.controls button:hover, .controls button:focus-visible { background: var(--ember); outline: 0; }

.under {
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding-top: 14px;
  font-size: 15px; color: var(--ink-dim);
}
.under p { margin: 0; }
.count { font-weight: 500; color: var(--ink); }
.hint-touch { display: none; }

.demo {
  margin: 14px 0 0; padding: 10px 14px;
  border-inline-start: 3px solid var(--ochre);
  background: var(--bg-soft);
  font-size: 14px; color: var(--ink-dim);
}

/* השנים */

.years { padding: clamp(72px, 11vw, 168px) var(--gutter) 0; }

.years > h2 {
  margin: 0 0 clamp(28px, 5vw, 64px);
  font-family: var(--display); font-weight: 400;
  font-size: clamp(40px, 6vw, 84px); line-height: 1;
  color: var(--ink-dim);
}

.era {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
  gap: 20px var(--gutter);
  padding: clamp(28px, 4vw, 52px) 0 clamp(52px, 8vw, 116px);
  border-top: 1px solid var(--line);
}

.era-range {
  margin: 0; text-align: right;
  font-size: 14px; font-weight: 500; letter-spacing: .22em;
  color: var(--ochre);
}
.era-range:not([dir]) { letter-spacing: .12em; }
.era:nth-of-type(2) .era-range { color: var(--teal); }
.era:nth-of-type(3) .era-range { color: var(--ember); }

.era h3 {
  margin: 4px 0 0;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(64px, 9vw, 148px); line-height: .85;
}

.era-body { max-width: 52ch; align-self: end; }
.era-body p { margin: 0 0 .9em; }

.era-photos {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: clamp(84px, 12vw, 190px);
  grid-auto-flow: dense;
  gap: 6px;
  margin-top: 12px;
}

.era-photos button {
  position: relative;
  padding: 0; border: 0; overflow: hidden;
  background: var(--bg-soft);
  cursor: pointer;
}
.era-photos button:nth-child(7n + 1) { grid-column: span 2; grid-row: span 2; }
.era-photos button:nth-child(7n + 5) { grid-column: span 2; }
.era-photos img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s ease, filter .3s;
  filter: saturate(.9);
}
.era-photos button:hover img, .era-photos button:focus-visible img { transform: scale(1.04); filter: none; }
.era-photos button:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }
.era-photos span {
  position: absolute; inset-block-end: 6px; inset-inline-start: 8px;
  font-size: 12px; font-weight: 500; letter-spacing: .08em;
  color: var(--ink); text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}

/* כפר הנוקדים */

.desert {
  margin-top: clamp(24px, 4vw, 56px);
  padding: 0 var(--gutter);
  background: linear-gradient(#1d1610, var(--bg) 85%);
  border-top: 1px solid var(--line);
  scroll-margin-top: 56px;
}
.desert .era { border-top: 0; padding-top: clamp(40px, 6vw, 88px); }
.desert .era-range { letter-spacing: .12em; }
.desert h2 {
  margin: 4px 0 0;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(64px, 10vw, 168px); line-height: .85;
  color: var(--ink);
}
.marina { margin-top: 0; }
.marina .era-range { color: var(--ember); }
.marina h2 { font-size: clamp(54px, 6.4vw, 104px); line-height: .9; }
.desert-sub { margin: 14px 0 0; font-size: 15px; font-weight: 500; color: var(--ink-dim); }

/* סיום חגיגי */

.finale {
  padding: clamp(72px, 12vw, 176px) var(--gutter) clamp(64px, 10vw, 144px);
  text-align: center;
  background: radial-gradient(ellipse 70% 60% at 50% 55%, rgba(217, 138, 43, .2), transparent 70%);
  border-top: 1px solid var(--line);
}
.finale .eyebrow { margin: 0 0 10px; }
.finale h2 {
  margin: 0;
  font-family: var(--display); font-weight: 700;
  font-size: clamp(74px, 14vw, 232px); line-height: .8;
}
.finale p { margin: 28px auto 0; max-width: 44ch; font-size: clamp(17px, 1.5vw, 21px); color: var(--ink-dim); }
.finale .thanks {
  margin-top: 22px;
  font-family: var(--display); font-weight: 400;
  font-size: clamp(30px, 4.4vw, 60px); line-height: 1; letter-spacing: .01em;
  color: var(--ochre); max-width: none;
}

/* תחתית */

.foot {
  display: flex; justify-content: space-between; align-items: baseline; gap: 20px; flex-wrap: wrap;
  padding: 28px var(--gutter) 40px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim); font-size: 15px;
}
.foot p { margin: 0; }
.foot .mark { color: var(--ink); }
.foot .credit { flex-basis: 100%; font-size: 13px; letter-spacing: .04em; }
.foot .credit a { color: var(--ink); font-weight: 500; border-bottom: 1px solid var(--line); transition: color .2s, border-color .2s; }
.foot .credit a:hover, .foot .credit a:focus-visible { color: var(--ochre); border-color: var(--ochre); outline: 0; }

/* תמונה מוגדלת */

.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(10, 8, 7, .96);
  color: var(--ink);
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; }

.lightbox figure {
  margin: 0; height: 100dvh;
  padding: 56px 0 22px;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px;
  justify-items: center;
}
.lightbox img { max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; }
.lightbox figcaption { font-size: 15px; color: var(--ink-dim); text-align: center; min-height: 1.7em; }
.lightbox figcaption b { color: var(--ochre); font-weight: 500; letter-spacing: .1em; margin-inline-end: .7em; }

.lb-close, .lb-nav {
  border: 0; background: none; color: var(--ink);
  font: 300 44px/1 var(--text);
  cursor: pointer; opacity: .7; transition: opacity .2s;
}
.lb-close:hover, .lb-nav:hover, .lb-close:focus-visible, .lb-nav:focus-visible { opacity: 1; outline: 0; color: var(--ochre); }
.lb-close { position: absolute; inset-block-start: 8px; inset-inline-start: 14px; width: 48px; height: 48px; z-index: 2; }
.lb-nav { height: 96px; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero { grid-template-columns: 1fr; row-gap: 22px; }
  /* בטלפון הדיוקן ממלא את כל המסך, מקצה לקצה ולכל הגובה שמתחת לכותרת */
  .mosaic { padding: 0; }
  .stage { aspect-ratio: auto; height: calc(100vh - 60px); height: calc(100svh - 60px); }
  .under, .demo { margin-inline: 16px; }
  .hint-touch { display: inline; }
  .top nav { gap: 13px; font-size: 14px; white-space: nowrap; }
  .top .mark { font-size: 26px; }
  .top .mark img { width: 32px; height: 32px; }
  .top nav { display: none; }
  .era { grid-template-columns: 1fr; }
  .era-photos { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 28vw; }
  .controls button.wide { display: none; }
  .lightbox[open] { grid-template-columns: 44px minmax(0, 1fr) 44px; }
}

@media (max-width: 360px) {
  .mark-text { font-size: 21px; }
}

/* טלפון לרוחב: הדיוקן בגובה המסך ולא גולש מתחתיו */
@media (orientation: landscape) and (max-height: 520px) {
  .stage { aspect-ratio: auto; height: calc(100vh - 60px); height: calc(100svh - 60px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .era-photos img { transition: none; }
}
