:root {
  --paper: oklch(97% 0.008 75);
  --paper-2: oklch(94% 0.010 75);
  --ink: oklch(22% 0.010 60);
  --ink-soft: oklch(35% 0.012 60);
  --muted: oklch(52% 0.015 70);
  --stone: oklch(88% 0.012 75);
  --stone-2: oklch(82% 0.014 75);
  --accent: oklch(58% 0.12 45);
  --accent-soft: oklch(88% 0.05 45);
  --available: oklch(49% 0.13 145);
  --available-soft: oklch(91% 0.06 145);

  --serif: "Newsreader", "Cormorant Garamond", Georgia, serif;
  --italic: "Instrument Serif", "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sans: -apple-system, "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.italic { font-family: var(--italic); font-style: italic; font-weight: 400; }

/* Paper grain */
.grain::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.15  0 0 0 0 0.10  0 0 0 0 0.06  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.6;
  mix-blend-mode: multiply;
  z-index: 999;
}

/* Layout scaffolding */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 48px;
}
@media (max-width: 780px) {
  .shell { padding: 0 24px; }
}

hr.rule {
  border: none;
  border-top: 1px solid var(--stone);
  margin: 0;
}

/* Hero */
.hero {
  padding: 110px 0 90px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 64px;
  align-items: end;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(58px, 9vw, 128px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.hero h1 .ita {
  font-family: var(--italic);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.hero-meta {
  text-align: right;
  min-width: 220px;
  padding-bottom: 12px;
}
.hero-meta .kicker {
  display: block;
  margin-bottom: 14px;
}
.hero-meta .route {
  font-family: var(--italic);
  font-style: italic;
  font-size: 22px;
  line-height: 1.3;
  color: var(--ink-soft);
}
.hero-meta .route b { color: var(--ink); font-style: normal; font-family: var(--serif); font-weight: 500; }
.hero-sub {
  padding: 40px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  border-top: 1px solid var(--stone);
  margin-top: 60px;
}
.hero-sub p { max-width: 52ch; color: var(--ink-soft); font-size: 18px; }

/* Countdown sentence */
.countdown {
  padding: 60px 0;
  text-align: center;
  border-top: 1px solid var(--stone);
  border-bottom: 1px solid var(--stone);
}
.countdown .line {
  font-family: var(--italic);
  font-style: italic;
  font-size: clamp(26px, 3.6vw, 44px);
  line-height: 1.25;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
}
.countdown .line b {
  font-style: normal;
  font-family: var(--serif);
  color: var(--accent);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Letter */
.letter-section {
  padding: 120px 0;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 80px;
}
.letter-section .label { padding-top: 10px; }
.letter-section .body {
  font-size: 22px;
  line-height: 1.55;
  color: var(--ink);
  max-width: 58ch;
}
.letter-section .body p { margin-bottom: 22px; }
.letter-section .body p:first-letter {
  font-family: var(--italic);
  font-style: italic;
  font-size: 1.6em;
  line-height: 0.9;
  padding-right: 2px;
  color: var(--accent);
}
.letter-section .sign {
  margin-top: 32px;
  font-family: var(--italic);
  font-style: italic;
  font-size: 28px;
  color: var(--ink);
}

/* Index / catalog filters */
.index {
  padding-top: 40px;
}
.index-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
}
.index-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: -0.015em;
}
.index-head h2 em {
  font-family: var(--italic);
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.filters { display: flex; gap: 4px; }
.filters button {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  transition: all 150ms ease;
}
.filters button:hover { color: var(--ink); }
.filters button.active {
  background: var(--ink);
  color: var(--paper);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--stone);
}
.grid.density-2 { grid-template-columns: repeat(2, 1fr); }
.grid.density-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 980px) { .grid, .grid.density-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid, .grid.density-2, .grid.density-4 { grid-template-columns: 1fr; } }

.card {
  display: block;
  border-top: 1px solid var(--stone);
  border-right: 1px solid var(--stone);
  padding: 28px 24px 26px;
  cursor: pointer;
  position: relative;
  transition: background 300ms ease;
}
.card:hover { background: var(--paper-2); }
.card:focus-visible { background: var(--paper-2); }
.card:nth-child(3n) { border-right: none; }
.grid.density-2 .card:nth-child(3n) { border-right: 1px solid var(--stone); }
.grid.density-2 .card:nth-child(2n) { border-right: none; }
.grid.density-4 .card:nth-child(3n) { border-right: 1px solid var(--stone); }
.grid.density-4 .card:nth-child(4n) { border-right: none; }

.card .catno {
  position: absolute;
  top: 14px; right: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  opacity: 0;
  transition: opacity 200ms ease;
}
.card:hover .catno { opacity: 1; }

.thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  background: var(--stone);
}
.photo, .photo-fallback {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.photo-fallback {
  position: relative;
}
.photo-fallback span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: rgba(30,25,20,0.62);
  text-transform: uppercase;
}

.thumb .label {
  position: absolute;
  left: 12px; bottom: 12px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: rgba(30,25,20,0.55);
  text-transform: lowercase;
}
.thumb .status-pill {
  position: absolute;
  top: 12px; left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 9px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
}
.thumb .status-pill .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--available);
}
.thumb .status-pill.reservado { color: var(--accent); border-color: var(--accent); }
.thumb .status-pill.reserved { color: var(--accent); border-color: var(--accent); }
.thumb .status-pill.available {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
}
.thumb .status-pill.sold {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.thumb .status-pill.invalid {
  background: var(--accent); color: var(--paper); border-color: var(--accent);
}

.card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  flex: 1;
}
.card .price {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
}
.card.sold h3, .card.sold .price {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.card .cat-line {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
}
.count-line {
  padding: 14px 0 8px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.count-total { margin-left: auto; }

/* Footer */
footer.foot {
  padding: 80px 0 60px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  border-top: 1px solid var(--stone);
  margin-top: 40px;
}
footer.foot .left { font-family: var(--italic); font-style: italic; font-size: 22px; color: var(--ink-soft); max-width: 40ch; }
footer.foot .right { text-align: right; }
footer.foot .contact-cta {
  display: inline-block;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 4px;
}
footer.foot .contact-cta:hover { color: var(--accent); border-color: var(--accent); }
footer.foot .right small { display: block; margin-top: 24px; }
@media (max-width: 760px) {
  footer.foot {
    grid-template-columns: 1fr;
  }
  footer.foot .right {
    text-align: left;
  }
  footer.foot .contact-cta {
    font-size: 32px;
  }
}

/* Detail view */
.detail {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 200;
  overflow-y: auto;
  animation: fadeIn 350ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.detail-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 48px;
  border-bottom: 1px solid var(--stone);
  background: var(--paper);
  position: sticky; top: 0; z-index: 2;
}
.detail-bar .back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  background: none; border: none; padding: 0;
}
.detail-bar .back:hover { color: var(--accent); }

.detail-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0;
  min-height: calc(100vh - 70px);
}
@media (max-width: 900px) {
  .detail-body { grid-template-columns: 1fr; }
  .detail-bar { padding: 20px 24px; }
}
.detail-gallery {
  background: var(--paper-2);
  padding: 60px 48px;
  border-right: 1px solid var(--stone);
  display: flex; flex-direction: column; gap: 12px;
}
.detail-gallery .main {
  aspect-ratio: 4/3;
  position: relative;
  overflow: hidden;
}
.detail-gallery .thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.detail-gallery .thumbs .thumb {
  aspect-ratio: 1/1;
  margin: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  background: transparent;
  opacity: 0.7;
  transition: opacity 200ms;
}
.detail-gallery .thumbs .thumb:hover { opacity: 1; }
.detail-gallery .thumbs .thumb.active { opacity: 1; outline: 1px solid var(--ink); outline-offset: 2px; }

.detail-info { padding: 60px 48px; }
.detail-info .catno { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }
.detail-info h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 54px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 14px 0 20px;
}
.detail-info .status-row {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 6px 12px; border: 1px solid var(--ink);
  margin-bottom: 40px;
}
.detail-info .status-row.reservado { color: var(--accent); border-color: var(--accent); }
.detail-info .status-row.reserved { color: var(--accent); border-color: var(--accent); }
.detail-info .status-row.available {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.detail-info .status-row.available span { color: var(--available); }
.detail-info .status-row.sold { background: var(--ink); color: var(--paper); }
.detail-info .status-row.invalid { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.detail-info .price-big {
  font-family: var(--serif); font-weight: 300; font-size: 38px; letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.detail-info .price-note { font-family: var(--italic); font-style: italic; color: var(--muted); font-size: 16px; margin-bottom: 40px; }

.detail-info .spec {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px 24px;
  padding: 24px 0;
  border-top: 1px solid var(--stone);
}
.detail-info .spec dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 4px; }
.detail-info .spec dd { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.detail-info .spec-link {
  color: #0645ad;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.detail-info .note-block {
  margin-top: 32px;
  padding: 24px;
  background: var(--paper-2);
  border-left: 2px solid var(--accent);
  font-family: var(--italic); font-style: italic; font-size: 18px; color: var(--ink-soft);
}

.detail-info .cta-row {
  margin-top: 48px;
  display: flex; gap: 12px;
}
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 24px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer; border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  transition: all 200ms ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn.accent:hover { background: var(--ink); border-color: var(--ink); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
@media (max-width: 640px) {
  .detail-gallery, .detail-info {
    padding: 32px 24px;
  }
  .detail-info h1 {
    font-size: 38px;
  }
  .detail-info .spec {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .detail-info .cta-row {
    flex-direction: column;
  }
  .btn {
    justify-content: center;
  }
}

/* Contact modal */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(30,25,20,0.5);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  animation: fadeIn 220ms ease;
}
.modal {
  background: var(--paper);
  width: 540px; max-width: calc(100vw - 48px);
  padding: 44px 40px 36px;
  position: relative;
  animation: popIn 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes popIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.modal .x { position: absolute; top: 14px; right: 18px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); font-family: var(--serif); }
.modal .x:hover { color: var(--ink); }
.modal h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; letter-spacing: -0.01em; margin-bottom: 8px; }
.modal h3 em { font-family: var(--italic); font-style: italic; color: var(--accent); }
.modal p.lead { color: var(--ink-soft); font-size: 17px; margin-bottom: 28px; }
.modal .contact-methods { display: flex; flex-direction: column; gap: 10px; }
.modal .contact-methods a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px;
  border: 1px solid var(--stone);
  transition: all 200ms ease;
}
.modal .contact-methods a:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}
.modal .contact-methods .method { font-family: var(--serif); font-size: 19px; }
.modal .contact-methods .detail-text { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }

/* Tweaks */
.tweaks-panel {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 20px 22px;
  width: 280px;
  z-index: 400;
  box-shadow: 0 20px 40px -20px rgba(30,25,20,0.4);
  font-family: var(--sans);
}
.tweaks-panel h4 {
  font-family: var(--serif); font-weight: 400; font-size: 18px;
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--stone);
}
.tweaks-panel h4 span.tag { font-family: var(--mono); font-size: 9.5px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.tweaks-panel .row { margin-bottom: 14px; }
.tweaks-panel .row > label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 6px; }
.tweaks-panel .opts { display: flex; gap: 6px; flex-wrap: wrap; }
.tweaks-panel .opts button {
  flex: 1; min-width: 0;
  padding: 8px 4px; background: var(--paper); border: 1px solid var(--stone);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-soft); cursor: pointer; transition: all 150ms;
}
.tweaks-panel .opts button:hover { border-color: var(--ink); color: var(--ink); }
.tweaks-panel .opts button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.tweaks-panel .swatches { display: flex; gap: 6px; }
.tweaks-panel .swatches button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--stone);
  cursor: pointer; padding: 0;
}
.tweaks-panel .swatches button.on { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper);
  padding: 12px 20px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  z-index: 600; animation: toastIn 220ms ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 780px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 72px 0 64px;
  }
  .hero-meta {
    text-align: left;
  }
  .hero-sub {
    grid-template-columns: 1fr;
  }
  .index-head {
    display: block;
  }
  .filters {
    margin-top: 16px;
    flex-wrap: wrap;
  }
  .count-total {
    margin-left: 0;
  }
}
