/* tsemach.dev — מערכת הסגנון
   כחול המסך של ה-800XL הוא הצבע המוביל; Rubik Pixels ו-Rubik הם אותן אותיות, פעם בפיקסלים ופעם חלקות. */

@font-face { font-family: Rubik; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url(/fonts/rubik-hebrew-wght-normal.woff2) format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Rubik; font-style: normal; font-display: swap; font-weight: 300 900;
  src: url(/fonts/rubik-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Rubik Pixels — מוקטן לאותיות שבשימוש בלבד (tools/fonts.mjs) */
@font-face { font-family: 'Rubik Pixels'; font-style: normal; font-display: block; font-weight: 400;
  src: url(/fonts/pixels-he.woff2) format('woff2'); unicode-range: U+0590-05FF; }
@font-face { font-family: 'Rubik Pixels'; font-style: normal; font-display: block; font-weight: 400;
  src: url(/fonts/pixels-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }

@property --scan { syntax: '<percentage>'; inherits: true; initial-value: 100%; }

:root {
  --screen: #1d4596;      /* כחול ה-READY */
  --screen-deep: #16377a;
  --phosphor: #b4cfff;    /* טקסט על המסך */
  --base: #0a1a3d;        /* לילה מעל המסך */
  --surface: #10255a;
  --ink: #eaf0ff;
  --muted: #a9b9dc;
  --amber: #ffb547;       /* קישורים ומיקוד */
  --line: rgb(180 207 255 / .2);

  --step--1: .889rem;
  --step-0: 1.125rem;
  --step-1: 1.5rem;
  --step-2: 2rem;
  --step-3: 2.667rem;
  --measure: 62ch;
  --gutter: clamp(1rem, 4vw, 3rem);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --base: #f2f5fb;
    --surface: #ffffff;
    --ink: #0b1a3a;
    --muted: #3f5078;
    --amber: #8f4700;
    --line: rgb(29 69 150 / .18);
    color-scheme: light;
  }
}

@media (prefers-contrast: more) {
  :root { --muted: var(--ink); --line: currentColor; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font: 400 var(--step-0)/1.65 Rubik, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
:lang(en) body, body:lang(en) { line-height: 1.55; }

h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }
img { display: block; max-width: 100%; height: auto; }

a { color: var(--amber); text-decoration-thickness: .08em; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .16em; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 2px; }
main:focus { outline: none; }

.skip {
  position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 10;
  background: var(--amber); color: #1a0f00; padding: .6rem 1rem; font-weight: 600;
}
.skip:focus { top: 1rem; }

/* ───────── המסך ───────── */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: max(1rem, env(safe-area-inset-top)) var(--gutter) clamp(1.5rem, 5vh, 3rem);
  background: radial-gradient(120% 90% at 50% 40%, var(--screen) 55%, var(--screen-deep));
  color: var(--phosphor);
  overflow: hidden;
  isolation: isolate;
}
/* קווי סריקה עדינים — דקורציה בלבד */
.hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgb(0 0 0 / .14) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
@media (prefers-contrast: more) { .hero::after { display: none; } }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.bar a { color: var(--phosphor); text-decoration: none; padding: .5rem 0; min-height: 44px; display: inline-flex; align-items: center; }
.bar a:hover { text-decoration: underline; }
.brand { font-family: 'Rubik Pixels', Rubik, monospace; font-size: var(--step-0); letter-spacing: .02em; }
.lang { font-weight: 500; }

.hero__body { align-self: end; padding-block: 2rem 0; }

.name {
  display: grid;
  font-size: clamp(4rem, 18vw, 15rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: .95;
  color: #fff;
}
.name:lang(he) { font-size: clamp(4rem, 23vw, 15rem); }
.name > span { grid-area: 1 / 1; }
.name__pixel { font-family: 'Rubik Pixels', Rubik, monospace; font-weight: 400; visibility: hidden; }

.tagline {
  margin-top: clamp(1rem, 3vh, 2rem);
  font-size: clamp(1.25rem, 1rem + 1.6vw, 2rem);
  font-weight: 400;
  line-height: 1.35;
  max-width: 24ch;
  color: var(--phosphor);
}

.ready, .boot { font-family: 'Rubik Pixels', Rubik, monospace; font-size: clamp(1.1rem, .9rem + 1vw, 1.6rem); letter-spacing: .04em; }
.ready {
  display: block; margin: 0 0 clamp(.5rem, 2vh, 1.25rem) auto; padding: .25rem 0; min-height: 44px;
  background: none; border: 0; color: inherit; cursor: pointer;
  direction: ltr; unicode-bidi: isolate;
}
[dir=ltr] .ready { margin-inline: 0 auto; }
.ready-static { font-family: 'Rubik Pixels', Rubik, monospace; font-size: clamp(1.1rem, .9rem + 1vw, 1.6rem); letter-spacing: .04em; text-align: left; margin-bottom: 1.5rem; max-width: none; }
.tagline a { color: #fff; }
.ready:hover { color: #fff; }
.cursor {
  display: inline-block; width: .7em; height: .9em; margin-inline-start: .1em;
  vertical-align: -.1em; background: currentColor;
  animation: blink 1s steps(1, end) 9; /* מפסיק אחרי ~5 שניות */
}
@keyframes blink { 50% { opacity: 0; } }

.boot, .skip-intro { display: none; }

/* ───────── הפתיח (רק כשמותר להזיז, ופעם אחת בביקור) ───────── */
.intro .hero {
  clip-path: inset(14svh 8vw 14svh round 28px);
  transition: clip-path 900ms var(--ease-out);
}
.intro body { background: #050c1f; }
.intro .boot {
  display: block; position: absolute; inset: 14svh 8vw; padding: clamp(1.25rem, 4vw, 3rem);
  direction: ltr; text-align: left;
}
.boot__line { margin: 0 0 .4em; }
.intro .hero__body, .intro .ready, .intro .bar { opacity: 0; }
.intro .skip-intro {
  display: block; position: absolute; bottom: calc(14svh + 1rem); inset-inline-end: calc(8vw + 1rem);
  background: transparent; color: var(--phosphor); border: 1px solid currentColor; border-radius: 4px;
  font: 500 var(--step--1) Rubik, sans-serif; padding: .6rem 1rem; min-height: 44px; cursor: pointer;
}

.intro.run .hero { clip-path: inset(0 0 0 round 0); }
.intro.run .boot { opacity: 0; transition: opacity 250ms; }
.intro.reveal .skip-intro { opacity: 0; transition: opacity 250ms; }

/* משחק הירי (src/game.js). השחקן שולט — הפתיח נמשך כל עוד הוא משחק */
.game { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; touch-action: none; cursor: crosshair; transition: opacity 300ms; }
.game--out { opacity: 0; pointer-events: none; }
.skip-intro { z-index: 3; }
.intro.reveal .hero__body { opacity: 1; }
.intro.reveal .name__pixel { visibility: visible; }
.intro.reveal .name__smooth { clip-path: inset(0 0 100% 0); }
.intro.run .skip-intro { bottom: 1.5rem; inset-inline-end: var(--gutter); }

/* קרן הסריקה: מעל הקו האותיות כבר חלקות, מתחתיו עדיין פיקסלים */
.intro.sweep .name { --scan: 100%; animation: scan 800ms cubic-bezier(.45, 0, .2, 1) both; position: relative; }
@keyframes scan { from { --scan: 0%; } to { --scan: 100%; } }
.intro.sweep .name__smooth { clip-path: inset(0 0 calc(100% - var(--scan)) 0); }
.intro.sweep .name__pixel { clip-path: inset(var(--scan) 0 0 0); }
.intro.sweep .name::after {
  content: ''; position: absolute; inset-inline: -2vw; top: var(--scan); height: 2px;
  background: #fff; box-shadow: 0 0 12px 3px rgb(180 207 255 / .9);
}

.intro.done .tagline, .intro.done .ready, .intro.done .bar { opacity: 1; transition: opacity 600ms; }
.intro.done .name::after { opacity: 0; transition: opacity 300ms; }
.intro .tagline { opacity: 0; }

/* ───────── התוכן ───────── */
main { padding-inline: var(--gutter); }
main > section { max-width: 72rem; margin-inline: auto; padding-block: clamp(3.5rem, 9vw, 7rem); border-top: 1px solid var(--line); }
main > section:first-child { border-top: 0; }

h2 {
  font-family: 'Rubik Pixels', Rubik, monospace;
  font-weight: 400;
  font-size: var(--step-3);
  letter-spacing: .01em;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.about { display: grid; gap: 1rem 3rem; }
.about__text p:first-child { font-size: var(--step-1); line-height: 1.45; color: var(--ink); }
.about__text p { color: var(--muted); }
@media (min-width: 52rem) {
  .about { grid-template-columns: 16rem 1fr; }
  .about h2 { margin: 0; }
}

/* תחומי התמחות */
.skills { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.skills li {
  color: var(--ink); font-weight: 500; font-size: var(--step--1);
  border: 1px solid var(--line); border-radius: 6px; padding: .35rem .8rem;
  background: color-mix(in srgb, var(--screen) 14%, transparent);
}
.upstream { margin-top: clamp(2rem, 5vw, 3rem); color: var(--muted); }

.projects { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); }
.project { position: relative; display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 60rem) {
  .projects:not(.projects--games) .project { grid-template-columns: 26rem 1fr; gap: 3rem; }
}

/* כל צילום מסך יושב בתוך "מסך" כחול, כמו בצג של פעם */
.shot {
  display: block; padding: clamp(6px, 1.2vw, 10px); border-radius: 16px;
  background: linear-gradient(160deg, var(--screen), var(--screen-deep));
  box-shadow: 0 1px 0 rgb(255 255 255 / .12) inset, 0 22px 44px -26px rgb(0 0 0 / .75);
}
.shot img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top;
  border-radius: 8px; background: var(--surface);
}

.project h3 { font-size: var(--step-2); font-weight: 700; margin-bottom: .5rem; }
.project__link { color: var(--ink); text-decoration: none; }
.project__link::after { content: ''; position: absolute; inset: 0; z-index: 1; border-radius: 10px; }
.project:hover .project__link { text-decoration: underline; text-decoration-thickness: .06em; }
.project__link:focus-visible { outline: none; }
.project__link:focus-visible::after { outline: 3px solid var(--amber); outline-offset: 8px; }
.project p { color: var(--muted); }

.stack { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 1rem; }
.stack li {
  font-size: var(--step--1); color: var(--muted);
  border: 1px solid var(--line); border-radius: 99px; padding: .15rem .7rem;
}

.code {
  position: relative; z-index: 2;
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
  font-weight: 500;
}
.code svg { flex: none; }
[dir=rtl] .code svg { transform: scaleX(-1); }

.games__head { display: grid; gap: .5rem 3rem; margin-bottom: clamp(1.5rem, 4vw, 2.5rem); }
.games__head h2 { margin: 0; }
.games__head p { color: var(--muted); margin: 0; }
@media (min-width: 52rem) { .games__head { grid-template-columns: minmax(16rem, max-content) 1fr; align-items: end; } }

.projects--games { gap: clamp(2.5rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 44rem) { .projects--games { grid-template-columns: 1fr 1fr; } }
.projects--games .project h3 { font-size: var(--step-1); }

.contact p { color: var(--muted); }
.contact__mail { font-size: clamp(1.5rem, 1rem + 3vw, 2.667rem); font-weight: 600; margin-top: 1.5rem; direction: ltr; unicode-bidi: isolate; }
[dir=rtl] .contact__mail { text-align: right; }
.contact__mail a { color: var(--ink); }
.contact__mail a:hover { color: var(--amber); }
.links { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.links a { display: inline-flex; min-height: 44px; align-items: center; font-weight: 500; }

.foot {
  max-width: 72rem; margin: 0 auto; padding: 2rem var(--gutter) max(2rem, env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--line); color: var(--muted); font-size: var(--step--1);
}
.foot p { margin: 0; }

/* מעבר בין עברית לאנגלית */
@view-transition { navigation: auto; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ───────── הפתיח בלי תנועה (הפחתת תנועה במערכת) ─────────
   אין הגדלה של המסך ואין קרן סריקה; רק הקלדה ומעבר שקיפות מפיקסלים לאותיות חלקות. */
.intro.calm .hero { clip-path: none; transition: none; }
.intro.calm body { background: var(--base); }
.intro.calm .boot { inset: 0; padding: clamp(4.5rem, 12vh, 7rem) var(--gutter); }
.intro.calm .skip-intro { bottom: 1.5rem; inset-inline-end: var(--gutter); }
.intro.calm .name__pixel, .intro.calm .name__smooth { clip-path: none; transition: opacity 700ms ease; }
.intro.calm.reveal .name__smooth { clip-path: none; opacity: 0; }
.intro.calm.sweep .name { animation: none; }
.intro.calm.sweep .name::after { display: none; }
.intro.calm.sweep .name__smooth { clip-path: none; opacity: 1; }
.intro.calm.sweep .name__pixel { clip-path: none; opacity: 0; }

@media print {
  .hero { min-height: auto; background: none; color: #000; }
  .hero::after, .ready, .bar, .shot, .skip { display: none; }
  .name { color: #000; }
}
