/* ==========================================================
   Adin Aviv — personal site
   ========================================================== */

:root {
  --bg: #f6f5f1;
  --bg-alt: #eeede7;
  --surface: #ffffff;
  --ink: #16181d;
  --ink-soft: #33373f;
  --muted: #5d626c;
  --line: #dfddd5;
  --accent: #0d7a66;
  --accent-ink: #ffffff;
  --accent-soft: rgba(13, 122, 102, 0.1);
  --trace: #0d7a66;
  --grid: rgba(22, 24, 29, 0.06);
  --shadow: 0 1px 2px rgba(22, 24, 29, 0.05), 0 8px 24px -12px rgba(22, 24, 29, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --max: 1120px;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --bg-alt: #13161a;
    --surface: #181c21;
    --ink: #eceef1;
    --ink-soft: #c9cdd4;
    --muted: #9aa1ac;
    --line: #2a2f37;
    --accent: #3fd6a0;
    --accent-ink: #0b1210;
    --accent-soft: rgba(63, 214, 160, 0.12);
    --trace: #3fd6a0;
    --grid: rgba(236, 238, 241, 0.05);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013;
  --bg-alt: #13161a;
  --surface: #181c21;
  --ink: #eceef1;
  --ink-soft: #c9cdd4;
  --muted: #9aa1ac;
  --line: #2a2f37;
  --accent: #3fd6a0;
  --accent-ink: #0b1210;
  --accent-soft: rgba(63, 214, 160, 0.12);
  --trace: #3fd6a0;
  --grid: rgba(236, 238, 241, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }
.mono { font-family: var(--mono); }
.small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 0.95rem; text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { border-color: transparent; color: var(--accent); }
.btn-small { padding: 7px 16px; font-size: 0.88rem; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); font-weight: 500; font-size: 0.95rem; text-decoration: none;
  background: none; border: 0; padding: 0;
}
.link-arrow::after { content: "→"; transition: transform 0.15s ease; }
.link-arrow:hover::after { transform: translateX(3px); }
.link-arrow:hover { text-decoration: underline; }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.nav { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 0.8rem; font-weight: 500;
}
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links a:not(.btn) {
  display: block; padding: 8px 12px; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none; font-size: 0.93rem; font-weight: 500;
}
.nav-links a:not(.btn):hover { color: var(--ink); background: var(--accent-soft); }
.nav-links a.active { color: var(--accent); }
.nav-links .btn { margin-left: 8px; }

.theme-toggle {
  display: grid; place-items: center; width: 38px; height: 38px; margin-left: 4px;
  border-radius: 50%; border: 1px solid var(--line); background: transparent;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

.nav-toggle { display: none; width: 42px; height: 42px; border: 0; background: none; padding: 10px; }
.nav-toggle span { display: block; height: 2px; background: var(--ink); margin: 5px 0; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px 16px 20px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a:not(.btn) { padding: 12px 8px; border-radius: var(--radius-sm); }
  .nav-links .btn { margin: 10px 0 0; }
  .theme-toggle { margin: 12px 0 0; }
}

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 88px; }
.hero-scope { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scope-grid path { stroke: var(--grid); stroke-width: 1; }
.scope-trace {
  fill: none; stroke: var(--trace); stroke-width: 2; opacity: 0.35;
  vector-effect: non-scaling-stroke;
}
.hero-inner {
  position: relative;
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 56px; align-items: center;
}
.eyebrow { color: var(--accent); font-size: 0.85rem; letter-spacing: 0.04em; margin-bottom: 14px; }
.hero h1 { font-size: clamp(2.8rem, 7vw, 4.8rem); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 18px; }
.hero-lead { font-size: clamp(1.1rem, 2vw, 1.3rem); color: var(--ink-soft); max-width: 36ch; margin-bottom: 26px; }
.hero-lead strong { color: var(--ink); font-weight: 600; }
.hero-meta { list-style: none; display: grid; gap: 6px; font-size: 0.88rem; color: var(--muted); margin-bottom: 32px; }
.hero-meta li { display: flex; align-items: center; gap: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.dot-live { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }

.hero-photo { margin: 0; justify-self: end; width: 100%; max-width: 440px; position: relative; }
.hero-photo::before {
  content: ""; position: absolute; inset: 14px -14px -14px 14px;
  border: 1px solid var(--accent); border-radius: var(--radius); opacity: 0.5;
}
.hero-photo img {
  position: relative; width: 100%; height: auto;
  border-radius: var(--radius); box-shadow: var(--shadow);
}

@media (max-width: 820px) {
  .hero { padding: 40px 0 64px; }
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-photo { justify-self: center; max-width: min(380px, calc(100% - 14px)); order: -1; }
  .hero-scope { top: auto; height: 240px; }
  .scope-trace { opacity: 0.18; }
}

/* ---------- sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 48px; }
.section-num { color: var(--accent); font-size: 0.9rem; }
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -0.02em; }
.subhead { font-size: 1.35rem; margin: 64px 0 24px; }

@media (max-width: 640px) {
  .link-arrow { padding: 10px 0; }
  .links-row { margin-top: 8px; gap: 4px 20px; }
  .footer-inner a { display: inline-block; padding: 10px 0; }
  .section { padding: 64px 0; }
  .section-head { margin-bottom: 32px; }
  .container { padding: 0 16px; }
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px;
}
.card-label { font-size: 0.78rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 12px; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
.about-text p { font-size: 1.1rem; color: var(--ink-soft); max-width: 62ch; }
.about-text p:first-child { font-size: 1.25rem; color: var(--ink); }
.about-side { display: grid; gap: 16px; }
.edu-school { font-weight: 600; margin: 0; }
.edu-degree { margin: 0 0 4px; color: var(--ink-soft); }
.plain-list { list-style: none; display: grid; gap: 6px; font-size: 0.95rem; color: var(--ink-soft); }
.plain-list li { padding-left: 16px; position: relative; }
.plain-list li::before { content: ""; position: absolute; left: 0; top: 0.7em; width: 6px; height: 1px; background: var(--accent); }
.hobbies { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 0.95rem; }
.hobbies li { display: flex; flex-direction: column; }
.hobbies span { font-size: 1.2rem; line-height: 1.3; }
.hobbies em { font-style: normal; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }

/* ---------- tags / chips ---------- */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; }
.tags li {
  font-family: var(--mono); font-size: 0.75rem; padding: 3px 9px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent);
}
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-size: 0.9rem; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
}

.bullets { padding-left: 1.1em; display: grid; gap: 8px; color: var(--ink-soft); font-size: 0.98rem; }
.bullets li::marker { color: var(--accent); }
.links-row { margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 20px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.tl-item { position: relative; padding-left: 44px; }
.tl-item + .tl-item { margin-top: 28px; }
.tl-marker {
  position: absolute; left: 0; top: 30px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--bg-alt); border: 2px solid var(--accent);
}
.tl-item:first-child .tl-marker { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; }
.tl-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.tl-head h3 { font-size: 1.25rem; }
.tl-org { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }
.tl-date { margin: 0; font-size: 0.82rem; color: var(--muted); white-space: nowrap; padding-top: 4px; }

@media (max-width: 640px) {
  .timeline::before { display: none; }
  .tl-item { padding-left: 0; }
  .tl-marker { display: none; }
  .tl-card { padding: 20px; }
}

/* ---------- gallery ---------- */
.gallery { display: grid; gap: 10px; margin-top: 20px; }
.gallery-2 { grid-template-columns: repeat(2, 1fr); max-width: 520px; }
.gallery-3 { grid-template-columns: repeat(3, 1fr); max-width: 720px; }
.gallery-item {
  display: block; padding: 0; border: 0; background: var(--bg-alt);
  border-radius: var(--radius-sm); overflow: hidden; position: relative;
}
.gallery .gallery-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; transition: transform 0.3s ease; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item::after {
  content: "⤢"; position: absolute; right: 8px; bottom: 8px;
  width: 28px; height: 28px; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.55); color: #fff; border-radius: 6px; font-size: 0.9rem;
  opacity: 0; transition: opacity 0.2s ease;
}
.gallery-item:hover::after, .gallery-item:focus-visible::after { opacity: 1; }

/* ---------- projects ---------- */
.projects { display: grid; gap: 72px; }
.project { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: start; }
.project:nth-child(even) .project-media { order: 2; }
.project-media { display: grid; gap: 12px; }
.project-media video,
.project-media .gallery-item img {
  width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #0b0d10;
}
.project-media video { max-height: 460px; object-fit: contain; }
.project-media .gallery-item { border-radius: var(--radius); background: var(--surface); }
.project-media .gallery-item img { object-fit: contain; max-height: 420px; background: var(--surface); }
.project-kicker { color: var(--accent); font-size: 0.8rem; letter-spacing: 0.03em; margin-bottom: 8px; }
.project-body h3 { font-size: 1.6rem; margin-bottom: 18px; letter-spacing: -0.02em; }

.video-placeholder {
  aspect-ratio: 16 / 9; border-radius: var(--radius);
  border: 1.5px dashed var(--line);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--surface);
  display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted);
}
.video-placeholder svg { width: 44px; height: 44px; fill: var(--muted); opacity: 0.5; }
.video-placeholder p { margin: 0; font-size: 0.85rem; }

@media (max-width: 860px) {
  .projects { gap: 56px; }
  .project { grid-template-columns: 1fr; gap: 24px; }
  .project:nth-child(even) .project-media { order: 0; }
}

/* ---------- skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .skills-grid { grid-template-columns: 1fr; } }

/* ---------- certificates ---------- */
.cert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cert { display: flex; flex-direction: column; gap: 16px; transition: border-color 0.2s, transform 0.2s; }
.cert:hover { border-color: var(--accent); transform: translateY(-2px); }
.cert-logo { width: 56px; height: 56px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.cert-body { display: flex; flex-direction: column; flex: 1; }
.cert-body h3 { font-size: 1.08rem; margin-bottom: 6px; }
.cert-body p { margin: 0 0 2px; font-size: 0.95rem; }
.cert-body .tags { margin: 12px 0 18px; }
.cert-body .link-arrow { margin-top: auto; align-self: flex-start; }
@media (max-width: 900px) { .cert-grid { grid-template-columns: 1fr; } }

.courses-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.course-group { border-top: 2px solid var(--accent); padding-top: 14px; }
.course-group h4 { font-size: 0.78rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 12px; }
.course-group ul { list-style: none; display: grid; gap: 8px; font-size: 0.95rem; color: var(--ink-soft); }
@media (max-width: 900px) { .courses-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 16px; } }
@media (max-width: 520px) { .courses-grid { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.section-contact { background: var(--bg-alt); }
.contact-lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; margin-bottom: 32px; }
.contact-links { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.contact-card {
  display: flex; align-items: center; gap: 14px; height: 100%;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; transition: border-color 0.2s, transform 0.2s;
}
.contact-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.contact-card svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.contact-card > span { display: flex; flex-direction: column; min-width: 0; }
.contact-card .small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 960px) { .contact-links { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .contact-links { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer-inner p { margin: 0; font-size: 0.9rem; }
.footer-inner a { color: var(--muted); }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(8, 9, 11, 0.92);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; display: grid; justify-items: center; gap: 12px; min-width: 0; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: var(--radius-sm); background: #fff; }
.lightbox figcaption { color: #d7dae0; font-size: 0.95rem; text-align: center; max-width: 70ch; }
.lightbox button { background: rgba(255, 255, 255, 0.08); border: 0; color: #fff; border-radius: 50%; width: 48px; height: 48px; font-size: 1.8rem; line-height: 1; }
.lightbox button:hover { background: rgba(255, 255, 255, 0.18); }
.lb-close { position: absolute; top: 16px; right: 16px; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { visibility: hidden; }
@media (max-width: 640px) {
  .lightbox { grid-template-columns: 1fr; padding: 64px 12px 24px; }
  .lb-prev, .lb-next { position: absolute; bottom: 20px; }
  .lb-prev { left: 20px; } .lb-next { right: 20px; }
}

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
