/* Livraria Maré — Faro curated bookstore
   Atlantic ink / salt paper / tide-line — distinct from sister shops */

:root {
  --ink: #0e1f28;
  --ink-soft: #243840;
  --paper: #ebe6dc;
  --paper-soft: #f4f0e8;
  --paper-deep: #ddd6c8;
  --tide: #163d4a;
  --tide-mid: #2a6678;
  --foam: #5a9a94;
  --salt: #c45c3a;
  --muted: #5e686c;
  --line: #c5bdb0;
  --white: #faf8f3;
  --serif: "Instrument Serif", "Georgia", serif;
  --sans: "Figtree", "Segoe UI", sans-serif;
  --max: 1100px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 90% 50% at 100% -10%, rgba(42, 102, 120, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at -5% 30%, rgba(196, 92, 58, 0.06), transparent 50%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(14, 31, 40, 0.018) 31px,
      rgba(14, 31, 40, 0.018) 32px
    ),
    linear-gradient(180deg, var(--paper-soft) 0%, var(--paper) 45%, var(--paper-deep) 100%);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--tide-mid);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--salt); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.12;
  color: var(--ink);
  margin: 0 0 0.65rem;
}

h1 { font-size: clamp(2.55rem, 6vw, 4rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.65rem, 3.2vw, 2.35rem); }
h3 { font-size: 1.35rem; }

p { margin: 0 0 1rem; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--tide);
  color: var(--white);
  padding: 0.5rem 1rem;
  z-index: 9999;
}
.skip-link:focus { left: 0; }

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.35rem;
}

/* Header — thin tide rule */
.site-header {
  background: rgba(244, 240, 232, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--tide);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.logo span {
  display: block;
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tide-mid);
  margin-top: 0.2rem;
}
.logo:hover { color: var(--tide); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.4rem;
  align-items: center;
}

.main-nav a {
  font-size: 0.86rem;
  font-weight: 550;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--salt);
  box-shadow: inset 0 -2px 0 var(--salt);
}

/* Hero — full bleed tide */
.hero {
  position: relative;
  min-height: min(90vh, 800px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: tideDrift 26s ease-in-out infinite alternate;
}

@keyframes tideDrift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.07) translateY(-1.5%); }
}

.hero-overlay {
  position: relative;
  z-index: 1;
  width: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(14, 31, 40, 0.25) 30%,
    rgba(14, 31, 40, 0.9) 100%
  );
  padding: 5.5rem 0 3.25rem;
}

.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.35rem;
  color: var(--white);
  animation: riseIn 0.95s var(--ease) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-brand {
  font-family: var(--serif);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 0 0 0.55rem;
  line-height: 1;
  color: var(--white);
}

.hero h1 {
  font-family: var(--sans);
  font-size: clamp(1.02rem, 2.1vw, 1.22rem);
  font-weight: 400;
  letter-spacing: 0.015em;
  color: rgba(250, 248, 243, 0.92);
  max-width: 30rem;
  margin-bottom: 0.7rem;
  line-height: 1.45;
}

.hero .hero-lede {
  font-size: 0.98rem;
  color: rgba(250, 248, 243, 0.72);
  max-width: 26rem;
  margin-bottom: 1.45rem;
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.35rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}

.btn-light {
  background: var(--white);
  color: var(--ink);
  border-color: var(--white);
}
.btn-light:hover {
  background: transparent;
  color: var(--white);
  border-color: var(--white);
}

.btn-primary {
  background: var(--tide);
  color: var(--white);
  border-color: var(--tide);
}
.btn-primary:hover {
  background: var(--salt);
  border-color: var(--salt);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--white);
}

/* Sections */
.section { padding: 4.25rem 0; }

.section-alt {
  background: rgba(255, 252, 246, 0.5);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.section-tide {
  background: var(--tide);
  color: var(--white);
}
.section-tide h2,
.section-tide h3 { color: var(--white); }
.section-tide .lead,
.section-tide p { color: rgba(250, 248, 243, 0.84); }
.section-tide a { color: #9fd0c8; }
.section-tide a:hover { color: var(--white); }

.section-header {
  max-width: 38rem;
  margin-bottom: 2.4rem;
}

.eyebrow {
  display: block;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--foam);
  margin-bottom: 0.55rem;
}

.section-tide .eyebrow { color: #8ec4bc; }

.lead {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0;
}

/* Quote band — Fonte-inspired atmosphere */
.quote-band {
  padding: 3.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(22, 61, 74, 0.05), transparent 40%),
    var(--paper-soft);
  text-align: center;
}
.quote-band blockquote {
  margin: 0 auto;
  max-width: 34rem;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3.2vw, 2rem);
  font-style: italic;
  line-height: 1.35;
  color: var(--tide);
}
.quote-band cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Pillars */
.pillar-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.25rem;
  border-top: 2px solid var(--tide);
  padding-top: 2rem;
}

.pillar h3 { margin-bottom: 0.45rem; }
.pillar p {
  color: var(--muted);
  margin: 0;
  font-size: 0.97rem;
}

/* Discover */
.discover-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.15rem;
  min-height: 460px;
}

.discover-main,
.discover-side a {
  position: relative;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
}

.discover-main { min-height: 460px; }
.discover-side {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.discover-side a { flex: 1; min-height: 170px; }

.discover-main img,
.discover-side img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  transition: transform 0.7s var(--ease);
}

.discover-main:hover img,
.discover-side a:hover img {
  transform: scale(1.04);
}

.discover-caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.4rem;
  background: linear-gradient(transparent, rgba(14, 31, 40, 0.88));
  color: var(--white);
  z-index: 1;
}
.discover-caption h3 {
  color: var(--white);
  margin-bottom: 0.2rem;
}
.discover-caption p {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(250, 248, 243, 0.78);
}

/* Feature */
.feature-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.feature-strip img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  filter: contrast(1.04) saturate(0.9);
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.feature-list li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--ink-soft);
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 0.5rem;
  height: 1.5px;
  background: var(--salt);
}

/* Visit / hours */
.visit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.hours-table th,
.hours-table td {
  text-align: left;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(250, 248, 243, 0.2);
}
.section:not(.section-tide) .hours-table th,
.section:not(.section-tide) .hours-table td {
  border-bottom-color: var(--line);
}
.hours-table th {
  font-weight: 600;
  width: 48%;
}

/* Shelf catalogue */
.shelf-block {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 3.75rem;
  padding-bottom: 3.75rem;
  border-bottom: 1px solid var(--line);
}
.shelf-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.shelf-block.reverse { direction: rtl; }
.shelf-block.reverse > * { direction: ltr; }
.shelf-block img {
  width: 100%;
  aspect-ratio: 5/4;
  object-fit: cover;
}

.cat-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--salt);
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--salt);
  padding-bottom: 0.15rem;
}

.title-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.title-list li {
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}
.title-list .author {
  color: var(--muted);
  font-style: italic;
  font-family: var(--serif);
}

/* Events */
.event-list {
  display: flex;
  flex-direction: column;
}
.event-item {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.5rem;
  padding: 1.7rem 0;
  border-bottom: 1px solid var(--line);
}
.event-date {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--tide);
  line-height: 1.3;
}
.event-date small {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}
.event-item h3 { margin-bottom: 0.3rem; }
.event-item p { margin: 0; color: var(--muted); font-size: 0.97rem; }

/* Page hero */
.page-hero {
  padding: 3.25rem 0 2.35rem;
  border-bottom: 2px solid var(--tide);
  background:
    linear-gradient(120deg, rgba(22, 61, 74, 0.07), transparent 55%),
    var(--paper-soft);
}
.page-hero h1 { margin-bottom: 0.45rem; }
.page-hero .lead { max-width: 36rem; }

/* About */
.prose { max-width: 40rem; }
.prose p { color: var(--ink-soft); }

.about-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: start;
}
.about-layout img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
}

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
}

.contact-details dt {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--foam);
  margin-top: 1.2rem;
}
.contact-details dt:first-child { margin-top: 0; }
.contact-details dd {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
}
.contact-details a { text-decoration: none; }
.contact-details a:hover { text-decoration: underline; }

.contact-form label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  margin-top: 1rem;
}
.contact-form label:first-child { margin-top: 0; }
.contact-form input,
.contact-form textarea,
.contact-form select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--line);
  background: var(--white);
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
}
.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
  outline: 2px solid var(--tide-mid);
  outline-offset: 1px;
}
.contact-form textarea { min-height: 140px; resize: vertical; }
.contact-form .btn { margin-top: 1.25rem; }

.map-note {
  margin-top: 2rem;
  padding: 1.2rem;
  border-left: 3px solid var(--tide);
  background: rgba(255, 252, 246, 0.65);
  font-size: 0.94rem;
  color: var(--muted);
}

/* Legal */
.legal-content {
  max-width: 42rem;
  padding: 3rem 0 4.5rem;
}
.legal-content h2 {
  font-size: 1.35rem;
  margin-top: 2rem;
}
.legal-content ul {
  padding-left: 1.2rem;
  color: var(--ink-soft);
}
.legal-content li { margin-bottom: 0.4rem; }
.legal-content code {
  font-size: 0.9em;
  background: rgba(22, 61, 74, 0.08);
  padding: 0.1em 0.35em;
}

/* Footer */
.site-footer {
  background: var(--ink);
  color: rgba(250, 248, 243, 0.76);
  padding: 3.5rem 0 2rem;
}
.site-footer a {
  color: #9fd0c8;
  text-decoration: none;
}
.site-footer a:hover { color: var(--white); text-decoration: underline; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand {
  font-family: var(--serif);
  font-size: 1.55rem;
  color: var(--white);
  margin-bottom: 0.5rem;
}
.footer-grid h3 {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(250, 248, 243, 0.48);
  margin-bottom: 0.85rem;
}
.footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-grid li { margin-bottom: 0.4rem; }

.footer-bottom {
  border-top: 1px solid rgba(250, 248, 243, 0.12);
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  font-size: 0.85rem;
}
.footer-legal {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--ink);
  color: var(--white);
  padding: 1.25rem 1.35rem;
  transform: translateY(110%);
  transition: transform 0.4s var(--ease);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.28);
}
.cookie-banner.is-visible { transform: translateY(0); }

.cookie-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.cookie-inner p {
  margin: 0;
  flex: 1 1 280px;
  font-size: 0.92rem;
  color: rgba(250, 248, 243, 0.85);
}
.cookie-inner a { color: #9fd0c8; }

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cookie-actions button {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(250, 248, 243, 0.35);
  background: transparent;
  color: var(--white);
  cursor: pointer;
}
.cookie-actions button:hover { border-color: var(--white); }
.cookie-actions #cookie-accept {
  background: var(--white);
  color: var(--ink);
  border-color: var(--white);
}

.cookie-settings-panel {
  display: none;
  max-width: var(--max);
  margin: 1rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(250, 248, 243, 0.15);
}
.cookie-settings-panel.is-open { display: block; }
.cookie-settings-panel label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

@media (max-width: 900px) {
  .pillar-row,
  .discover-grid,
  .feature-strip,
  .visit-grid,
  .shelf-block,
  .shelf-block.reverse,
  .about-layout,
  .contact-grid,
  .footer-grid {
    grid-template-columns: 1fr;
    direction: ltr;
  }
  .discover-main { min-height: 270px; }
  .event-item { grid-template-columns: 5.5rem 1fr; gap: 1rem; }
}

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

  .main-nav {
    position: fixed;
    inset: 0;
    background: var(--paper-soft);
    padding: 5rem 1.5rem 2rem;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease);
    z-index: 150;
    border-left: 2px solid var(--tide);
  }
  .main-nav.is-open { transform: translateX(0); }
  .main-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
  .main-nav a { font-size: 1.15rem; }

  body.nav-open { overflow: hidden; }

  .hero { min-height: 76vh; }
  .pillar-row { gap: 1.6rem; }
}
