/* ============================================================
   ALIREZA RAYEJ — personal site
   Swiss / International Typographic Style × Neo-Brutalism
   Bento grid · single accent red · hard shadows · 2px ink lines
   ============================================================ */

:root {
  --paper: #f1efe9;
  --card: #fbfaf6;
  --ink: #0d0d0c;
  --muted: #6b6960;
  --red: #e8390e;
  --border: 2px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
  --shadow-lift: 9px 9px 0 var(--ink);
  --radius: 4px;
  --gap: 14px;
  --pad: clamp(20px, 3vw, 34px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: clip; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  /* faint Swiss grid */
  background-image:
    linear-gradient(rgba(13,13,12,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13,13,12,.045) 1px, transparent 1px);
  background-size: 48px 48px;
}

::selection { background: var(--red); color: var(--paper); }

h1, h2, h3 { font-family: "Archivo", sans-serif; }

.mono { font-family: "JetBrains Mono", monospace; }

.dot-red { color: var(--red); }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: var(--paper);
  border-bottom: var(--border);
}

.brand {
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links { display: flex; gap: clamp(10px, 2vw, 26px); }

.nav-links a {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.nav-links a:hover { border-bottom-color: var(--red); color: var(--red); }

.nav-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  white-space: nowrap;
}

.pulse {
  width: 9px; height: 9px;
  background: var(--red);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- layout ---------- */

main { max-width: 1180px; margin: 0 auto; padding: clamp(18px, 3vw, 40px); }

.section { margin-top: clamp(56px, 9vw, 110px); }

.section-head { margin-bottom: 26px; }

.bento { display: grid; gap: var(--gap); }

/* ---------- cards ---------- */

.card {
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
  transition: transform .15s ease, box-shadow .15s ease;
}

a.card { text-decoration: none; color: var(--ink); display: block; }

.card:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow-lift); }

/* ---------- type ---------- */

.label {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.idx { color: var(--red); font-weight: 700; margin-right: 6px; }

.display {
  font-family: "Archivo", sans-serif;
  font-size: clamp(40px, 7.2vw, 86px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -.015em;
  text-transform: uppercase;
}

.display em { font-style: normal; color: var(--red); }

h2 {
  font-size: clamp(26px, 4vw, 46px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.01em;
  text-transform: uppercase;
}

.lede {
  max-width: 56ch;
  margin-top: 22px;
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--ink);
}

.big-num {
  font-family: "Archivo", sans-serif;
  font-size: clamp(44px, 5.5vw, 72px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
}

.sup { font-size: .38em; font-weight: 800; vertical-align: super; color: var(--red); }

.fact { font-size: 14.5px; }

hr { border: 0; border-top: var(--border); margin: 16px 0; opacity: .9; }

/* ---------- buttons ---------- */

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink);
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 13px 22px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.btn-red { background: var(--red); color: var(--paper); }

/* ---------- hero ---------- */

.hero {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "main main"
    "side badge";
}

.hero-main { grid-area: main; }
.hero-side { grid-area: side; }
.hero-badge { grid-area: badge; background: var(--ink); color: var(--paper); }

.hero-badge .label { color: rgba(241,239,233,.65); }
.hero-badge .fact { color: rgba(241,239,233,.85); margin-top: 10px; }
.hero-badge .big-num { color: var(--paper); }

.status { font-weight: 600; display: flex; align-items: center; gap: 9px; }

/* ---------- stats ---------- */

.stats { grid-template-columns: repeat(4, 1fr); margin-top: var(--gap); }

.stat .label { margin: 12px 0 0; color: var(--ink); }

/* ---------- marquee ---------- */

.marquee {
  margin: clamp(40px, 6vw, 70px) calc(50% - 50vw) 0;
  background: var(--ink);
  border-top: var(--border);
  border-bottom: var(--border);
  overflow: hidden;
  white-space: nowrap;
}

.marquee-track {
  display: inline-flex;
  animation: scroll 36s linear infinite;
}

.marquee-track span {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--paper);
  padding: 13px 0;
}

@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- work ---------- */

.work-grid { grid-template-columns: 1fr 1fr; }

.card.work { padding: 0; overflow: hidden; }

.work img {
  width: 100%;
  height: auto;
  display: block;
  border-bottom: var(--border);
}

.work-cap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px 20px;
}

.work h3 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .01em;
  margin-bottom: 6px;
}

.work p { font-size: 14px; color: var(--muted); }

.tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  border: var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  white-space: nowrap;
}

/* ---------- experience / awards rows ---------- */

.xp-card { padding: 0; }

.xp-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  padding: 22px var(--pad);
  border-bottom: var(--border);
}

.xp-row:last-child { border-bottom: 0; }

.xp-row:hover { background: var(--paper); }

.xp-year { font-size: 13px; font-weight: 700; color: var(--red); padding-top: 3px; }

.xp-row h3 { font-size: 17px; font-weight: 700; }

.xp-row p { font-size: 14.5px; color: var(--muted); margin-top: 5px; max-width: 78ch; }

/* ---------- skills ---------- */

.skills-grid { grid-template-columns: repeat(2, 1fr); }

.skill-wide { grid-column: span 2; }

.chips {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  line-height: 2;
}

/* ---------- contact ---------- */

.contact { text-align: left; }

.mail {
  display: inline-block;
  font-family: "Archivo", sans-serif;
  font-size: clamp(20px, 4vw, 42px);
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  margin-top: 24px;
  border-bottom: 4px solid var(--red);
  line-height: 1.25;
  word-break: break-all;
}

.mail:hover { color: var(--red); }

/* ---------- footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px clamp(18px, 3vw, 40px) 46px;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- project gallery modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(13, 13, 12, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vw, 40px);
  opacity: 0;
  transition: opacity .3s ease;
}

.modal.open { opacity: 1; }

.modal[hidden] { display: none; }

.modal-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1240px, 100%);
  max-height: 92vh;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: 10px 10px 0 rgba(0,0,0,.55);
  overflow: hidden;
  will-change: transform;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: var(--border);
  background: var(--card);
}

.modal-tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal-x {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  background: var(--ink);
  color: var(--paper);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 rgba(13,13,12,.35);
  padding: 8px 13px;
  cursor: pointer;
}

.modal-x:hover { background: var(--red); }

.modal-body {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 1.45fr);
  flex: 1;
  min-height: 0;
}

.modal-stage {
  position: relative;
  order: 2;
  background: var(--paper);
  border-left: var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal-info { order: 1; }

.modal-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
  cursor: grab;
}

.modal-viewport:active { cursor: grabbing; }

.modal-slide img {
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.modal-track {
  display: flex;
  height: 100%;
  transition: transform .45s cubic-bezier(.25,.8,.3,1);
}

.modal-slide {
  flex: 0 0 100%;
  min-width: 100%;
  display: flex;
}

.modal-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* opening hint: peek at the second slide, then settle back */
@keyframes peek {
  0%   { transform: translateX(0); }
  45%  { transform: translateX(-10%); }
  100% { transform: translateX(0); }
}

.modal-track.peek { animation: peek .95s cubic-bezier(.45, 0, .3, 1) both; }

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 700;
  background: var(--card);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
  width: 46px;
  height: 46px;
  cursor: pointer;
}

.modal-nav:hover { background: var(--red); color: var(--paper); }
.modal-nav:active { transform: translateY(-50%) translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.modal-nav.prev { left: 14px; }
.modal-nav.next { right: 14px; }

.modal-strip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 11px 16px;
  border-top: var(--border);
  background: var(--ink);
  color: var(--paper);
}

.modal-info {
  padding: clamp(20px, 2.6vw, 34px);
  overflow-y: auto;
}

.modal-info h3 {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.05;
}

.modal-info .label { margin-bottom: 8px; }

.modal-role { font-size: 14.5px; font-weight: 600; }

.modal-desc { font-size: 14px; color: var(--muted); }

.modal-skills { list-style: none; }

.modal-skills li {
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  padding: 7px 0 7px 18px;
  position: relative;
  border-bottom: 1px solid var(--line, #ddd);
}

.modal-skills li::before {
  content: "■";
  position: absolute;
  left: 0;
  color: var(--red);
  font-size: 9px;
  top: 11px;
}

.modal-skills li:last-child { border-bottom: 0; }

body.modal-open { overflow: hidden; }

@media (max-width: 880px) {
  .modal { padding: 0; }
  .modal-box {
    max-height: 100vh;
    max-height: 100dvh;
    height: 100%;
    border: 0;
    border-radius: 0;
  }
  .modal-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .modal-stage { order: 0; border-left: 0; border-bottom: var(--border); }
  .modal-info { order: 1; }
  .modal-viewport { aspect-ratio: 4 / 3; flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal { transition: none; }
  .modal-track { transition: none; }
  .modal-track.peek { animation: none; }
}

/* ---------- reveal animation ---------- */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .5s ease, transform .5s ease; }

.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .marquee-track { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */

@media (max-width: 880px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .work-grid { grid-template-columns: 1fr; }
  /* nav becomes two rows: brand + status on top, links scrollable below */
  .nav { flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
  .nav-meta { margin-left: auto; }
  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    gap: 20px;
    padding-top: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { white-space: nowrap; }
}

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; grid-template-areas: "main" "side" "badge"; }
  .skills-grid { grid-template-columns: 1fr; }
  .skill-wide { grid-column: auto; }
  .xp-row { grid-template-columns: 1fr; gap: 4px; padding: 18px 20px; }
  .stats { grid-template-columns: 1fr 1fr; }
}

/* narrow phones */
@media (max-width: 420px) {
  .big-num { font-size: clamp(32px, 11vw, 44px); }
  .stats { gap: 10px; }
  .stat { padding: 18px 16px; }
  .cta-row .btn { flex: 1; text-align: center; }
  .modal-nav { width: 40px; height: 40px; font-size: 15px; }
  .modal-nav.prev { left: 8px; }
  .modal-nav.next { right: 8px; }
}
