:root {
  color-scheme: light;

  --bg: #cccccc;
  --bg-elevated: #d5d5d5;
  --surface: #f4f4f4;
  --surface-strong: #ffffff;
  --surface-muted: #e9e9e9;
  --text: #202020;
  --text-soft: #515151;
  --text-muted: #707070;
  --border: rgba(32, 32, 32, 0.14);
  --border-strong: rgba(32, 32, 32, 0.25);
  --shadow: 0 1.4rem 4rem rgba(31, 31, 31, 0.13);
  --overlay: rgba(20, 20, 20, 0.42);
  --focus: #202020;

  --sans:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;
  --serif: Georgia, 'Times New Roman', serif;

  --page-width: 920px;
  --archive-width: 280px;
  --radius-sm: 0.8rem;
  --radius-md: 1.3rem;
  --radius-lg: 2rem;
  --control-size: 3.25rem;
}

html[data-theme='dark'] {
  color-scheme: dark;

  --bg: #232530;
  --bg-elevated: #1d1f28;
  --surface: #292c36;
  --surface-strong: #30343f;
  --surface-muted: #20232c;
  --text: #e6edf7;
  --text-soft: #cdd6e3;
  --text-muted: #9ba9ba;
  --border: rgba(205, 214, 227, 0.14);
  --border-strong: rgba(205, 214, 227, 0.28);
  --shadow: 0 1.5rem 4rem rgba(10, 12, 17, 0.35);
  --overlay: rgba(4, 5, 8, 0.68);
  --focus: #84a9bf;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  transition:
    background-color 220ms ease,
    color 220ms ease;
}

body.is-locked {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.24em;
}

a:hover {
  text-decoration-color: currentColor;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

svg {
  display: block;
  width: 1.45rem;
  height: 1.45rem;
  fill: currentColor;
}

::selection {
  background: var(--text);
  color: var(--surface);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  z-index: 1000;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  transform: translate(-50%, -180%);
  transition: transform 160ms ease;
}

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

.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;
}

.site-shell {
  display: grid;
  grid-template-columns: var(--archive-width) minmax(0, var(--page-width));
  justify-content: center;
  gap: clamp(2rem, 5vw, 5rem);
  width: min(100% - 3rem, 1380px);
  margin: 0 auto;
}

.page-column {
  min-width: 0;
  padding: 1.75rem 0 4rem;
}

.site-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-height: var(--control-size);
  margin-bottom: clamp(3rem, 7vw, 6.5rem);
}

.site-name {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.95rem;
  font-weight: 720;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 var(--control-size);
  width: var(--control-size);
  height: var(--control-size);
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 0.3rem 1.4rem rgba(0, 0, 0, 0.04);
  color: var(--text-soft);
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(0);
}

.menu-button,
.menu-pill {
  display: none;
}

.theme-icon-moon,
html[data-theme='dark'] .theme-icon-sun {
  display: none;
}

html[data-theme='dark'] .theme-icon-moon {
  display: block;
}

.hero {
  margin-bottom: clamp(3rem, 7vw, 5.5rem);
}

.hero-title {
  margin: 0;
  color: var(--text);
  font-size: clamp(3.25rem, 8.3vw, 7.2rem);
  font-weight: 800;
  letter-spacing: -0.068em;
  line-height: 0.94;
  text-align: center;
  text-wrap: balance;
}

.hero-title > span {
  display: inline-block;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.pill {
  display: inline-flex;
  min-height: 3.05rem;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.93rem;
  font-weight: 720;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.view {
  min-height: 24rem;
}

.loading-card,
.error-card,
.empty-state {
  display: grid;
  min-height: 15rem;
  place-items: center;
  align-content: center;
  gap: 1rem;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
  box-shadow: var(--shadow);
}

.loading-card p,
.error-card p,
.empty-state p {
  margin: 0;
}

.loading-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: var(--text-muted);
  animation: loadingPulse 900ms ease-in-out infinite alternate;
}

.posts-grid {
  display: grid;
  gap: 1.25rem;
}

.post-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 180ms ease;
}

.post-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  transform: translateY(-2px);
}

.post-card h2 {
  max-width: 19ch;
  margin: 0;
  color: var(--text);
  font-size: clamp(1.75rem, 4vw, 3rem);
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-wrap: balance;
}

.post-card h2 a {
  text-decoration: none;
}

.post-card h2 a::after {
  position: absolute;
  inset: 0;
  content: '';
}

.post-excerpt {
  max-width: 68ch;
  margin: 1.5rem 0 0;
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: clamp(1.08rem, 2vw, 1.3rem);
  line-height: 1.65;
}

.read-label {
  display: inline-block;
  margin-top: 1.35rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-view {
  display: grid;
  gap: 1.25rem;
}

.article-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.back-link {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-soft);
  font-weight: 700;
  text-decoration: none;
}

.back-link svg {
  width: 1.15rem;
  height: 1.15rem;
}

.article-card {
  padding: clamp(1.6rem, 5vw, 4rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.article-title {
  max-width: 18ch;
  margin: 0;
  color: var(--text);
  font-size: clamp(2.25rem, 6.5vw, 5.2rem);
  font-weight: 800;
  letter-spacing: -0.058em;
  line-height: 0.98;
  text-wrap: balance;
}

.article-body {
  max-width: 70ch;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  color: var(--text-soft);
  font-family: var(--serif);
  font-size: clamp(1.12rem, 2.3vw, 1.42rem);
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body > :last-child {
  margin-bottom: 0;
}

.article-body p,
.article-body blockquote,
.article-body ul,
.article-body ol {
  margin: 0 0 1.15em;
}

.article-body blockquote {
  padding-left: 1.2rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text);
  font-style: italic;
}

.article-body img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: var(--radius-sm);
}

.article-body a {
  color: var(--text);
}

.article-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.article-actions .pill {
  flex: 0 0 auto;
}

.share-status {
  min-height: 1.25rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.archive {
  position: sticky;
  top: 1.75rem;
  align-self: start;
  max-height: calc(100vh - 3.5rem);
  padding: 1.4rem 0.7rem 1.4rem 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.archive-heading,
.drawer-header {
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.archive h2,
.archive-drawer h2,
.search-dialog h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.archive-list {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-list a {
  display: block;
  padding: 0.72rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.93rem;
  line-height: 1.35;
  text-decoration: none;
  transition:
    background-color 150ms ease,
    color 150ms ease;
}

.archive-list a:hover,
.archive-list a[aria-current='page'] {
  background: var(--surface);
  color: var(--text);
}

.archive-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: min(88vw, 360px);
  padding: 1.25rem;
  overflow-y: auto;
  background: var(--bg-elevated);
  box-shadow: 1.5rem 0 4rem rgba(0, 0, 0, 0.18);
  transform: translateX(-105%);
  visibility: hidden;
  transition:
    transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
    visibility 260ms;
}

.archive-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-header,
.search-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--overlay);
  opacity: 0;
  transition: opacity 220ms ease;
}

.drawer-backdrop.is-visible {
  opacity: 1;
}

.search-dialog {
  width: min(92vw, 760px);
  max-height: min(84vh, 760px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 2rem 7rem rgba(0, 0, 0, 0.35);
}

.search-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.search-dialog-inner {
  padding: clamp(1.2rem, 4vw, 2rem);
}

.search-heading {
  margin-bottom: 1.25rem;
}

.search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
}

.search-field svg {
  color: var(--text-muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 0.9rem 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-field input::placeholder {
  color: var(--text-muted);
}

.search-results {
  max-height: 52vh;
  margin-top: 1rem;
  overflow-y: auto;
}

.search-help,
.search-no-results {
  margin: 1.5rem 0;
  color: var(--text-muted);
  text-align: center;
}

.search-result-list {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-result-link {
  display: block;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
}

.search-result-link:hover {
  background: var(--surface-strong);
}

.search-result-link strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
}

.search-result-link span {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-family: var(--serif);
  line-height: 1.45;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-top: 4rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.86rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text-soft);
}

.noscript-message {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 1000;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  text-align: center;
}

@keyframes loadingPulse {
  from {
    opacity: 0.35;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1.1);
  }
}

@media (max-width: 1120px) {
  .site-shell {
    display: block;
    width: min(100% - 2.5rem, var(--page-width));
  }

  .archive-desktop {
    display: none;
  }

  .menu-button,
  .menu-pill {
    display: inline-grid;
  }

  .menu-pill {
    display: inline-flex;
  }
}

@media (max-width: 700px) {
  :root {
    --control-size: 3rem;
  }

  .site-shell {
    width: min(100% - 1.5rem, var(--page-width));
  }

  .page-column {
    padding-top: 0.85rem;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    margin: 0 -0.3rem 3rem;
    padding: 0.65rem 0.3rem;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
  }

  .site-name {
    font-size: 0.82rem;
  }

  .hero-title {
    font-size: clamp(3rem, 15vw, 5rem);
    text-align: center;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .pill {
    width: 100%;
  }

  .post-card,
  .article-card {
    border-radius: var(--radius-md);
  }

  .post-card h2 {
    max-width: none;
  }

  .article-toolbar {
    align-items: flex-start;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .site-shell {
    width: min(100% - 1rem, var(--page-width));
  }

  .header-actions {
    gap: 0.4rem;
  }

  .site-name {
    visibility: hidden;
  }

  .hero {
    margin-top: 1rem;
  }

  .hero-title {
    font-size: clamp(2.65rem, 14.5vw, 4rem);
  }

  .post-card,
  .article-card {
    padding: 1.35rem;
  }

  .article-title {
    font-size: clamp(2.15rem, 13vw, 3.5rem);
  }

  .article-body {
    font-size: 1.08rem;
  }

  .search-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    border-radius: var(--radius-md);
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Página dedicada ao livro */
.book-page-body {
  display: grid;
  min-height: 100vh;
}

.book-page-shell {
  width: min(100% - 2.5rem, 760px);
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.book-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--control-size);
  margin-bottom: clamp(3rem, 8vw, 6rem);
}

.book-back-link {
  display: inline-flex;
  min-height: var(--control-size);
  align-items: center;
  gap: 0.65rem;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 720;
  text-decoration: none;
}

.book-back-link:hover {
  color: var(--text);
}

.book-back-link svg {
  width: 1.2rem;
  height: 1.2rem;
}

.book-page-main {
  display: grid;
  place-items: center;
}

.book-card {
  width: 100%;
  padding: clamp(1.6rem, 6vw, 4rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.book-kicker {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.book-title {
  margin: 0;
  color: var(--text);
  font-family: var(--serif);
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-wrap: balance;
}

.book-title > span,
.book-intro > span {
  display: block;
}

.book-intro {
  max-width: 36rem;
  margin: 1.35rem auto 0;
  color: var(--text-muted);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  line-height: 1.65;
}

.book-actions {
  display: grid;
  gap: 0.85rem;
  max-width: 38rem;
  margin: clamp(2rem, 6vw, 3.5rem) auto 0;
}

.book-store-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.book-store-button {
  display: flex;
  min-height: 3.75rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-weight: 760;
  text-align: left;
  text-decoration: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.book-support-button {
  width: 100%;
  background: transparent;
}

.book-store-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  transform: translateY(-2px);
}

.book-store-button span {
  display: grid;
  gap: 0.15rem;
}

.book-store-button strong {
  font-size: 1rem;
}

.book-store-button small {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 560;
}

.book-store-button svg {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
}

.book-page-footer {
  margin-top: 2.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 520px) {
  .book-page-shell {
    width: min(100% - 1rem, 760px);
    padding-top: 0.75rem;
  }

  .book-page-header {
    margin-bottom: 2.5rem;
  }

  .book-back-link span {
    display: none;
  }

  .book-card {
    padding: 1.4rem;
    border-radius: var(--radius-md);
  }

  .book-title {
    font-size: clamp(2.3rem, 13vw, 3.7rem);
  }

  .book-store-button {
    min-height: 3.5rem;
    padding: 0.85rem 0.8rem;
  }

  .book-store-button small {
    font-size: 0.72rem;
  }

  .book-store-button svg {
    width: 1.05rem;
    height: 1.05rem;
  }
}

@media (max-width: 360px) {
  .book-store-grid {
    gap: 0.55rem;
  }

  .book-store-button {
    gap: 0.45rem;
    padding: 0.78rem 0.65rem;
  }

  .book-store-button strong {
    font-size: 0.9rem;
  }

  .book-store-button small {
    display: none;
  }
}

/* Navegação recolhível e hierarquia das ações */
.site-shell {
  display: block;
  width: min(100% - 2.5rem, var(--page-width));
  margin: 0 auto;
}

.menu-button {
  display: inline-grid;
}

.primary-action {
  border-color: var(--text);
  background: var(--text);
  color: var(--surface);
}

.primary-action:hover {
  border-color: var(--text-soft);
  background: var(--text-soft);
  color: var(--surface);
}

.secondary-action {
  background: transparent;
  color: var(--text-soft);
}

.secondary-action:hover {
  background: color-mix(in srgb, var(--surface) 48%, transparent);
}

.footer-site-link {
  display: inline-flex;
  min-height: 2.15rem;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 680;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.footer-site-link:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.article-book-link {
  width: auto;
}

.book-page-header {
  display: grid;
  grid-template-columns: var(--control-size) minmax(0, 1fr) var(--control-size);
  align-items: center;
}

.book-page-header .site-name {
  display: block;
}

.book-page-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.book-page-footer p {
  margin: 0;
}

.book-page-footer .book-preferences-note {
  flex: 1 0 100%;
  max-width: 44rem;
  margin-inline: auto;
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: center;
  text-wrap: balance;
}

@media (max-width: 700px) {
  .site-shell {
    width: min(100% - 1.5rem, var(--page-width));
  }

  .hero-actions .pill {
    width: auto;
  }
}

@media (max-width: 520px) {
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions .pill,
  .article-actions,
  .article-actions .pill,
  .article-book-link {
    width: 100%;
  }

  .book-page-header .site-name {
    visibility: visible;
    font-size: 0.78rem;
  }

  .book-page-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Caixa de partilha */
.share-dialog {
  width: min(92vw, 620px);
  max-height: min(86vh, 720px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 2rem 7rem rgba(0, 0, 0, 0.35);
}

.share-dialog[open] {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: block;
  margin: auto;
}

.share-dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(4px);
}

.share-dialog-inner {
  padding: clamp(1.2rem, 4vw, 2rem);
}

.share-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.share-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.share-summary {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.share-summary strong {
  color: var(--text);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.share-summary span {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.share-option {
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.share-option:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.share-option svg {
  flex: 0 0 1.4rem;
}

.share-option-copy {
  width: 100%;
}

@media (max-width: 520px) {
  .share-dialog {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    border-radius: var(--radius-md);
  }

  .share-options {
    grid-template-columns: 1fr;
  }
}

/* Navegação textual, contactos e regresso ao topo */
.menu-button.menu-text-button {
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: var(--control-size);
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0 1.05rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 0.3rem 1.4rem rgba(0, 0, 0, 0.04);
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.menu-button.menu-text-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.menu-button.menu-text-button:active {
  transform: translateY(0);
}

.drawer-header {
  align-items: center;
}

.drawer-header > div {
  display: flex;
  align-items: center;
}

.drawer-header h2 {
  line-height: 1.15;
}

.back-to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 70;
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.68rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  box-shadow: var(--shadow);
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 720;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.back-to-top:hover {
  border-color: var(--text-muted);
  color: var(--text);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 1.15rem;
  height: 1.15rem;
}

@media (max-width: 700px) {
  .menu-button.menu-text-button {
    min-height: 2.8rem;
    height: 2.8rem;
    padding-inline: 0.86rem;
    font-size: 0.8rem;
  }

  .back-to-top {
    right: 0.85rem;
    bottom: 0.85rem;
    min-height: 2.8rem;
    padding: 0.62rem 0.82rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 390px) {
  .menu-button.menu-text-button {
    max-width: 8.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .back-to-top span {
    display: none;
  }

  .back-to-top {
    width: 2.9rem;
    padding: 0;
  }
}

/* Correção do cabeçalho da página do livro */
.book-page-header {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.book-page-header .book-back-link {
  justify-self: start;
  white-space: nowrap;
}

.book-page-header .header-actions {
  justify-self: end;
}

@media (max-width: 700px) {
  .book-page-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .book-page-header .site-name {
    display: none;
  }

  .book-back-link span {
    display: inline;
  }
}

/* O título principal permanece centrado em qualquer largura */
.hero {
  display: grid;
  justify-items: center;
}

.hero-title {
  width: 100%;
  margin-inline: auto;
  text-align: center;
}

.hero-title > span {
  width: 100%;
  text-align: center;
}

/* Preferências partilhadas e ícones de tema */
.theme-icon {
  display: block;
  width: 1.24rem;
  height: 1.24rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-preferences {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
}

.drawer-preferences-title {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-language-switcher {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 0.22rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.drawer-language-switcher button {
  min-height: 2.45rem;
  padding: 0 0.82rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.drawer-language-switcher button:hover {
  color: var(--text);
}

.drawer-language-switcher button[aria-pressed='true'] {
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 0.25rem 0.9rem rgba(0, 0, 0, 0.08);
}

.header-language-switcher {
  width: auto;
  min-height: var(--control-size);
  flex: 0 0 auto;
  padding: 0.22rem;
}

.header-language-switcher button {
  min-height: calc(var(--control-size) - 0.44rem);
  padding-inline: 0.72rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.drawer-preferences-note {
  max-width: 36rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.book-page-main {
  gap: 1.25rem;
}

.book-preferences {
  display: grid;
  width: 100%;
  justify-items: center;
  gap: 0.72rem;
  padding: 1.15rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  text-align: center;
}

.book-preferences .drawer-preferences-note {
  text-align: center;
}

.book-page-footer a {
  color: var(--text-soft);
  text-decoration: none;
}

.book-page-footer a:hover {
  color: var(--text);
}

@media (max-width: 520px) {
  .drawer-language-switcher {
    width: 100%;
  }

  .drawer-language-switcher button {
    flex: 1 1 50%;
  }

  .book-preferences {
    padding-inline: 0.85rem;
  }
}

/* Seletores de idioma visíveis no topo */
@media (max-width: 820px) {
  .site-header:not(.book-page-header) {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .site-header:not(.book-page-header) .site-name {
    display: none;
  }
}

@media (max-width: 620px) {
  .site-header:not(.book-page-header) {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.7rem;
  }

  .site-header:not(.book-page-header) .menu-button {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .site-header:not(.book-page-header) .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(3, var(--control-size));
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .site-header:not(.book-page-header) .header-language-switcher {
    width: 100%;
  }

  .book-page-header {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.7rem;
  }

  .book-page-header .book-back-link {
    grid-column: 1;
    grid-row: 1;
  }

  .book-page-header .header-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(2, var(--control-size));
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .book-page-header .header-language-switcher {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .header-language-switcher button {
    padding-inline: 0.55rem;
    font-size: 0.72rem;
  }
}

.theme-icon-moon,
html[data-theme='dark'] .theme-icon-sun {
  display: none;
}

html[data-theme='dark'] .theme-icon-moon {
  display: block;
}

/* Identidade venancio.dev no cabeçalho */
.poetry-header-start {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
}

.poetry-header-buttons {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
}

.poetry-brand-link {
  display: inline-grid;
  width: var(--control-size);
  height: var(--control-size);
  flex: 0 0 var(--control-size);
  place-items: center;
  border-radius: 999px;
  text-decoration: none;
}

.poetry-brand-link:hover {
  transform: translateY(-1px);
}

.poetry-brand-logo {
  display: block;
  width: var(--control-size);
  height: var(--control-size);
}

/* Animações partilhadas com venancio.dev, Development e Atlantico */
@keyframes venancioRevealUp {
  from {
    opacity: 0;
    transform: translateY(115%);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes venancioIconReveal {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes venancioCardReveal {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  overflow: hidden;
  padding-block: 0.12em;
}

.reveal > span {
  display: inline-block;
  opacity: 0;
  transform: translateY(115%);
  animation: venancioRevealUp 1400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-icon {
  opacity: 0;
  overflow: hidden;
  animation: venancioIconReveal 1400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-icon > span {
  opacity: 0;
  transform: translateY(115%);
  animation: venancioRevealUp 1400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-logo {
  opacity: 0;
  overflow: hidden;
  animation: venancioIconReveal 1400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 40ms;
}

.reveal-logo > .brand-logo {
  opacity: 0;
  transform: translateY(115%);
  animation: venancioRevealUp 1400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 140ms;
}

.reveal-card {
  opacity: 0;
  transform: translateY(18px);
  animation: venancioCardReveal 1400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.poetry-header-start .menu-button {
  animation-delay: 80ms;
}

.poetry-header-start .menu-button > span {
  animation-delay: 180ms;
}

.poetry-site-header > .site-name {
  animation-delay: 140ms;
}

.poetry-site-header > .site-name > span {
  display: inline-block;
  animation-delay: 240ms;
}

.poetry-site-header .header-actions > :nth-child(1) {
  animation-delay: 180ms;
}

.poetry-site-header .header-actions > :nth-child(2) {
  animation-delay: 240ms;
}

.poetry-site-header .header-actions > :nth-child(3) {
  animation-delay: 300ms;
}

.poetry-site-header .header-actions > :nth-child(4) {
  animation-delay: 360ms;
}

.hero-title > span {
  animation-delay: 420ms;
}

.hero-actions > :nth-child(1) {
  animation-delay: 580ms;
}

.hero-actions > :nth-child(1) > span {
  animation-delay: 680ms;
}

.hero-actions > :nth-child(2) {
  animation-delay: 700ms;
}

.hero-actions > :nth-child(2) > span {
  animation-delay: 800ms;
}

.hero-actions > :nth-child(3) {
  animation-delay: 820ms;
}

.hero-actions > :nth-child(3) > span {
  animation-delay: 920ms;
}

.site-footer.reveal-card {
  animation-delay: 1160ms;
}

.book-page-header .book-back-link {
  animation-delay: 60ms;
}

.book-page-header .book-back-link > span {
  animation-delay: 160ms;
}

.book-page-header > .site-name {
  animation-delay: 120ms;
}

.book-page-header > .site-name > span {
  display: inline-block;
  animation-delay: 220ms;
}

.book-page-header .header-actions > :nth-child(1) {
  animation-delay: 180ms;
}

.book-page-header .header-actions > :nth-child(2) {
  animation-delay: 240ms;
}

.book-page-header .header-actions > :nth-child(3) {
  animation-delay: 300ms;
}

.book-card.reveal-card {
  animation-delay: 440ms;
}

.book-title > span:nth-child(1) {
  animation-delay: 580ms;
}

.book-title > span:nth-child(2) {
  animation-delay: 680ms;
}

.book-intro > span:nth-child(1) {
  animation-delay: 800ms;
}

.book-intro > span:nth-child(2) {
  animation-delay: 900ms;
}

.book-store-grid > :nth-child(1) {
  animation-delay: 1020ms;
}

.book-store-grid > :nth-child(2) {
  animation-delay: 1140ms;
}

.book-support-button {
  animation-delay: 1260ms;
}

.book-page-footer.reveal-card {
  animation-delay: 1400ms;
}

@media (max-width: 820px) {
  .poetry-site-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .poetry-site-header > .site-name {
    display: none;
  }
}

@media (max-width: 620px) {
  .poetry-site-header {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.7rem;
  }

  .poetry-site-header .poetry-header-start {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    justify-content: space-between;
  }

  .poetry-site-header .header-actions {
    grid-column: 1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal > span,
  .reveal-icon,
  .reveal-icon > span,
  .reveal-logo,
  .reveal-logo > .brand-logo,
  .reveal-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

.book-title.reveal > span,
.book-intro.reveal > span {
  display: block;
}

/* RSS e navegação entre textos */
.rss-link {
  display: inline-flex;
  min-height: 2.4rem;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 720;
  text-decoration: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.rss-link svg {
  width: 1rem;
  height: 1rem;
}

.rss-link:hover {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text);
  transform: translateY(-1px);
}

.rss-header-link {
  height: var(--control-size);
  min-height: var(--control-size);
  flex: 0 0 auto;
  padding-inline: 0.9rem;
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 0.3rem 1.4rem rgba(0, 0, 0, 0.04);
  color: var(--text-soft);
  font-size: 0.82rem;
}

.rss-header-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
}

.poetry-header-start .rss-header-link {
  animation-delay: 120ms;
}

.poetry-header-start .rss-header-link > span {
  animation-delay: 220ms;
}

@media (max-width: 700px) {
  .rss-header-link {
    height: 2.8rem;
    min-height: 2.8rem;
    padding-inline: 0.78rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 390px) {
  .poetry-header-buttons {
    gap: 0.4rem;
  }

  .rss-header-link {
    width: 2.8rem;
    padding: 0;
    justify-content: center;
  }

  .rss-header-link span {
    display: none;
  }
}

.article-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.article-navigation-link {
  display: flex;
  min-width: 0;
  min-height: 6.4rem;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
  color: var(--text-soft);
  text-decoration: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.article-navigation-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.article-navigation-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.article-navigation-label svg {
  width: 1rem;
  height: 1rem;
}

.article-navigation-link strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.article-navigation-next {
  align-items: flex-end;
  text-align: right;
}

.article-navigation-spacer {
  min-width: 0;
}

@media (max-width: 620px) {
  .article-navigation {
    grid-template-columns: 1fr;
  }

  .article-navigation-spacer {
    display: none;
  }

  .article-navigation-link {
    min-height: 5.6rem;
  }
}

.toast {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 10000;

  max-width: 340px;
  padding: 0.85rem 1.1rem;

  border-radius: 14px;

  background: var(--surface);
  color: var(--text);

  border: 1px solid var(--border);

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);

  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;

  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 640px) {
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}
