/* =========================================================
   Raymond Eid — portfolio, v2
   Aesthetic: terminal + Levantine stone. Warm neutrals,
   terracotta accent, deep teal accent. Editorial grid.
   ========================================================= */

:root {
  /* Warm Levantine neutrals (low chroma) */
  --bg:        oklch(96% 0.012 70);        /* sandstone */
  --bg-2:      oklch(92% 0.018 68);        /* slightly deeper sand */
  --ink:       oklch(20% 0.018 55);        /* dark warm ink */
  --ink-2:     oklch(32% 0.018 55);        /* secondary */
  --ink-3:     oklch(52% 0.014 60);        /* tertiary/meta */
  --rule:      oklch(82% 0.015 65);
  --rule-2:    oklch(88% 0.012 70);

  /* Accents — shared chroma ~0.12, lightness ~55% */
  --terra:     oklch(58% 0.14 40);         /* terracotta / Levantine clay */
  --lapis:     oklch(50% 0.12 230);        /* Sidi Bou / Mediterranean blue */
  --olive:     oklch(55% 0.09 110);        /* for rare third accent */

  /* Image tint stops (for duotone overlays) */
  --tint-shadow: oklch(22% 0.05 45);
  --tint-light:  oklch(78% 0.12 55);

  --f-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-serif: "Instrument Serif", "Times New Roman", serif;
  --f-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --f-arabic: "Amiri", "Noto Naskh Arabic", serif;

  --maxw: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--f-sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Subtle grain overlay */
  background-image:
    radial-gradient(circle at 15% 20%, oklch(88% 0.03 70 / 0.4), transparent 50%),
    radial-gradient(circle at 85% 80%, oklch(88% 0.04 40 / 0.3), transparent 55%);
  background-attachment: fixed;
}

img { display: block; max-width: 100%; }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--terra); }

::selection { background: var(--terra); color: var(--bg); }

/* ============ Header ============ */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--gutter);
  max-width: var(--maxw);
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
}

.site-logo {
  font-family: var(--f-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.site-logo .dot { color: var(--terra); }

.site-nav {
  display: flex;
  gap: 22px;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 13px;
}
.site-nav a {
  color: var(--ink-3);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--ink);
}
.site-nav a.active::before {
  content: "›";
  color: var(--terra);
  margin-right: 4px;
}

/* ============ Hero ============ */

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(60px, 10vw, 120px) var(--gutter) clamp(50px, 8vw, 90px);
  position: relative;
}

.hero::before {
  /* small monospace header marker */
  content: "◆  RAYMOND.EID / EST. 1993 · BEIRUT · DC · SÃO PAULO";
  display: block;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--ink-2);
  margin-bottom: 40px;
  text-transform: uppercase;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--rule);
}

.hero h1 {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(44px, 7vw, 96px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 36px;
  max-width: 16ch;
  text-wrap: balance;
}

.hero h1 .em {
  font-style: italic;
  color: var(--terra);
  position: relative;
}

.hero h1 .em::after {
  /* blinking cursor at the end of the italic phrase */
  content: "";
  display: inline-block;
  width: 0.09em;
  height: 0.85em;
  background: var(--terra);
  margin-left: 0.12em;
  vertical-align: -0.02em;
  animation: blink 1.1s steps(2) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero .tagline {
  max-width: 58ch;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 36px;
}

.hero-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 13px;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  transition: all 0.2s;
}
.hero-links a::before {
  content: "→";
  color: var(--terra);
}
.hero-links a:hover {
  border-color: var(--terra);
  background: oklch(58% 0.14 40 / 0.06);
  color: var(--ink);
}

/* ============ Projects ============ */

.projects {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px var(--gutter) 100px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 16px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--rule);
}

.section-title {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.01em;
  margin: 0;
}

.section-meta {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Grid — asymmetric: featured spans 2 cols */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px 32px;
}

@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; gap: 40px; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Numbering */
.card {
  counter-increment: card;
}
.projects { counter-reset: card; }

.card::before {
  content: counter(card, decimal-leading-zero);
  position: absolute;
  top: 0;
  right: 0;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  z-index: 2;
  padding: 10px 12px;
  background: oklch(96% 0.012 70 / 0.9);
  backdrop-filter: blur(4px);
}

/* Featured spans both columns */
.card.featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 36px;
  align-items: center;
}

@media (max-width: 760px) {
  .card.featured { grid-template-columns: 1fr; gap: 16px; }
}

.card-media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--ink);
  border-radius: 2px;
}

.card.featured .card-media {
  aspect-ratio: 4 / 3;
}

/* Default card media: natural color image, no tint, just a thin frame. */
.card-media::before { content: none; }

.card-media img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.card-media::after {
  /* subtle shadow vignette for polish — still applies to all */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    transparent 65%,
    oklch(22% 0.05 40 / 0.25) 100%);
  z-index: 2;
  pointer-events: none;
}

/* Opt-in duotone treatment — applied to cards with `.card-media.duotone`.
   Used only where the source image is a messy white-background chart
   that needs rescuing (Lebanon data viz, drug pills on Rx form). */
.card-media.duotone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg,
    oklch(82% 0.12 62) 0%,
    oklch(62% 0.15 42) 55%,
    oklch(38% 0.11 32) 100%);
  z-index: 0;
}
.card-media.duotone img {
  filter: url(#duotone-terra);
}

/* tech frame corners */
.card-media .corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--bg);
  z-index: 2;
  pointer-events: none;
  opacity: 0.7;
}
.card-media .corner.tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.card-media .corner.tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.card-media .corner.bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.card-media .corner.br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

.card-media:hover img {
  transform: scale(1.04);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-date {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.card-title {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
.card.featured .card-title {
  font-size: clamp(28px, 3.2vw, 40px);
}
.card-title a:hover {
  color: var(--terra);
}

.card-desc {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
  margin: 4px 0 8px;
  max-width: 58ch;
}

.card-collab {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-3);
}
.card-collab a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule); }
.card-collab a:hover { color: var(--terra); text-decoration-color: var(--terra); }

.card-link {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--terra);
  margin-top: 4px;
  align-self: flex-start;
}
.card-link:hover {
  color: var(--ink);
}

/* ============ Footer ============ */

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  border-top: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--terra); }
.site-footer .sep { color: var(--rule); }

.site-footer::before {
  content: "◆";
  color: var(--terra);
  margin-right: 4px;
}

/* ============ About page ============ */

.about {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(50px, 8vw, 90px) var(--gutter) 80px;
}

.about .eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 28px;
}

.about .eyebrow::before {
  content: "◆ ";
  color: var(--terra);
}

.about h1 {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
}
.about h1 .em { font-style: italic; color: var(--terra); }

.about .lede {
  font-family: var(--f-serif);
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 32px;
  font-style: italic;
  max-width: 28ch;
}

.about p {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 20px;
}

.about h2 {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 56px 0 20px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}

.about h3 {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 40px 0 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.about h3::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--terra);
  display: inline-block;
}

.about a { color: var(--terra); text-decoration: underline; text-decoration-color: oklch(58% 0.14 40 / 0.35); text-underline-offset: 3px; }
.about a:hover { text-decoration-color: var(--terra); }

.about .arabic {
  font-family: var(--f-arabic);
  font-size: 22px;
  line-height: 1.9;
  direction: rtl;
  text-align: right;
  color: var(--ink);
  background: linear-gradient(135deg, oklch(92% 0.02 65), oklch(88% 0.025 55));
  padding: 28px 32px;
  border-radius: 2px;
  border-right: 3px solid var(--terra);
  margin: 16px 0 24px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 24px 0 32px;
}
@media (max-width: 700px) {
  .gallery { grid-template-columns: 1fr; }
}

.gallery figure {
  margin: 0;
  position: relative;
}

.gallery figure .frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--ink);
  border-radius: 2px;
}

.gallery figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.05);
  transition: transform 0.5s;
}
.gallery figure:hover img { transform: scale(1.03); }

/* subtle warm gradient on personal photos — NOT duotone, keep faces readable */
.gallery figure .frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    oklch(58% 0.14 40 / 0.0) 40%,
    oklch(30% 0.08 40 / 0.35) 100%);
  pointer-events: none;
}

.gallery figcaption {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-top: 10px;
  line-height: 1.4;
}
.gallery figcaption::before {
  content: "◇ ";
  color: var(--terra);
}

.video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 20px 0 28px;
  background: var(--ink);
  border-radius: 2px;
  overflow: hidden;
}
.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ============ Project (generic deep page) ============ */

.project {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(50px, 8vw, 90px) var(--gutter) 80px;
}

.project .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-bottom: 32px;
}
.project .back::before { content: "←"; color: var(--terra); }
.project .back:hover { color: var(--ink); }

.project .meta-row {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 24px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.project .meta-row span::before {
  content: "◆ ";
  color: var(--terra);
  margin-right: 2px;
}

.project h1 {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(36px, 5vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  text-wrap: balance;
}

.project .lede {
  font-family: var(--f-serif);
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.4;
  color: var(--ink-2);
  margin: 0 0 32px;
  font-style: italic;
}

.project .figure-main {
  position: relative;
  margin: 32px 0;
  background: var(--ink);
  border-radius: 2px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}
/* Project hero image — natural by default, opt-in duotone only. */
.project .figure-main::before { content: none; }

.project .figure-main img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project .figure-main.duotone::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(145deg,
    oklch(82% 0.12 62) 0%,
    oklch(62% 0.15 42) 55%,
    oklch(38% 0.11 32) 100%);
  z-index: 0;
}
.project .figure-main.duotone img {
  filter: url(#duotone-terra);
}

.project .figure-main::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    transparent 70%,
    oklch(22% 0.05 40 / 0.25) 100%);
  z-index: 2;
  pointer-events: none;
}

.project h2 {
  font-family: var(--f-serif);
  font-weight: 400;
  font-size: clamp(24px, 2.6vw, 30px);
  margin: 48px 0 16px;
  letter-spacing: -0.01em;
}

.project h3 {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 32px 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.project h3::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--terra);
}

.project p, .project li {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-2);
}

.project p { margin: 0 0 18px; max-width: 68ch; }

.project ul {
  padding-left: 0;
  list-style: none;
  margin: 0 0 24px;
}
.project li {
  padding-left: 22px;
  position: relative;
  margin-bottom: 10px;
}
.project li::before {
  content: "◇";
  color: var(--terra);
  position: absolute;
  left: 0;
  top: 0;
  font-size: 14px;
}

.project a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--terra);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.project a:hover {
  color: var(--terra);
}

.project b { font-weight: 600; color: var(--ink); }

/* images embedded inside project prose */
.project .img-pair,
.project .img-single {
  margin: 24px 0;
  display: grid;
  gap: 12px;
}
.project .img-pair { grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) {
  .project .img-pair { grid-template-columns: 1fr; }
}

.project .img-frame {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  aspect-ratio: 16 / 10;
}
.project .img-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}
.project .img-frame figcaption {
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: oklch(96% 0.012 70 / 0.92);
  padding: 4px 8px;
  border-radius: 2px;
  width: max-content;
  max-width: calc(100% - 20px);
}

/* Return-to-main button, styled */
.btn-return {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 12px 20px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  margin-top: 36px;
  color: var(--ink);
  background: transparent;
  transition: all 0.2s;
}
.btn-return::before { content: "←"; color: var(--terra); }
.btn-return:hover {
  border-color: var(--terra);
  background: oklch(58% 0.14 40 / 0.06);
}

/* video embed in project */
.project .video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 24px 0;
  background: var(--ink);
  border-radius: 2px;
  overflow: hidden;
}
.project .video-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
