:root {
  --ink: #101417;
  --deep: #071018;
  --deep-2: #0b1821;
  --gold: #b88a4c;
  --gold-2: #d9ad72;
  --paper: #f4f0e9;
  --paper-2: #faf7f1;
  --line: #d9cfc1;
  --muted: #777169;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  line-height: 1.9;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  width: 100%;
  object-fit: cover;
}

.container {
  width: min(1180px, calc(100% - 44px));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 145px;
  align-items: center;
  min-height: 82px;
  padding: 0 24px;
  background: rgba(7, 16, 24, 0.97);
  border-bottom: 1px solid rgba(217, 173, 114, 0.15);
  backdrop-filter: blur(14px);
}

.brand-logo {
  width: 175px;
  max-height: 62px;
  object-fit: contain;
}

.desktop-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 1.25vw, 22px);
  color: #eee;
  font-size: 12px;
  white-space: nowrap;
}

.desktop-nav a {
  position: relative;
  padding: 31px 0 26px;
}

.desktop-nav a::after {
  position: absolute;
  inset-inline-start: 0;
  bottom: 19px;
  width: 0;
  height: 1px;
  content: "";
  background: var(--gold);
  transition: width 0.3s ease;
}

.desktop-nav a:hover,
.desktop-nav a.active {
  color: var(--gold-2);
}

.desktop-nav a:hover::after,
.desktop-nav a.active::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  direction: ltr;
}

.language {
  color: #fff;
  font-size: 11px;
  opacity: 0.6;
}

.language.active {
  color: var(--gold-2);
  opacity: 1;
}

.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  padding: 7px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.menu-btn span {
  display: block;
  height: 1px;
  margin: 6px 0;
  background: var(--gold-2);
}

.mobile-menu {
  position: fixed;
  top: 82px;
  right: 0;
  left: 0;
  z-index: 45;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 82px);
  padding: 22px 28px;
  overflow-y: auto;
  color: #fff;
  background: rgba(7, 16, 24, 0.99);
  border-bottom: 1px solid rgba(217, 173, 114, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-14px);
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

/* Page hero */
.page-hero {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  background: linear-gradient(120deg, #102333, #071018);
}

.page-hero::before {
  position: absolute;
  inset: 0;
  content: "";
  background: url("assets/masterpiece-hero.jpg") center / cover no-repeat;
  opacity: 0.72;
}

.page-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 13, 19, 0.28), rgba(5, 13, 19, 0.9)),
    linear-gradient(0deg, rgba(5, 13, 19, 0.5), transparent);
}

.page-hero-content {
  position: relative;
  z-index: 2;
  padding-top: 98px;
  color: #fff;
  text-align: center;
}

.page-hero-content p,
.section-heading small,
.intro-copy small,
.featured-copy small {
  margin: 0;
  color: var(--gold-2);
  font: 11px Georgia, serif;
  letter-spacing: 2px;
  direction: ltr;
}

.page-hero-content h1 {
  margin: 12px 0 8px;
  font-size: clamp(45px, 5vw, 72px);
  font-weight: 500;
}

.page-hero-content span {
  color: #ddd;
  font-size: 14px;
}

.page-hero-content i {
  display: block;
  width: 96px;
  height: 1px;
  margin: 25px auto 0;
  background: var(--gold);
}

/* Introduction */
.intro-section {
  display: grid;
  grid-template-columns: 0.94fr 1.06fr;
  gap: 58px;
  align-items: center;
  padding: 76px 0;
}

.intro-copy h2 {
  margin: 9px 0 18px;
  font-size: 36px;
  font-weight: 500;
}

.intro-copy p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.intro-frame {
  position: relative;
  padding-block-start: 18px;
  padding-inline-start: 18px;
}

.intro-frame::before {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 52%;
  height: 62%;
  content: "";
  border: 1px solid var(--gold);
}

.intro-frame img {
  position: relative;
  min-height: 470px;
  background: linear-gradient(135deg, #233443, #9f7b51);
}

.intro-frame span {
  position: absolute;
  inset-inline-end: 22px;
  bottom: 20px;
  padding: 8px 14px;
  color: #fff;
  background: rgba(7, 16, 24, 0.88);
  font-size: 11px;
}

/* Featured object */
.featured-work {
  padding: 76px 0;
  background: var(--deep);
  color: #fff;
}

.featured-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 62px;
  align-items: center;
}

.featured-image {
  position: relative;
}

.featured-image img {
  height: 560px;
  background: linear-gradient(135deg, #162b39, #805f3c);
}

.featured-number {
  position: absolute;
  inset-inline-start: -20px;
  bottom: -35px;
  color: rgba(217, 173, 114, 0.16);
  font: 150px Georgia, serif;
  line-height: 1;
}

.featured-copy h2 {
  margin: 10px 0 18px;
  font-size: 42px;
  font-weight: 500;
}

.featured-copy p {
  color: #bfc2c3;
  font-size: 14px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.meta-row span {
  padding: 5px 10px;
  color: #d8c19e;
  border: 1px solid rgba(217, 173, 114, 0.25);
  font-size: 11px;
}

.outline-button {
  margin-top: 14px;
  padding: 10px 18px;
  color: var(--gold-2);
  border: 1px solid var(--gold);
  background: transparent;
  cursor: pointer;
  transition: color 0.3s ease, background-color 0.3s ease;
}

.outline-button:hover {
  color: var(--deep);
  background: var(--gold-2);
}

/* Gallery and writing cards */
.gallery-section {
  padding: 78px 0;
}

.section-heading {
  max-width: 680px;
  margin: 0 auto 30px;
  text-align: center;
}

.section-heading h2 {
  margin: 8px 0;
  font-size: 35px;
  font-weight: 500;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 30px;
}

.filter-tabs button {
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: color 0.3s ease, background-color 0.3s ease;
}

.filter-tabs button:hover,
.filter-tabs button.active {
  color: var(--gold-2);
  background: var(--deep);
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 20px;
}

.work-card {
  min-width: 0;
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--line);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.work-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 18px 36px rgba(7, 16, 24, 0.12);
}

.work-card.large {
  grid-row: span 2;
}

.work-card.wide {
  grid-column: span 2;
}

.work-card.is-hidden {
  display: none;
}

.card-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: start;
  cursor: pointer;
}

.card-image {
  position: relative;
  display: block;
  height: 290px;
  overflow: hidden;
  background: linear-gradient(135deg, #203241, #9d7b55);
}

.large .card-image {
  height: 640px;
}

.wide .card-image {
  height: 330px;
}

.card-image img {
  height: 100%;
  background: linear-gradient(135deg, #203241, #9d7b55);
  transition: transform 0.6s ease;
}

.work-card:hover img {
  transform: scale(1.055);
}

.card-image::after {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(7, 16, 24, 0);
  transition: background-color 0.35s ease;
}

.work-card:hover .card-image::after {
  background: rgba(7, 16, 24, 0.32);
}

.card-image i {
  position: absolute;
  right: 50%;
  bottom: 50%;
  z-index: 2;
  padding: 8px 14px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.75);
  font-size: 11px;
  font-style: normal;
  opacity: 0;
  transform: translate(50%, 65%);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.work-card:hover .card-image i {
  opacity: 1;
  transform: translate(50%, 50%);
}

.card-copy {
  display: block;
  padding: 19px 20px 22px;
}

.card-copy small {
  display: block;
  color: var(--gold);
  font-size: 11px;
}

.card-copy strong {
  display: block;
  margin: 6px 0;
  font-size: 19px;
  font-weight: 500;
}

.card-copy > span {
  color: var(--muted);
  font-size: 11px;
}

/* Quote */
.quote-section {
  padding: 70px 0;
  background: linear-gradient(135deg, #b98b50, #8f6638);
}

.quote-content {
  max-width: 850px;
  text-align: center;
}

.quote-content > span {
  font-size: 30px;
}

.quote-content blockquote {
  margin: 12px auto;
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 300;
  line-height: 1.8;
}

.quote-content p {
  margin: 0;
  color: #49321d;
  font-size: 12px;
}

/* Object details modal */
.work-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.work-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 12, 0.86);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(960px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--paper-2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.modal-image img {
  height: 100%;
  min-height: 520px;
  background: linear-gradient(135deg, #203241, #9d7b55);
}

.modal-content {
  padding: 52px 44px;
}

.modal-content small {
  color: var(--gold);
  font-size: 12px;
}

.modal-content h2 {
  margin: 8px 0 14px;
  font-size: 34px;
  font-weight: 500;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.modal-meta span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  font-size: 11px;
}

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

.modal-content b {
  display: inline-block;
  margin-top: 12px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 500;
}

.modal-close {
  position: absolute;
  inset-inline-start: 14px;
  top: 12px;
  z-index: 3;
  width: 38px;
  height: 38px;
  color: #fff;
  border: 0;
  background: var(--deep);
  font-size: 24px;
  cursor: pointer;
}

/* Broken images keep the card dimensions without invalid img pseudo-elements. */
.image-placeholder {
  min-height: 260px;
  background: linear-gradient(135deg, #172b3a, #af895d);
}

/* Keyboard accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 3px;
}

@media (max-width: 1120px) {
  .site-header {
    grid-template-columns: 190px 1fr 90px;
  }

  .desktop-nav {
    gap: 11px;
    font-size: 11px;
  }

  .featured-grid {
    gap: 38px;
  }

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

  .work-card.large {
    grid-row: span 1;
  }

  .large .card-image {
    height: 330px;
  }
}

@media (max-width: 920px) {
  .site-header {
    grid-template-columns: 1fr auto;
    min-height: 76px;
    padding: 0 20px;
  }

  .desktop-nav,
  .language {
    display: none;
  }

  .menu-btn {
    display: block;
  }

  .header-actions {
    grid-column: 2;
  }

  .mobile-menu {
    top: 76px;
    max-height: calc(100vh - 76px);
  }

  .intro-section,
  .featured-grid,
  .modal-card {
    grid-template-columns: 1fr;
  }

  .intro-frame {
    order: -1;
  }

  .intro-frame img,
  .featured-image img {
    min-height: 0;
    height: 430px;
  }

  .featured-number {
    inset-inline-start: 0;
  }

  .modal-image img {
    min-height: 0;
    height: 340px;
  }

  .modal-content {
    padding: 34px 28px;
  }

  .work-card.wide {
    grid-column: span 2;
  }
}

@media (max-width: 580px) {
  .container {
    width: min(calc(100% - 30px), 1180px);
  }

  .brand-logo {
    width: 150px;
  }

  .page-hero {
    min-height: 350px;
  }

  .page-hero-content {
    padding-top: 78px;
  }

  .intro-section,
  .gallery-section {
    padding: 55px 0;
  }

  .intro-copy h2,
  .section-heading h2 {
    font-size: 29px;
  }

  .featured-work {
    padding: 55px 0;
  }

  .featured-copy h2 {
    font-size: 34px;
  }

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

  .work-card.wide {
    grid-column: auto;
  }

  .card-image,
  .large .card-image,
  .wide .card-image {
    height: 340px;
  }

  .work-modal {
    padding: 14px;
  }

  .modal-card {
    max-height: 92vh;
  }

  .modal-image img {
    height: 280px;
  }

  .modal-content h2 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
