/* ==========================================================================
   Razan Ahmad — portfolio styles
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  --bg: #121110;
  --surface: #1B1917;
  --placeholder: #2A2622;
  --placeholder-alt: #322D28;
  --line: #2E2A26;
  --text: #EDE8E0;
  --muted: #A8A095;
  --field-border: #6A6259;
  --accent: #E8618C;
  --on-accent: #141210;
  --error: #F2A09A;

  /* Text over the banner video stays light in every theme. */
  --hero-text: #F4EFE7;
  --hero-muted: #D6CEC2;
  --scrim: rgba(10, 9, 8, 0.88);

  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --gutter: clamp(20px, 5.6vw, 80px);
  --section-y: clamp(56px, 8.4vw, 120px);
  --max: 1600px;

  color-scheme: dark;
}

/* Light theme, ready for later: add data-theme="light" to <html>. */
:root[data-theme="light"] {
  --bg: #F5F2ED;
  --surface: #ECE6DE;
  --placeholder: #DDD5CA;
  --placeholder-alt: #D4CBBF;
  --line: #D9D1C6;
  --text: #1A1816;
  --muted: #5E574F;
  --field-border: #8C8378;
  --error: #A3261D;
  color-scheme: light;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video, picture { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, p, ul, figure { margin: 0; }
ul[role="list"], .plain-list { list-style: none; padding: 0; }

a { color: inherit; }
a:hover { opacity: 0.8; }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.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;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Type ---------- */

.label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.label-dot {
  display: flex;
  align-items: center;
  gap: 10px;
}
.label-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.lede {
  font-size: clamp(16px, 1.25vw, 18px);
  line-height: 1.7;
  color: var(--muted);
}

.muted { color: var(--muted); }

.hero-title, .h-section, .h-band, .h-teaser, .h-gallery, .h-about, .h-contact,
.card-title, .next-title, .brand, .footer-name {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: normal;
}

.hero-title { font-size: clamp(50px, 7.5vw, 108px); line-height: 0.98; }
.h-section  { font-size: clamp(42px, 5vw, 72px); line-height: 1; }
.h-band     { font-size: clamp(36px, 4.2vw, 60px); line-height: 1.05; }
.h-teaser   { font-size: clamp(40px, 4.45vw, 64px); line-height: 1; }
.h-gallery  { font-size: clamp(56px, 7.8vw, 112px); line-height: 0.95; }
.h-about    { font-size: clamp(52px, 6.1vw, 88px); line-height: 0.98; }
.h-contact  { font-size: clamp(44px, 5vw, 72px); line-height: 1; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn-sm { font-size: 13px; }
.btn-lg { min-height: 52px; padding: 0 28px; }
.btn-xl { min-height: 56px; padding: 0 32px; }

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-outline-light {
  border-color: var(--hero-text);
  color: var(--hero-text);
}
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn-row { display: flex; flex-wrap: wrap; gap: 16px; }

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

.site-header {
  position: relative;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  min-height: 88px;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-size: 30px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.nav-list {
  list-style: none;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 32px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}
.nav-link[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.nav-book .btn { letter-spacing: 0.12em; text-transform: uppercase; }

.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-toggle line { transition: transform 0.2s ease; transform-origin: 12px 12px; }
.menu-toggle[aria-expanded="true"] .menu-line-1 { transform: translateY(4px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-line-2 { transform: translateY(-4px) rotate(-45deg); }

@media (max-width: 639px) {
  .header-inner { min-height: 64px; padding: 0 12px 0 20px; }
  .brand { font-size: 24px; }

  .js .menu-toggle { display: inline-flex; }

  .js .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 20px 28px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.2s ease, transform 0.25s ease, visibility 0s linear 0.25s;
  }
  .js .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.2s ease, transform 0.25s ease, visibility 0s;
  }
  .js .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .js .nav-link {
    width: 100%;
    min-height: 52px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
  }
  .js .nav-book { padding-top: 20px; }
  .js .nav-book .btn { width: 100%; min-height: 52px; }

  /* Without JavaScript the links simply wrap under the name. */
  html:not(.js) .header-inner { flex-wrap: wrap; padding-block: 12px; }
}

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

.hero {
  position: relative;
  height: max(520px, 75svh);
  max-height: 900px;
  overflow: hidden;
  background: #1E1B19;
  color: var(--hero-text);
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 70%;
  background: linear-gradient(to top, var(--scrim), rgba(10, 9, 8, 0));
  pointer-events: none;
}

.hero-content {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(32px, 5.6vw, 80px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(18px, 2vw, 28px);
  max-width: 1100px;
}
.hero-label { color: var(--hero-muted); }

.video-toggle {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(32px, 5.6vw, 80px);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(244, 239, 231, 0.5);
  background: rgba(10, 9, 8, 0.35);
  color: var(--hero-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.video-toggle[hidden] { display: none; }
.video-toggle .i-play { display: none; }
.video-toggle[aria-pressed="true"] .i-play { display: block; }
.video-toggle[aria-pressed="true"] .i-pause { display: none; }

@media (max-width: 640px) {
  .hero { height: max(520px, 76svh); }
  .hero-content { right: var(--gutter); padding-right: 0; }
  .hero-content .btn-row { width: 100%; flex-direction: column; gap: 12px; }
  .hero-content .btn { width: 100%; }
  .hero-title br { display: none; }
  .video-toggle { top: 16px; bottom: auto; right: 16px; }
}

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

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--section-y) var(--gutter);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 48px;
  flex-wrap: wrap;
  margin-bottom: clamp(24px, 4.4vw, 64px);
}
.section-head .lede { max-width: 420px; }

/* ---------- Gallery cards (home) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 56px 32px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-decoration: none;
  color: var(--text);
}
.card:hover { opacity: 1; }
.card:hover .card-media img { transform: scale(1.02); }

.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--placeholder);
}
.card-media img { transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card-media--accent::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--accent);
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-media picture, .teaser-media picture, .about-media picture { height: 100%; }

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card-meta .icon { flex-shrink: 0; margin-top: 4px; }
.card-title { font-size: clamp(20px, 1.9vw, 27px); line-height: 1.1; }
.card-desc { margin-top: 6px; font-size: 14px; color: var(--muted); }

@media (max-width: 899px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; }
}
@media (max-width: 640px) {
  .card-grid { gap: 24px 12px; }
  .card { gap: 10px; }
  .card-meta .icon { display: none; }
  .card-desc { font-size: 13px; margin-top: 4px; }
}

/* ---------- Placeholders ---------- */

.ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-align: center;
  background: var(--placeholder);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ph-alt .ph, .ph.ph-alt { background: var(--placeholder-alt); }

/* ---------- Graduation band ---------- */

.band { background: var(--surface); }
.band-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 6.7vw, 96px) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px 64px;
}
.band-text { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }

@media (max-width: 767px) {
  .band-inner { flex-direction: column; align-items: stretch; }
  .band-inner > .btn { width: 100%; }
}

/* ---------- About teaser (home) ---------- */

.teaser {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(0, 620px);
  gap: clamp(40px, 6.7vw, 96px);
  align-items: center;
}
.teaser-media { aspect-ratio: 4 / 5; background: var(--placeholder); overflow: hidden; }
.teaser-text { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; }

@media (max-width: 899px) {
  .teaser { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .teaser-text { gap: 20px; }
}

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

.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(40px, 4.4vw, 64px) var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px 40px;
  font-size: 15px;
}
.footer-id { display: flex; flex-direction: column; gap: 8px; }
.footer-name { font-size: clamp(26px, 2.2vw, 32px); line-height: 1.1; }
.footer-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 40px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
.footer-copy { font-size: 14px; }

@media (max-width: 640px) {
  .footer-inner { flex-direction: column; gap: 12px; }
  .footer-links { flex-direction: column; gap: 0; }
}

/* ---------- Gallery page ---------- */

.gallery-head {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(48px, 6.7vw, 96px) var(--gutter) clamp(32px, 4.4vw, 64px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 24px 64px;
}
.gallery-head-main { display: flex; flex-direction: column; gap: 16px; }
.gallery-head .lede { max-width: 460px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  text-decoration: none;
}

.gallery {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Masonry: CSS columns without JS; the inline script re-flows items into
   balanced columns in filename order. */
.masonry {
  --cols: 3;
  columns: var(--cols);
  column-gap: 24px;
}
.masonry > .m-item { break-inside: avoid; margin-bottom: 24px; }
.masonry.is-js { columns: auto; display: flex; align-items: flex-start; gap: 24px; }
.m-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.m-col > .m-item { margin: 0; }

@media (max-width: 1024px) { .masonry { --cols: 2; } }
@media (max-width: 640px)  { .masonry { --cols: 1; } }

.m-item, .m-full { background: var(--placeholder); }
.m-link { display: block; cursor: zoom-in; }
.m-link:hover { opacity: 1; }
.m-link img { width: 100%; transition: opacity 0.2s ease; }
.m-link:hover img { opacity: 0.92; }
.m-full .ph { max-height: 640px; }

.next-row {
  max-width: calc(var(--max) - 2 * var(--gutter));
  margin: clamp(72px, 8.4vw, 120px) var(--gutter) 0;
  padding: 56px 0 clamp(64px, 6.7vw, 96px);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 32px 48px;
}
@media (min-width: 1761px) { .next-row { margin-inline: auto; } }

.next-link {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
}
.next-title { font-size: clamp(40px, 4.45vw, 64px); line-height: 1; }

@media (max-width: 640px) {
  .next-row { flex-direction: column; align-items: stretch; }
  .next-row .btn { width: 100%; }
}

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(12, 11, 10, 0.97);
  color: var(--hero-text);
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(12, 11, 10, 0.97); }
.lightbox[open] { display: grid; place-items: center; }
html:has(.lightbox[open]) { overflow: hidden; }

.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px clamp(16px, 7vw, 104px);
  touch-action: pan-y pinch-zoom;
  user-select: none;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lb-count {
  position: absolute;
  top: 24px;
  left: 24px;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--hero-muted);
}

.lb-btn {
  position: absolute;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(244, 239, 231, 0.35);
  border-radius: 999px;
  background: rgba(18, 17, 16, 0.6);
  color: var(--hero-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(40, 37, 34, 0.9); }
.lb-btn:focus-visible { outline-color: var(--hero-text); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: clamp(8px, 2vw, 32px); top: 50%; transform: translateY(-50%); }
.lb-next { right: clamp(8px, 2vw, 32px); top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
  .lb-stage { padding: 64px 0 88px; }
  .lb-prev, .lb-next { top: auto; bottom: 16px; transform: none; }
  .lb-prev { left: calc(50% - 64px); }
  .lb-next { right: calc(50% - 64px); }
}

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

.about {
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  gap: clamp(40px, 6.7vw, 96px);
  align-items: start;
}
.about-media { aspect-ratio: 4 / 5; background: var(--placeholder); overflow: hidden; }
.about-text { display: flex; flex-direction: column; gap: 28px; max-width: 720px; }

.about-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.about-lists h2 { margin-bottom: 10px; }
.plain-list { font-size: 17px; line-height: 1.8; }

@media (max-width: 899px) {
  .about { grid-template-columns: minmax(0, 1fr); }
  .about-text { gap: 20px; }
}
@media (max-width: 480px) {
  .about-lists { grid-template-columns: minmax(0, 1fr); }
}

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

.contact { background: var(--surface); scroll-margin-top: 0; }
.contact-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--section-y) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  gap: clamp(40px, 6.7vw, 96px);
  align-items: start;
}
.contact-intro { display: flex; flex-direction: column; gap: 24px; }
.contact-links { font-size: 16px; }
.contact-links a { display: inline-flex; align-items: center; min-height: 36px; }

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 500; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
.field textarea { padding: 14px 16px; resize: vertical; min-height: 160px; }
.field select {
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A8A095' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
  border-color: var(--text);
}
.field [aria-invalid="true"] { border-color: var(--error); }

/* Spam trap for Formspree (_gotcha). Fully hidden with display:none so browser
   autofill never fills it; a filled trap makes Formspree mark the enquiry as spam. */
.hp { display: none !important; }

.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 24px; }
.form-status { font-size: 15px; line-height: 1.5; }
.form-status:empty { display: none; }
.form-status.is-success { color: var(--text); }
.form-status.is-error { color: var(--error); }

@media (max-width: 899px) {
  .contact-inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .contact-form { grid-template-columns: minmax(0, 1fr); }
  .form-actions .btn { width: 100%; }
}
