/* ==========================================================================
   Xelnor — The Precision Grid
   Swiss Design × Geometric Minimalism
   ========================================================================== */

:root {
  --teal: #0F766E;
  --teal-light: #5EEAD4;
  --teal-deep: #115E59;
  --bg: #FCFCFC;
  --text: #111827;
  --grid: #E5E7EB;
  --bg-alt: #F3F4F6;
  --sidebar-w: 5.5rem;
  --font-display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-num: "Space Grotesk", monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Sidebar — fixed vertical column
   -------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0;
  background: var(--bg);
  border-right: 1px solid var(--grid);
}

.sidebar__brand {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}

.sidebar__brand:hover {
  color: var(--teal);
}

.sidebar__year {
  font-family: var(--font-num);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--teal);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.sidebar__nav a {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--text);
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 0.3s var(--ease), color 0.3s var(--ease);
}

.sidebar__nav a:hover {
  opacity: 1;
  color: var(--teal);
}

/* --------------------------------------------------------------------------
   Page shell
   -------------------------------------------------------------------------- */

.page {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

main {
  display: block;
}

/* --------------------------------------------------------------------------
   Reveal animation (text)
   -------------------------------------------------------------------------- */

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  animation: reveal-up 1s var(--ease) forwards;
  opacity: 0;
}

.opening__headline { animation-delay: 0.15s; }
.principle:nth-child(1) .reveal { animation-delay: 0.1s; }
.principle:nth-child(2) .reveal { animation-delay: 0.2s; }
.principle:nth-child(3) .reveal { animation-delay: 0.3s; }
.principle:nth-child(4) .reveal { animation-delay: 0.4s; }
.manifesto__quote { animation-delay: 0.2s; }
.invitation__headline { animation-delay: 0.15s; }

/* --------------------------------------------------------------------------
   Opening — split screen
   -------------------------------------------------------------------------- */

.opening {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  border-bottom: 1px solid var(--grid);
}

.opening__text {
  display: flex;
  align-items: flex-end;
  padding: clamp(2rem, 6vw, 5rem);
  border-right: 1px solid var(--grid);
}

.opening__headline {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--text);
}

.opening__geometry {
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.geo {
  position: absolute;
}

.geo--square {
  border: 1px solid var(--grid);
  background: transparent;
}

.geo--1 {
  width: 28%;
  height: 28%;
  top: 12%;
  left: 15%;
  border-color: var(--teal);
  background: var(--teal-light);
  opacity: 0.25;
}

.geo--2 {
  width: 18%;
  height: 18%;
  bottom: 25%;
  right: 20%;
  background: var(--teal);
  opacity: 0.12;
}

.geo--circle {
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--teal);
  top: 45%;
  left: 42%;
}

.geo--line {
  background: var(--grid);
}

.geo--h {
  width: 60%;
  height: 1px;
  top: 30%;
  left: 10%;
  transform: scaleX(0);
  transform-origin: left;
  animation: line-expand-h 1.2s var(--ease) 0.4s forwards;
}

.geo--v {
  width: 1px;
  height: 50%;
  top: 20%;
  right: 35%;
  transform: scaleY(0);
  transform-origin: top;
  animation: line-expand-v 1.2s var(--ease) 0.6s forwards;
}

.geo--diag {
  width: 40%;
  height: 1px;
  bottom: 35%;
  left: 25%;
  background: var(--teal);
  opacity: 0.4;
  transform: rotate(-35deg) scaleX(0);
  transform-origin: left;
  animation: line-expand-diag 1s var(--ease) 0.8s forwards;
}

@keyframes line-expand-h {
  to { transform: scaleX(1); }
}

@keyframes line-expand-diag {
  to { transform: rotate(-35deg) scaleX(1); }
}

@keyframes line-expand-v {
  to { transform: scaleY(1); }
}

.geo--frame {
  inset: 8%;
  border: 1px solid var(--grid);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Principles — horizontal bands
   -------------------------------------------------------------------------- */

.principles {
  border-bottom: 1px solid var(--grid);
}

.principle {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(2rem, 8vw, 8rem);
  padding: clamp(3rem, 8vh, 6rem) clamp(2rem, 6vw, 5rem);
  border-bottom: 1px solid var(--grid);
  background: var(--bg);
  transition: background 0.4s var(--ease);
}

.principle--alt {
  background: var(--bg-alt);
}

.principle:hover {
  background: #fff;
}

.principle--alt:hover {
  background: var(--bg);
}

.principle__num {
  font-family: var(--font-num);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 500;
  color: var(--teal);
  letter-spacing: 0.05em;
}

.principle__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   System Metrics — specification sheet
   -------------------------------------------------------------------------- */

.metrics {
  position: relative;
  padding: clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--grid);
  background: var(--bg);
  isolation: isolate;
}

.metrics__header,
.metrics__sheet {
  position: relative;
  z-index: 1;
}

.metrics__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--grid);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.metrics__ref {
  color: var(--teal);
  font-family: var(--font-num);
  letter-spacing: 0.15em;
}

.metrics__sheet {
  display: grid;
  gap: 0;
}

.metrics__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--grid);
  gap: 2rem;
}

.metrics__row dt {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.7;
}

.metrics__row dd {
  display: flex;
  align-items: baseline;
  gap: 0.15rem;
  font-family: var(--font-num);
  margin: 0;
}

.metrics__value {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--teal-deep);
  letter-spacing: -0.02em;
}

.metrics__unit {
  font-size: 1.25rem;
  color: var(--teal);
}

.metrics__grid-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  justify-content: space-around;
  padding: 0 10%;
  opacity: 0.6;
}

.grid-line {
  width: 1px;
  height: 100%;
  background: var(--grid);
  transform: scaleY(0);
  transform-origin: top;
}

.grid-line--expand {
  animation: grid-line-grow 1.4s var(--ease) 0.3s forwards;
}

.grid-line:nth-child(2) { animation-delay: 0.5s; }
.grid-line:nth-child(3) { animation-delay: 0.7s; }

@keyframes grid-line-grow {
  to { transform: scaleY(1); }
}

/* --------------------------------------------------------------------------
   Modules — oversized letter blocks
   -------------------------------------------------------------------------- */

.modules {
  padding: clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--grid);
}

.modules__section-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 3rem;
  color: var(--teal);
}

.modules__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--grid);
  border: 1px solid var(--grid);
}

.module {
  position: relative;
  background: var(--bg);
  padding: clamp(2.5rem, 5vw, 4rem);
  min-height: 14rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  transition: background 0.35s var(--ease);
}

.module:hover {
  background: var(--bg-alt);
}

.module__letter {
  position: absolute;
  top: -0.05em;
  left: 0.05em;
  font-family: var(--font-display);
  font-size: clamp(8rem, 18vw, 14rem);
  font-weight: 700;
  line-height: 0.85;
  color: var(--grid);
  pointer-events: none;
  transition: color 0.35s var(--ease);
  user-select: none;
}

.module:hover .module__letter {
  color: var(--teal-light);
  opacity: 0.5;
}

.module__name {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Manifesto
   -------------------------------------------------------------------------- */

.manifesto {
  padding: clamp(8rem, 20vh, 16rem) clamp(2rem, 8vw, 6rem);
  text-align: center;
  border-bottom: 1px solid var(--grid);
}

.manifesto__quote {
  margin: 0;
  border: none;
}

.manifesto__quote p {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 14ch;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Archive
   -------------------------------------------------------------------------- */

.archive {
  padding: clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--grid);
}

.archive__label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 2.5rem;
}

.archive__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.archive__list li {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 2rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--grid);
  align-items: baseline;
  transition: padding-left 0.35s var(--ease), color 0.35s var(--ease);
}

.archive__list li:hover {
  padding-left: 0.5rem;
}

.archive__year {
  font-family: var(--font-num);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.5;
}

.archive__year--active {
  color: var(--teal);
  opacity: 1;
}

.archive__entry {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.archive__list li:hover .archive__entry {
  color: var(--teal-deep);
}

/* --------------------------------------------------------------------------
   Grid Experiment — full-screen exhibit
   -------------------------------------------------------------------------- */

.grid-exhibit {
  min-height: 100vh;
  padding: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--grid);
  display: flex;
  flex-direction: column;
}

.grid-exhibit__label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 1.5rem;
}

.grid-exhibit__composition {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 1px;
  background: var(--grid);
  border: 1px solid var(--grid);
  min-height: 70vh;
}

.cell {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.4s var(--ease);
}

.cell span {
  font-family: var(--font-num);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--teal);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.cell:hover span {
  opacity: 1;
}

.cell--accent {
  background: var(--teal);
  opacity: 0.15;
}

.cell--accent:hover {
  opacity: 0.28;
}

.cell--1 { grid-column: 1 / 3; grid-row: 1 / 3; }
.cell--2 { grid-column: 3 / 4; }
.cell--3 { grid-column: 4 / 6; grid-row: 1 / 2; }
.cell--4 { grid-column: 6 / 7; grid-row: 1 / 3; }
.cell--5 { grid-column: 3 / 5; grid-row: 2 / 4; }
.cell--6 { grid-column: 1 / 2; grid-row: 3 / 5; }
.cell--7 { grid-column: 2 / 3; grid-row: 3 / 4; }
.cell--8 {
  grid-column: 5 / 7;
  grid-row: 2 / 3;
  background: transparent;
  border-bottom: 2px solid var(--teal-light);
}
.cell--9 { grid-column: 5 / 6; grid-row: 3 / 5; }
.cell--10 { grid-column: 6 / 7; grid-row: 3 / 4; }
.cell--11 { grid-column: 2 / 5; grid-row: 4 / 5; }
.cell--12 { grid-column: 6 / 7; grid-row: 4 / 5; background: var(--teal-deep); opacity: 0.2; }

.cell:hover {
  background: var(--bg-alt);
}

.cell--accent:hover,
.cell--12:hover {
  background: var(--teal);
  opacity: 0.22;
}

/* --------------------------------------------------------------------------
   Invitation
   -------------------------------------------------------------------------- */

.invitation {
  padding: clamp(6rem, 15vh, 12rem) clamp(2rem, 6vw, 4rem);
  text-align: center;
  border-bottom: 1px solid var(--grid);
}

.invitation__headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
}

.invitation__btn {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--bg);
  background: var(--teal);
  padding: 1.1rem 2.5rem;
  border: 1px solid var(--teal);
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

.invitation__btn:hover {
  background: transparent;
  color: var(--teal-deep);
}

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

.contact {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--grid);
  border-bottom: 1px solid var(--grid);
}

.contact__block {
  background: var(--bg);
  padding: clamp(2.5rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: background 0.35s var(--ease);
}

.contact__block:hover {
  background: var(--bg-alt);
}

.contact__label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--teal);
}

.contact__value {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  font-style: normal;
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s var(--ease);
}

a.contact__value:hover {
  color: var(--teal);
}

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

.footer {
  position: relative;
  padding: clamp(4rem, 10vh, 8rem) clamp(2rem, 4vw, 3rem) 2rem;
  overflow: hidden;
}

.footer__wordmark {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(4rem, 18vw, 14rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 0.9;
  color: var(--grid);
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.footer__copy {
  margin-top: 2rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text);
  opacity: 0.4;
}

.footer__copy small {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

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

@media (max-width: 900px) {
  .opening {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .opening__text {
    min-height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--grid);
  }

  .opening__geometry {
    min-height: 45vh;
  }

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

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

  .grid-exhibit__composition {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(6, 1fr);
    min-height: 60vh;
  }

  .cell--1 { grid-column: 1 / 3; grid-row: 1 / 3; }
  .cell--2 { grid-column: 3 / 5; grid-row: 1 / 2; }
  .cell--3 { grid-column: 3 / 5; grid-row: 2 / 3; }
  .cell--4 { grid-column: 1 / 2; grid-row: 3 / 4; }
  .cell--5 { grid-column: 2 / 5; grid-row: 3 / 5; }
  .cell--6 { grid-column: 1 / 2; grid-row: 4 / 6; }
  .cell--7 { display: none; }
  .cell--8 { grid-column: 2 / 4; grid-row: 5 / 6; }
  .cell--9 { grid-column: 4 / 5; grid-row: 4 / 6; }
  .cell--10 { display: none; }
  .cell--11 { grid-column: 2 / 4; grid-row: 6 / 7; }
  .cell--12 { grid-column: 4 / 5; grid-row: 6 / 7; }
}

@media (max-width: 640px) {
  :root {
    --sidebar-w: 100%;
  }

  .sidebar {
    position: fixed;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-right: none;
    border-bottom: 1px solid var(--grid);
  }

  .sidebar__brand,
  .sidebar__nav a {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .sidebar__brand {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
  }

  .sidebar__middle {
    order: 3;
  }

  .sidebar__nav {
    flex-direction: row;
    gap: 1rem;
  }

  .sidebar__nav a {
    font-size: 0.55rem;
  }

  .page {
    margin-left: 0;
    margin-top: 3.5rem;
  }

  .principle {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .archive__list li {
    grid-template-columns: 4rem 1fr;
    gap: 1rem;
  }

  .metrics__header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .footer__wordmark {
    font-size: clamp(3rem, 22vw, 6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
