/* ==========================================================================
   Casabella Tower — site styles
   Single stylesheet, shared by all locales. No build step.
   Order: tokens → reset → primitives → layout → sections → utilities → media
   ========================================================================== */

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

:root {
  /* Palette. Warm ink base, bone type, brass accent. */
  --ink-900: #0e0d0b;
  --ink-800: #16150f;
  --ink-700: #1f1d17;
  --ink-600: #2b281f;
  --line: rgba(233, 224, 207, 0.14);
  --line-strong: rgba(233, 224, 207, 0.28);

  --bone-100: #f6f1e7;
  --bone-300: #e9e0cf;
  --bone-500: rgba(233, 224, 207, 0.72);
  --bone-700: rgba(233, 224, 207, 0.5);

  --brass-400: #cfa863;
  --brass-500: #b98f45;
  --brass-600: #97722f;

  --sand-50: #faf7f1;
  --sand-100: #f2ece1;

  /* Type */
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0: clamp(0.95rem, 0.92rem + 0.16vw, 1.05rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.35vw, 1.4rem);
  --step-2: clamp(1.5rem, 1.32rem + 0.9vw, 2.15rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3.4rem);
  --step-4: clamp(2.6rem, 1.7rem + 4.4vw, 6rem);

  /* Space */
  --gap-xs: 0.5rem;
  --gap-sm: 1rem;
  --gap-md: 2rem;
  --gap-lg: 4rem;
  --gap-xl: 7rem;

  --shell: 1240px;
  --shell-narrow: 780px;
  --pad-x: clamp(1.25rem, 5vw, 4.5rem);

  --radius: 2px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --header-h: 76px;
}

/* --- Reset -------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--ink-900);
  color: var(--bone-300);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-weight: 350;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--bone-100);
}

p {
  margin: 0 0 1em;
}

p:last-child {
  margin-bottom: 0;
}

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

/* --- Primitives --------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.shell--narrow {
  max-width: var(--shell-narrow);
}

.eyebrow {
  font-size: var(--step--1);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass-400);
  font-weight: 500;
  margin: 0 0 var(--gap-sm);
}

.lede {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--bone-500);
  font-weight: 300;
}

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.95em 2em;
  border: 1px solid var(--brass-500);
  border-radius: var(--radius);
  background: transparent;
  color: var(--bone-100);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.35s var(--ease), color 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

.btn:hover {
  background: var(--brass-500);
  border-color: var(--brass-500);
  color: var(--ink-900);
}

.btn--solid {
  background: var(--brass-500);
  color: var(--ink-900);
}

.btn--solid:hover {
  background: var(--brass-400);
  border-color: var(--brass-400);
}

.btn--ghost {
  border-color: var(--line-strong);
}

/* Section rhythm */

.section {
  padding-block: var(--gap-xl);
  position: relative;
}

.section--tight {
  padding-block: var(--gap-lg);
}

.section--light {
  background: var(--sand-50);
  color: var(--ink-700);
}

.section--light h1,
.section--light h2,
.section--light h3 {
  color: var(--ink-900);
}

.section--light .lede {
  color: rgba(30, 28, 22, 0.66);
}

.section--light .eyebrow {
  color: var(--brass-600);
}

.section-head {
  max-width: 44ch;
  margin-bottom: var(--gap-lg);
}

.section-head h2 {
  font-size: var(--step-3);
}

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

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease),
    backdrop-filter 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.is-stuck {
  background: rgba(14, 13, 11, 0.88);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}

.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
}

.brand {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  color: var(--bone-100);
}

.brand__tag {
  font-size: 0.6rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--bone-700);
  margin-top: 0.35em;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2.2rem);
}

.nav a {
  font-size: var(--step--1);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  /* seven items now: never let a label break across two lines */
  white-space: nowrap;
  color: var(--bone-500);
  padding-block: 0.4em;
  border-bottom: 1px solid transparent;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.nav a:hover,
.nav a.is-active {
  color: var(--bone-100);
  border-bottom-color: var(--brass-500);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-700);
}

.lang-switch a.is-active {
  color: var(--brass-400);
}

.lang-switch span {
  opacity: 0.4;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  padding: 0;
  place-items: center;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 1px;
  background: var(--bone-300);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.nav-toggle span + span {
  margin-top: 5px;
}

body.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

body.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

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

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(3rem, 8vh, 6rem);
  overflow: hidden;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #14130f;
}

/* <picture> is inline by default, so the img's height:100% would have no
   definite height to resolve against. Make the wrapper fill .hero__media. */
.hero__media picture {
  display: block;
  width: 100%;
  height: 100%;
}

.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Source is 2.4:1 and the building sits left of centre; bias the crop left
     so the full massing survives on 16:10 / 16:9 viewports. */
  object-position: 30% 50%;
}

/* Portrait viewports get a purpose-cropped 2:3 source (hero-portrait.*) that is
   already centred on the building, so the landscape crop bias must not apply. */
@media (orientation: portrait) {
  .hero__media img {
    object-position: 50% 50%;
  }
}

.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
      to top,
      var(--ink-900) 0%,
      rgba(14, 13, 11, 0.55) 42%,
      rgba(14, 13, 11, 0.3) 70%,
      rgba(14, 13, 11, 0.6) 100%
    );
}

/* Fallback when no hero image is present yet. */
.hero__media--placeholder {
  background: radial-gradient(
      120% 90% at 70% 15%,
      #3a3222 0%,
      transparent 60%
    ),
    linear-gradient(160deg, #14130f 0%, #221f17 55%, #0e0d0b 100%);
}

.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero h1 {
  font-size: var(--step-4);
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.hero__sub {
  font-size: var(--step-1);
  color: var(--bone-500);
  max-width: 46ch;
  margin-top: var(--gap-sm);
  font-weight: 300;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-sm);
  margin-top: var(--gap-md);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  margin-top: var(--gap-lg);
  padding-top: var(--gap-md);
  border-top: 1px solid var(--line);
}

.hero__meta div {
  min-width: 8rem;
}

.hero__meta dt {
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-700);
  margin-bottom: 0.4em;
}

.hero__meta dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--bone-100);
  line-height: 1;
}

/* --- Stats -------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}

.stats > div {
  background: var(--ink-900);
  padding: var(--gap-md) var(--gap-sm);
  text-align: center;
}

.stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 300;
  color: var(--bone-100);
  line-height: 1;
}

.stats span {
  display: block;
  margin-top: 0.7em;
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-700);
}

/* --- Split (image + text) ---------------------------------------------- */

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.split--reverse .split__media {
  order: 2;
}

.split__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #2a2620 0%, #16140f 100%);
}

/* Same reason as .hero__media picture — <picture> is inline by default, so the
   img's height:100% would have no definite height to resolve against. */
.split__media picture {
  display: block;
  width: 100%;
  height: 100%;
}

.split__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.split__body h2 {
  font-size: var(--step-3);
  margin-bottom: var(--gap-sm);
}

/* --- Residence cards ---------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap-md);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ink-800);
  display: flex;
  flex-direction: column;
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease);
}

.card:hover {
  border-color: var(--line-strong);
  transform: translateY(-4px);
}

.card__media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(150deg, #29251d 0%, #17150f 100%);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body {
  padding: var(--gap-md) var(--gap-sm) var(--gap-sm);
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  flex: 1;
}

.card__body h3 {
  font-size: var(--step-2);
}

.card__specs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 1.2em;
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone-700);
}

.card__price {
  margin-top: auto;
  padding-top: var(--gap-sm);
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: var(--step-1);
  color: var(--brass-400);
}

/* --- Floor plans -------------------------------------------------------- */

/* Plan sheets are tall, light line drawings — they must be shown whole on a
   light ground, never cover-cropped like a photograph. */

.plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap-md);
}

.plan {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--gap-sm);
  background: var(--ink-800);
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease);
}

.plan:hover {
  border-color: var(--brass-500);
  transform: translateY(-4px);
}

.plan__sheet {
  aspect-ratio: 3 / 4;
  background: var(--sand-50);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.plan__sheet img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.plan__label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.2em var(--gap-xs);
}

.plan__label h3 {
  font-size: var(--step-1);
  white-space: nowrap;
}

.plan__label span {
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-400);
}

/* --- Amenities ---------------------------------------------------------- */

.amenities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: rgba(30, 28, 22, 0.12);
  border: 1px solid rgba(30, 28, 22, 0.12);
}

.amenities li {
  background: var(--sand-50);
  padding: var(--gap-md) var(--gap-sm);
}

.amenities h3 {
  font-size: var(--step-1);
  margin-bottom: 0.4em;
}

.amenities p {
  font-size: var(--step--1);
  color: rgba(30, 28, 22, 0.6);
  line-height: 1.6;
}

.amenities .num {
  display: block;
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  color: var(--brass-600);
  margin-bottom: var(--gap-sm);
}

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

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gap-sm);
}

.gallery figure {
  margin: 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #2a2620 0%, #16140f 100%);
}

.gallery figure:nth-child(3n + 1) {
  aspect-ratio: 3 / 2;
}

.gallery picture {
  display: block;
  width: 100%;
  height: 100%;
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}

.gallery figure:hover img {
  transform: scale(1.05);
}

/* --- Availability table ------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
  font-size: var(--step--1);
}

th,
td {
  text-align: left;
  padding: 1em 1.2em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-700);
  background: var(--ink-800);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(233, 224, 207, 0.03);
}

.pill {
  display: inline-block;
  padding: 0.3em 0.9em;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.pill--available {
  color: #8fbf7f;
}

.pill--reserved {
  color: var(--brass-400);
}

.pill--sold {
  color: rgba(233, 224, 207, 0.38);
}

/* --- Form --------------------------------------------------------------- */

.form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone-700);
}

.field input,
.field select,
.field textarea {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.9em 1em;
  color: var(--bone-100);
  transition: border-color 0.3s var(--ease);
}

.field textarea {
  min-height: 8rem;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brass-500);
  outline: none;
}

.field select option {
  background: var(--ink-800);
}

.form__note {
  grid-column: 1 / -1;
  font-size: var(--step--1);
  color: var(--bone-700);
}

.form__status {
  grid-column: 1 / -1;
  font-size: var(--step--1);
  min-height: 1.4em;
}

.form__status[data-state="ok"] {
  color: #8fbf7f;
}

.form__status[data-state="error"] {
  color: #d08a72;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--gap-lg) var(--gap-md);
  font-size: var(--step--1);
  color: var(--bone-700);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--gap-md);
  margin-bottom: var(--gap-lg);
}

.footer-grid h4 {
  font-family: var(--font-body);
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-500);
  margin-bottom: var(--gap-sm);
  font-weight: 500;
}

.footer-grid li + li {
  margin-top: 0.5em;
}

.footer-grid a:hover {
  color: var(--bone-100);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--gap-sm);
  padding-top: var(--gap-md);
  border-top: 1px solid var(--line);
}

/* --- Utilities ---------------------------------------------------------- */

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

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -110%);
  z-index: 100;
  background: var(--brass-500);
  color: var(--ink-900);
  padding: 0.7em 1.4em;
  transition: transform 0.25s var(--ease);
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

/* Scroll reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

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

@media (max-width: 900px) {
  .nav-toggle {
    display: grid;
  }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(14, 13, 11, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: var(--gap-sm) var(--pad-x) var(--gap-md);
    transform: translateY(-120%);
    transition: transform 0.45s var(--ease);
  }

  body.nav-open .nav {
    transform: translateY(0);
  }

  .nav a {
    width: 100%;
    padding-block: 0.9em;
    border-bottom: 1px solid var(--line);
    font-size: var(--step-0);
  }

  .split--reverse .split__media {
    order: 0;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .site-header,
  .nav-toggle,
  .hero__actions,
  .site-footer {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
