/* ==========================================================================
   Noam Kires — personal site
   Logical properties (inline-start/end) are used throughout so the same
   rules work for Hebrew (RTL) and English (LTR).
   ========================================================================== */

:root {
  --bg: #f5f2eb;
  --surface: #fbf9f4;
  --ink: #1d2420;
  --ink-soft: #3f4842;
  --muted: #5d655f;
  --line: #ddd7ca;
  --green: #2c5a46;
  --green-deep: #1f4334;
  --green-soft: #e6ebe2;
  --on-green: #f5f2eb;
  --on-green-muted: #c9d6cd;
  /* Secondary accent: used sparingly for numbering, the hero mark and active states. */
  --clay: #a64b26;
  --sand: #ece5d8;

  --font-body: "Assistant", "Segoe UI", system-ui, -apple-system, sans-serif;

  --wrap: 1140px;
  --gutter: clamp(20px, 5vw, 40px);
  --header-h: 72px;
  --radius: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

/* Saved language is English: hide until content is swapped (see inline script in <head>).
   The animation reveals the page after 1s even if the script never runs, so it can't stay blank. */
.i18n-pending body {
  visibility: hidden;
  animation: nk-reveal 0s linear 1s forwards;
}
@keyframes nk-reveal { to { visibility: visible; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
html:lang(en) body { line-height: 1.6; }

img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 4px;
}
main:focus { outline: none; }
::selection { background: rgba(166, 75, 38, .18); }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -100px;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

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

h1, h2, .brand-name {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1 {
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  line-height: 1.1;
  max-width: 15ch;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.75rem, 2.8vw, 2.3rem);
  line-height: 1.2;
  text-wrap: balance;
}
h3 {
  font-size: 1.3rem;
  line-height: 1.35;
  font-weight: 700;
}
h4 { font-size: 1.05rem; font-weight: 700; line-height: 1.4; }

html:lang(en) h1 { letter-spacing: -0.02em; max-width: 15ch; }
html:lang(en) h2 { letter-spacing: -0.02em; }

.eyebrow {
  font-size: .875rem;
  font-weight: 600;
  color: var(--green);
  margin-block-end: 10px;
}
html:lang(en) .eyebrow { letter-spacing: .04em; }

.lead {
  font-size: clamp(1.125rem, 1.6vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 34em;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: var(--on-green); }
.btn-primary:hover { background: var(--green-deep); }
.btn-ghost { border-color: #b9b3a5; color: var(--ink); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); background: rgba(44, 90, 70, .06); }
.btn-arrow::after {
  content: "→";
  display: inline-block;
  margin-inline-start: 10px;
  transition: transform .2s var(--ease);
}
html[dir="rtl"] .btn-arrow::after { content: "←"; }
.btn-arrow:hover::after { transform: translateX(3px); }
html[dir="rtl"] .btn-arrow:hover::after { transform: translateX(-3px); }
.btn-light { background: var(--on-green); color: var(--green-deep); }
.btn-light:hover { background: #fff; }
.contact .btn:focus-visible { outline-color: var(--on-green); }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 242, 235, .92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-block-end: 1px solid var(--line);
}
.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  margin-inline-end: auto;
}
.brand-name { font-size: 1.3rem; font-weight: 700; }
.brand-name::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-inline-start: 3px;
  border-radius: 50%;
  background: var(--clay);
}
.brand-role { font-size: .9rem; color: var(--muted); }

.site-nav ul { display: flex; gap: 28px; }
.site-nav a {
  position: relative;
  display: inline-block;
  padding-block: 6px;
  text-decoration: none;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color .2s var(--ease);
}
.site-nav a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: var(--clay);
  transform: scaleX(0);
  transition: transform .25s var(--ease);
}
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); }
.site-nav a:hover::after, .site-nav a[aria-current]::after { transform: scaleX(1); }

.header-tools { display: flex; align-items: center; gap: 12px; }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: .9rem;
}
.lang-switch button {
  background: none;
  border: 0;
  padding: 8px 8px;
  min-height: 40px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
  border-radius: 6px;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--clay);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.lang-sep { color: var(--line); }

.menu-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .25s var(--ease), background-color .25s var(--ease);
}
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; inset-inline-start: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.menu-open .menu-icon { background: transparent; }
.menu-open .menu-icon::before { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-icon::after { transform: translateY(-6px) rotate(-45deg); }

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

.hero { padding-block: clamp(56px, 9vw, 112px) clamp(56px, 7vw, 96px); }
.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: end;
}
.hero-main h1::before {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  margin-block-end: 24px;
  border-radius: 2px;
  background: var(--clay);
}
.hero-copy .lead { max-width: 30em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 32px; }

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

.section {
  padding-block: clamp(56px, 8vw, 96px);
  border-block-start: 1px solid var(--line);
}
.section-head { max-width: 680px; margin-block-end: clamp(28px, 4vw, 44px); }

/* ---------- Services ---------- */

#services { background: var(--sand); border-block-start-color: transparent; }

.services {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-block-start: 1px solid var(--ink);
}
.service {
  display: flex;
  flex-direction: column;
  padding-block: 28px 32px;
  padding-inline: 0 48px;
  border-block-end: 1px solid var(--line);
}
.service:nth-child(even) {
  padding-inline: 48px 0;
  border-inline-start: 1px solid var(--line);
}
.service:nth-last-child(-n + 2) { border-block-end: 0; }
.service-num {
  display: block;
  font-size: .95rem;
  font-weight: 700;
  color: var(--clay);
  margin-block-end: 10px;
}
.service h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-block-end: 10px;
}
.service > p { color: var(--ink-soft); max-width: 34em; }

/* ---------- Projects ---------- */

#projects { border-block-start: 0; }
.projects { display: grid; gap: 20px; }
.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
  gap: clamp(20px, 5vw, 72px);
  padding: clamp(24px, 4vw, 44px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--green);
  border-radius: var(--radius);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.project:hover {
  border-inline-start-color: var(--clay);
  box-shadow: 0 10px 28px rgba(29, 36, 32, .06);
}
.project-num {
  display: block;
  font-size: .95rem;
  font-weight: 700;
  color: var(--clay);
  margin-block-end: 10px;
}
.project-stack {
  font-size: .9rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.7;
}
/* Tech names read left-to-right but stay aligned with the Hebrew column. */
html[dir="rtl"] .project-stack[dir="ltr"] { text-align: right; }
.project-body { max-width: 42em; }
.project-body h3 {
  font-size: clamp(1.4rem, 2.1vw, 1.65rem);
  font-weight: 700;
  line-height: 1.25;
  margin-block-end: 14px;
}
.project-body p { color: var(--ink-soft); }
.project-body p + p { margin-block-start: 10px; }

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
}
.portrait img,
.portrait-placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  object-fit: cover;
}
.portrait-placeholder {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(44, 90, 70, .05) 14px 15px),
    var(--green-soft);
  border: 1px dashed #b5c2b6;
  color: var(--muted);
  font-size: .95rem;
  text-align: center;
  padding: 24px;
}
.about-text h2 { margin-block-end: 20px; }
.about-text p:not(.eyebrow) { color: var(--ink-soft); max-width: 36em; font-size: 1.125rem; }
.about-text p + p { margin-block-start: 14px; }
.about-text p:last-child {
  margin-block-start: 22px;
  padding-inline-start: 20px;
  border-inline-start: 2px solid var(--clay);
  color: var(--ink);
}

/* ---------- Contact ---------- */

.contact {
  background: var(--green-deep);
  color: var(--on-green);
  padding-block: clamp(64px, 9vw, 112px);
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: end;
}
.contact .eyebrow { color: var(--on-green-muted); }
.contact h2 { color: var(--on-green); margin-block-end: 20px; }
.contact-text {
  color: var(--on-green-muted);
  font-size: 1.2rem;
  max-width: 32em;
  margin-block-end: 8px;
}
.contact-text:last-of-type { margin-block-end: 36px; }

.contact-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-block: 16px;
  border-block-start: 1px solid rgba(245, 242, 235, .18);
}
.contact-list li:last-child { border-block-end: 1px solid rgba(245, 242, 235, .18); }
.contact-label { font-size: .85rem; color: var(--on-green-muted); }
.contact-list a {
  font-size: 1.15rem;
  font-weight: 500;
  text-decoration: none;
  /* Keep LTR values (email, phone, URL) aligned with the surrounding text in RTL. */
  align-self: flex-start;
  unicode-bidi: isolate;
}
.contact-list a:hover { text-decoration: underline; text-underline-offset: 4px; }
.contact-list a:focus-visible { outline-color: var(--on-green); }

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

.site-footer {
  background: var(--green-deep);
  color: var(--on-green-muted);
  border-block-start: 1px solid rgba(245, 242, 235, .12);
  font-size: .9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding-block: 24px;
}
.footer-dot { margin-inline: 6px; }
.site-footer a { text-underline-offset: 4px; }
.site-footer a:hover { color: var(--on-green); }
.site-footer a:focus-visible { outline-color: var(--on-green); }

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

@media (max-width: 900px) {
  .hero-main,
  .about-grid,
  .contact-grid { grid-template-columns: 1fr; }
  .hero-main { gap: 24px; }
  .services { grid-template-columns: 1fr; }
  .service,
  .service:nth-child(even) {
    padding: 28px 0 32px;
    border-inline-start: 0;
    border-block-end: 1px solid var(--line);
  }
  .service:nth-last-child(-n + 2) { border-block-end: 1px solid var(--line); }
  .service:last-child { border-block-end: 0; }

  .portrait { max-width: 220px; }
}

@media (max-width: 820px) {
  :root { --header-h: 64px; }
  .menu-toggle { display: inline-flex; }

  .site-nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: var(--bg);
    border-block-end: 1px solid var(--line);
    box-shadow: 0 16px 32px rgba(29, 36, 32, .08);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s linear .2s;
  }
  .menu-open .site-nav {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 8px var(--gutter) 16px;
  }
  .site-nav li + li { border-block-start: 1px solid var(--line); }
  .site-nav a { display: block; padding-block: 14px; font-size: 1.1rem; }
  .site-nav a::after { display: none; }
}

@media (max-width: 560px) {
  .brand-role { display: none; }
  .project { grid-template-columns: 1fr; gap: 12px; }
  .actions .btn { flex: 1 1 auto; }
}

@media print {
  .site-header, .skip-link { display: none; }
  .contact, .site-footer { background: none; color: var(--ink); }
  .contact h2, .contact .eyebrow, .contact-text, .contact-label { color: var(--ink); }
}
