:root {
  --ink: #070706;
  --ink-soft: #0d0c0a;
  --parchment: #e3d4b1;
  --parchment-bright: #f0e1bd;
  --gold: #a8976e;
  --gold-dim: #74694f;
  --shadow: rgba(0, 0, 0, 0.82);
}

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

* {
  box-sizing: border-box;
}

html {
  background: #050504;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--parchment);
  background:
    radial-gradient(ellipse at 50% 17%, rgba(227, 212, 177, 0.065), transparent 34%),
    radial-gradient(ellipse at 14% 48%, rgba(227, 212, 177, 0.025), transparent 28%),
    linear-gradient(111deg, transparent 0 17%, rgba(227, 212, 177, 0.018) 17.2% 17.8%, transparent 18% 100%),
    linear-gradient(71deg, transparent 0 78%, rgba(227, 212, 177, 0.016) 78.2% 79%, transparent 79.2% 100%),
    #070706;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  letter-spacing: 0.045em;
}

body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background:
    linear-gradient(104deg, transparent 0 8%, rgba(0, 0, 0, 0.58) 8.2% 13%, transparent 13.2% 20%, rgba(0, 0, 0, 0.48) 20.2% 25%, transparent 25.2%),
    linear-gradient(75deg, transparent 0 73%, rgba(0, 0, 0, 0.48) 73.2% 79%, transparent 79.2% 86%, rgba(0, 0, 0, 0.54) 86.2% 91%, transparent 91.2%),
    radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.56) 100%);
}

body::after {
  content: "";
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: screen;
  background-image:
    linear-gradient(91deg, transparent 0 17%, rgba(244, 231, 194, 0.1) 17.05%, transparent 17.12%),
    linear-gradient(89deg, transparent 0 63%, rgba(244, 231, 194, 0.065) 63.04%, transparent 63.12%),
    repeating-linear-gradient(0deg, rgba(255, 246, 220, 0.025) 0 1px, transparent 1px 4px);
}

.film-grain {
  position: fixed;
  z-index: 99;
  inset: 0;
  pointer-events: none;
  opacity: 0.17;
  filter: contrast(145%);
  background-image:
    radial-gradient(circle at 13% 17%, rgba(255, 245, 215, 0.4) 0 0.55px, transparent 0.95px),
    radial-gradient(circle at 71% 63%, rgba(255, 245, 215, 0.26) 0 0.5px, transparent 0.9px),
    radial-gradient(circle at 38% 82%, rgba(0, 0, 0, 0.88) 0 0.75px, transparent 1.1px);
  background-size: 5px 7px, 8px 11px, 13px 9px;
}

.film-grain::before,
.film-grain::after {
  content: "";
  position: absolute;
  inset: 0;
}

.film-grain::before {
  opacity: 0.34;
  background-image:
    radial-gradient(circle at 21% 34%, rgba(238, 222, 181, 0.34) 0 1px, transparent 1.7px),
    radial-gradient(circle at 77% 19%, rgba(238, 222, 181, 0.24) 0 0.8px, transparent 1.5px),
    radial-gradient(circle at 54% 73%, rgba(0, 0, 0, 0.72) 0 1.2px, transparent 2px);
  background-size: 137px 151px, 193px 167px, 109px 127px;
}

.film-grain::after {
  opacity: 0.24;
  background:
    linear-gradient(92deg, transparent 0 28%, rgba(239, 224, 185, 0.2) 28.05%, transparent 28.13%),
    linear-gradient(88deg, transparent 0 82%, rgba(239, 224, 185, 0.13) 82.04%, transparent 82.12%),
    linear-gradient(2deg, transparent 0 59%, rgba(0, 0, 0, 0.54) 59.06%, transparent 59.15%);
}

/* ---------- Outer page frame ---------- */

.page-frame {
  position: relative;
  z-index: 1;
  width: calc(100% - 28px);
  min-height: calc(100vh - 28px);
  margin: 14px;
  padding: 38px 62px 28px;
  border: 1px solid var(--gold);
  background:
    radial-gradient(ellipse at 50% 15%, rgba(227, 212, 177, 0.032), transparent 42%),
    linear-gradient(115deg, transparent 0 43%, rgba(255, 255, 255, 0.012) 43.2% 44%, transparent 44.2%),
    rgba(8, 8, 7, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.9),
    inset 0 0 70px rgba(0, 0, 0, 0.82),
    0 0 22px rgba(0, 0, 0, 0.9);
}

.page-frame::before,
.page-frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.page-frame::before {
  z-index: 3;
  inset: 8px;
  border: 1px solid rgba(168, 151, 110, 0.72);
}

.page-frame::after {
  z-index: 3;
  inset: 14px;
  border-top: 1px solid rgba(168, 151, 110, 0.25);
  border-bottom: 1px solid rgba(168, 151, 110, 0.25);
}

.frame-corner,
.frame-crest {
  position: absolute;
  z-index: 5;
  color: #c6b58b;
  pointer-events: none;
  text-shadow: 0 2px 4px #000;
}

.frame-corner {
  width: 90px;
  height: 90px;
  font-size: 17px;
  line-height: 1;
}

.frame-corner b {
  position: absolute;
  top: 5px;
  left: 13px;
  color: #a8956c;
  font-size: 43px;
  font-weight: 400;
  line-height: 1;
  transform: rotate(-24deg);
}

.frame-corner--tl {
  top: 4px;
  left: 5px;
}

.frame-corner--tr {
  top: 5px;
  right: 5px;
  transform: rotate(90deg);
}

.frame-corner--br {
  right: 5px;
  bottom: 5px;
  transform: rotate(180deg);
}

.frame-corner--bl {
  bottom: 5px;
  left: 5px;
  transform: rotate(270deg);
}

.frame-crest {
  left: 50%;
  padding: 3px 20px;
  transform: translateX(-50%);
  background: #080807;
  font-size: 18px;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.frame-crest--top {
  top: -14px;
}

.frame-crest--bottom {
  bottom: -14px;
  transform: translateX(-50%) rotate(180deg);
}

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

.site-header {
  position: relative;
  z-index: 6;
  display: flex;
  min-height: 44px;
  padding: 3px 22px;
  align-items: center;
  justify-content: space-between;
}

.symbol {
  color: #c2af82;
  font-size: 30px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(227, 212, 177, 0.12);
  transform: rotate(-7deg);
}

.top-nav {
  display: flex;
  gap: 15px;
  align-items: center;
  font-size: 0.91rem;
  letter-spacing: 0.14em;
}

.top-nav a {
  color: #cfbf98;
  text-decoration: none;
  text-shadow: 0 1px 2px #000;
  transition: color 180ms ease, text-shadow 180ms ease;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: #f2e1b9;
  text-shadow: 0 0 8px rgba(242, 225, 185, 0.25);
}

.nav-divider {
  color: #8d7e5d;
  font-size: 0.66rem;
}

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

.hero {
  position: relative;
  z-index: 2;
  min-height: 300px;
  padding: 28px 20px 40px;
  overflow: hidden;
  text-align: center;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -2;
  top: 14%;
  width: 24%;
  height: 82%;
  opacity: 0.45;
  background: linear-gradient(128deg, transparent 0 33%, rgba(180, 160, 112, 0.055) 33.4% 36%, transparent 36.4% 50%, rgba(0, 0, 0, 0.7) 50.4% 68%, transparent 68.4%);
  clip-path: polygon(0 22%, 72% 0, 43% 43%, 100% 65%, 18% 100%, 35% 57%);
}

.hero::before {
  left: 0;
  transform: skewY(-5deg);
}

.hero::after {
  right: 0;
  transform: scaleX(-1) skewY(5deg);
}

.page-x {
  position: absolute;
  z-index: -1;
  inset: 0;
  display: flex;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  color: rgba(190, 169, 120, 0.008);
  font-family: "Bodoni MT", Didot, Georgia, serif;
  font-size: clamp(690px, 82vw, 1260px);
  line-height: 0.74;
  -webkit-text-stroke: 2px rgba(182, 164, 120, 0.055);
  text-shadow: 0 0 36px rgba(182, 164, 120, 0.025);
  transform: rotate(-4deg) scaleY(1.08);
  transform-origin: center;
  user-select: none;
}

.hero h1 {
  margin: 20px 0 0;
  color: #e5d7b6;
  font-family: "Bodoni MT", Didot, "Baskerville", "Times New Roman", serif;
  font-size: clamp(5rem, 9.6vw, 9.2rem);
  font-weight: 400;
  font-kerning: normal;
  letter-spacing: normal;
  line-height: 0.84;
  text-shadow:
    3px 3px 0 #252017,
    -1px 1px 0 #897752,
    0 9px 22px rgba(0, 0, 0, 0.88);
  transform: rotate(-1.1deg) skewX(-1.2deg);
}

.hero-ornament {
  display: flex;
  width: min(480px, 58vw);
  margin-right: auto;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  color: #a8956d;
}

.hero-ornament span {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, #887a59 24%, #b09c70 82%, transparent);
}

.hero-ornament span:last-child {
  transform: scaleX(-1);
}

.hero-ornament b,
.hero-ornament i {
  margin: 0 5px;
  font-style: normal;
  font-weight: 400;
}

.hero-ornament--top {
  margin-top: 5px;
  margin-bottom: 9px;
  font-size: 10px;
}

.hero-ornament--middle {
  width: min(350px, 46vw);
  margin-top: 34px;
  font-size: 13px;
}

.subtitle {
  display: inline-flex;
  margin: 13px 0 0;
  align-items: center;
  gap: 18px;
  color: #c7b58e;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-shadow: 0 2px 3px #000;
}

.subtitle b {
  color: #9b8963;
  font-size: 0.64em;
  font-weight: 400;
}

/* ---------- Project grid ---------- */

.project-grid {
  position: relative;
  z-index: 6;
  display: grid;
  width: min(1250px, 100%);
  margin: 0 auto;
  padding: 0 0 38px;
  grid-template-columns: repeat(3, 1fr);
  gap: 31px 36px;
}

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

.project-card {
  --tilt: 0deg;
  --shear: 0deg;
  position: relative;
  display: flex;
  min-height: 250px;
  padding: 43px 34px 39px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  isolation: isolate;
  overflow: visible;
  color: #dfd0ad;
  border: 1px solid #9f8d65;
  outline: 1px solid rgba(107, 95, 68, 0.48);
  outline-offset: 4px;
  border-radius: 1px 4px 0 3px;
  background:
    radial-gradient(ellipse at 51% 46%, rgba(244, 228, 188, 0.052), transparent 64%),
    linear-gradient(104deg, rgba(255, 255, 255, 0.012), transparent 21% 72%, rgba(255, 255, 255, 0.014)),
    #0a0a08;
  box-shadow:
    inset 0 0 34px rgba(0, 0, 0, 0.82),
    0 11px 28px rgba(0, 0, 0, 0.48);
  text-align: center;
  text-decoration: none;
  transform: rotate(var(--tilt)) skewX(var(--shear));
  transition: color 180ms ease, border-color 180ms ease, outline-color 180ms ease, transform 180ms ease, filter 180ms ease;
}

.project-card::before,
.project-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.project-card::before {
  inset: 9px 10px 10px 9px;
  border: 1px solid rgba(181, 160, 111, 0.68);
  transform: rotate(0.28deg);
}

.project-card::after {
  inset: 15px 16px;
  border-top: 1px solid rgba(181, 160, 111, 0.32);
  border-bottom: 1px solid rgba(181, 160, 111, 0.27);
}

.project-title {
  position: relative;
  z-index: 3;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: clamp(2.15rem, 2.8vw, 3.15rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-shadow:
    2px 2px 0 #282218,
    0 5px 11px rgba(0, 0, 0, 0.78);
}

.project-status {
  position: relative;
  z-index: 3;
  width: min(280px, 92%);
  margin-top: 16px;
  padding-top: 11px;
  border-top: 1px solid rgba(166, 146, 101, 0.38);
  color: #aa9871;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  font-size: clamp(0.62rem, 0.72vw, 0.73rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.09em;
  line-height: 1.35;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.82);
}

.card-crest,
.card-tail,
.card-corner {
  position: absolute;
  z-index: 4;
  color: #b6a276;
  pointer-events: none;
  text-shadow: 0 2px 3px #000;
}

.card-crest {
  top: -15px;
  left: 50%;
  min-width: 104px;
  padding: 0 8px;
  transform: translateX(-50%);
  background: #090908;
  font-size: 17px;
  letter-spacing: 0.12em;
  line-height: 28px;
  white-space: nowrap;
}

.card-tail {
  bottom: 19px;
  left: 50%;
  transform: translateX(-50%);
  color: #9d8b63;
  font-size: 9px;
  letter-spacing: 0.11em;
  white-space: nowrap;
}

.card-corner {
  font-size: 25px;
  line-height: 1;
}

.card-corner--tl {
  top: 13px;
  left: 16px;
  transform: rotate(-26deg);
}

.card-corner--tr {
  top: 13px;
  right: 16px;
  transform: rotate(64deg);
}

.card-corner--br {
  right: 16px;
  bottom: 13px;
  transform: rotate(154deg);
}

.card-corner--bl {
  bottom: 13px;
  left: 16px;
  transform: rotate(244deg);
}

.project-card:nth-child(1) {
  --tilt: -0.85deg;
  --shear: -0.16deg;
}

.project-card:nth-child(2) {
  --tilt: 0.55deg;
  --shear: 0.12deg;
}

.project-card:nth-child(3) {
  --tilt: -0.45deg;
  --shear: -0.1deg;
}

.project-card:nth-child(4) {
  --tilt: 0.7deg;
  --shear: 0.14deg;
}

.project-card:nth-child(5) {
  --tilt: -0.55deg;
  --shear: -0.12deg;
}

.project-card:nth-child(6) {
  --tilt: 0.8deg;
  --shear: 0.17deg;
}

.project-card:hover,
.project-card:focus-visible {
  color: #f3dfb5;
  border-color: #c7ae79;
  outline-color: rgba(199, 174, 121, 0.72);
  filter: brightness(1.08);
  transform: rotate(0deg) skewX(0deg) translateY(-4px);
}

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

.site-footer {
  position: relative;
  z-index: 6;
  display: flex;
  padding: 10px 10px 3px;
  align-items: center;
  justify-content: center;
  gap: 24px;
  color: #a7956c;
  font-size: 0.77rem;
  letter-spacing: 0.15em;
  text-align: center;
}

.footer-divider {
  color: #c3ad7b;
  font-size: 1rem;
}

.footer-rule {
  width: 38px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #9b8a63 55%, transparent);
}

.footer-rule:last-child {
  transform: scaleX(-1);
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .page-frame {
    padding: 32px 40px 28px;
  }

  .project-grid {
    width: min(820px, 100%);
    grid-template-columns: repeat(2, 1fr);
  }

  .hero {
    min-height: 275px;
    padding-top: 24px;
  }

  .project-card {
    min-height: 210px;
  }
}

@media (max-width: 640px) {
  .page-frame {
    width: calc(100% - 16px);
    min-height: calc(100vh - 16px);
    margin: 8px;
    padding: 25px 18px 23px;
  }

  .page-frame::before {
    inset: 6px;
  }

  .page-frame::after,
  .frame-crest,
  .frame-corner b {
    display: none;
  }

  .frame-corner {
    width: auto;
    height: auto;
    font-size: 11px;
  }

  .site-header {
    min-height: 38px;
    padding: 1px 10px;
    align-items: flex-start;
  }

  .symbol {
    font-size: 23px;
  }

  .top-nav {
    gap: 9px;
    font-size: 0.7rem;
    letter-spacing: 0.09em;
  }

  .nav-divider {
    display: none;
  }

  .hero {
    min-height: 240px;
    padding: 36px 2px 34px;
  }

  .hero h1 {
    margin-top: 14px;
    font-size: clamp(4.15rem, 22vw, 6.5rem);
    letter-spacing: normal;
  }

  .hero-ornament--top {
    width: 70vw;
  }

  .hero-ornament--middle {
    width: 58vw;
    margin-top: 29px;
  }

  .subtitle {
    gap: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.11em;
  }

  .project-grid {
    width: min(390px, 100%);
    grid-template-columns: 1fr;
    gap: 25px;
  }

  .project-card {
    min-height: 205px;
    padding: 40px 29px 37px;
  }

  .project-title {
    font-size: clamp(2.25rem, 12vw, 3.1rem);
  }

  .project-status {
    width: min(250px, 90%);
    margin-top: 13px;
    font-size: 0.63rem;
  }

  .card-corner {
    font-size: 24px;
  }

  .site-footer {
    flex-wrap: wrap;
    gap: 7px 13px;
    font-size: 0.68rem;
  }

  .footer-rule {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .top-nav a {
    transition: none;
  }
}
