/* Psicoexistencia — sistema editorial, fase 3
   Canonical logo geometry: approved master; both PNGs share the same alpha mask.
   Palette: Burgundy #9F000D / ivory #FCF8F0.
   Mobile-first responsive, reduced-motion aware. */
:root {
  color-scheme: light;
  --paper: #FCF8F0;
  --paper-rgb: 252, 248, 240;
  --ink: #302321;
  --muted: #6b5954;
  --accent: #9F000D;
  --accent-fg: #FCF8F0;
  --surface: #FFFCF7;
  --surface-hover: #fff8ef;
  --line: rgba(105, 60, 48, .19);
  --label: #9F000D;
  --outline: #9F000D;
  --closing: #9F000D;
  --closing-ink: #FCF8F0;
  --shadow: rgba(71, 27, 29, .12);
  --glow: rgba(159, 0, 13, .10);
  --featured-glow: rgba(252, 248, 240, .16);
  --theme-duration: 320ms;
  --editorial-ease: cubic-bezier(.22, 1, .36, 1);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
html[data-mode="wine"] {
  color-scheme: dark;
  --paper: #9F000D;
  --paper-rgb: 159, 0, 13;
  --ink: #FCF8F0;
  --muted: #F6D6D2;
  --accent: #FCF8F0;
  --accent-fg: #9F000D;
  --surface: #8E0916;
  --surface-hover: #810511;
  --line: rgba(255, 245, 232, .27);
  --label: #F5CFCA;
  --outline: #FCF8F0;
  --closing: #FCF8F0;
  --closing-ink: #9F000D;
  --shadow: rgba(47, 0, 8, .19);
  --glow: rgba(252, 248, 240, .14);
  --featured-glow: rgba(159, 0, 13, .10);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1.25rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--accent-fg); }
a { color: inherit; }
button { font: inherit; }
img, svg { display: block; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--outline); outline-offset: 4px; }
.container { width: min(100% - 2.5rem, 1160px); margin-inline: auto; }
.skip-link { position: absolute; left: 1rem; top: 0; z-index: 100; padding: .8rem 1rem; color: #FCF8F0; background: #9F000D; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.announcement {
  display: flex; align-items: center; justify-content: center; gap: 1.25rem;
  min-height: 30px; padding: .25rem 1rem;
  background: #9F000D; color: #FCF8F0;
  font-weight: 600; font-size: .59rem; letter-spacing: .16em;
}
.announcement-star { font-size: .85rem; line-height: 1; }
.site-header { position: relative; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { width: min(30vw, 255px); min-width: 155px; flex: 0 0 auto; display: block; text-decoration: none; }
.brand-logo { display: block; width: 100%; height: auto; }
.brand-logo-wine { display: none; }
html[data-mode="wine"] .brand-logo-light { display: none; }
html[data-mode="wine"] .brand-logo-wine { display: block; }
.header-nav { display: flex; align-items: center; gap: clamp(1.15rem, 3vw, 2.55rem); margin-left: auto; }
.header-nav a { color: var(--ink); font-size: .875rem; font-weight: 600; text-decoration: none; text-underline-offset: .4rem; }
.header-nav a:hover { text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: .85rem; }
.theme-switch {
  appearance: none; border: 1px solid var(--line); background: transparent; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  border-radius: 999px; padding: .52rem .7rem; min-height: 41px; inline-size: 7.25rem; flex: 0 0 auto; cursor: pointer;
  font-size: .73rem; font-weight: 650; transition: background-color var(--theme-duration) ease, color var(--theme-duration) ease, border-color var(--theme-duration) ease, transform .2s ease;
}
.theme-switch:hover { background: var(--surface); transform: translateY(-2px); border-color: var(--ink); }
.theme-switch-icon { font-size: 1.05rem; line-height: 1; }
.button { display: inline-flex; justify-content: space-between; align-items: center; gap: 1.1rem; border: 1px solid transparent; border-radius: 999px; padding: .93rem 1.3rem; min-height: 53px; font-size: .84rem; font-weight: 700; line-height: 1.15; text-decoration: none; cursor: pointer; transition: background-color var(--theme-duration) ease, color var(--theme-duration) ease, border-color var(--theme-duration) ease, transform .23s ease, box-shadow .23s ease; }
.button:hover { transform: translateY(-3px); box-shadow: 0 10px 26px var(--shadow); }
.button-small { padding: .7rem 1.1rem; min-height: 41px; }
.button-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.button-outline:hover { background: var(--ink); color: var(--paper); }
.button-primary { color: var(--accent-fg); background: var(--accent); min-width: 216px; }
.button-primary:hover { background: var(--ink); color: var(--paper); }
.button-arrow { font-size: 1.1rem; line-height: 1; transition: transform .24s var(--editorial-ease); }
.header-book .button-arrow { font-size: 1rem; }
.button:is(:hover, :focus-visible) .button-arrow { transform: translate(4px, -3px); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr); align-items: center; gap: clamp(2.75rem, 7.5vw, 7.5rem); min-height: 625px; padding-block: clamp(3.3rem, 5vw, 6rem) 4rem; }
.hero-copy { min-width: 0; padding-bottom: 2rem; }
.eyebrow { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.7rem; color: var(--label); font-size: .75rem; letter-spacing: .16em; font-weight: 700; }
.eyebrow-mark { width: 22px; height: 1px; flex: 0 0 22px; background: currentColor; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.052em; }
h1 { margin-bottom: 1.7rem; font-size: clamp(5.2rem, 9.8vw, 9rem); line-height: 1.09; }
h1 em, h2 em { color: var(--accent); font-weight: 400; }
.hero-description { max-width: 465px; margin-bottom: 1.85rem; color: var(--muted); font-size: clamp(1rem, 1.45vw, 1.06rem); line-height: 1.75; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem 1.5rem; }
.text-link { display: inline-flex; align-items: center; gap: .7rem; min-height: 45px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); font-size: .79rem; font-weight: 700; transition: color var(--theme-duration) ease, border-color var(--theme-duration) ease; }
.text-link:hover { border-color: currentColor; }
.mobile-index { display: none; }
.hero-footnote { display: flex; align-items: center; gap: 1rem; margin-top: 3.1rem; color: var(--muted); font-size: .75rem; letter-spacing: .02em; }
.hero-footnote-line { display: block; width: 32px; height: 1px; background: var(--muted); }
.hero-visual { margin: 0; max-width: 460px; justify-self: end; width: 100%; }
.hero-image-wrap { position: relative; isolation: isolate; padding: 12px; border: 1px solid var(--line); border-radius: 220px 220px 6px 6px; }
.hero-image-wrap::before { content: ""; position: absolute; top: 22px; left: -16px; bottom: -17px; right: 16px; border: 1px solid var(--line); border-radius: inherit; z-index: -1; }
.hero-image-wrap picture { display: block; }
.hero-image-wrap img { width: 100%; height: auto; aspect-ratio: .91; object-fit: cover; object-position: center 67%; border-radius: 205px 205px 2px 2px; }
.visual-stamp { position: absolute; right: -8px; bottom: 46px; display: grid; place-content: center; width: 108px; height: 108px; background: #FCF8F0; color: #9F000D; border: 1px solid #9F000D; border-radius: 50%; transform: rotate(11deg); text-align: center; font-weight: 700; font-size: .59rem; letter-spacing: .12em; line-height: 1.45; }
.hero-visual figcaption { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding-top: 1.15rem; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .07em; line-height: 1.35; }
.hero-visual figcaption span:nth-child(2) { font-size: 1.1rem; }
.section-transition { display: flex; justify-content: center; align-items: center; gap: 1.1rem; max-width: 1160px; margin: 0 auto; padding: 0 1.25rem 3.3rem; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .15em; }
.transition-line { height: 1px; background: var(--line); flex: 1; }

/* Link directory */
.links-section { background: var(--paper); padding-block: 1rem clamp(5rem, 9vw, 9rem); }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 3.4rem; }
.eyebrow-section { margin-bottom: 1.25rem; }
h2 { font-size: clamp(4.4rem, 8.0vw, 8rem); line-height: 1.06; margin-bottom: 0; }
.section-header > div { min-width: 0; }
.section-header > p { max-width: 230px; color: var(--muted); line-height: 1.7; font-size: .9375rem; margin-bottom: .55rem; }
.group-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-top: 1px solid var(--line); padding: 1.25rem 0 1.15rem; margin-top: 3.2rem; font-size: .75rem; letter-spacing: .09em; font-weight: 700; color: var(--label); }
.group-heading > :last-child { color: var(--muted); text-align: right; }
.group-heading span[aria-hidden] { padding-inline: .3rem; opacity: .45; }
.cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.link-card { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 3rem; min-height: 247px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); text-decoration: none; padding: 1.55rem 1.65rem; transition: transform var(--card-motion-duration, .26s) var(--editorial-ease), background-color var(--theme-duration) ease, color var(--theme-duration) ease, border-color var(--theme-duration) ease, box-shadow .26s ease; }
.link-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(360px circle at var(--pointer-x, 50%) var(--pointer-y, 50%), var(--glow), transparent 72%); z-index: -1; transition: opacity .22s ease; }
.link-card:is(:hover, :active) { border-color: var(--accent); background: var(--surface-hover); }
.link-card:focus-visible { border-color: var(--accent); }
.link-card-featured { background: #9F000D; color: #FCF8F0; border-color: #9F000D; }
.link-card-featured:is(:hover, :active) { background: #8B0713; border-color: #8B0713; }
html[data-mode="wine"] .link-card-featured { background: #FCF8F0; color: #9F000D; border-color: #FCF8F0; }
html[data-mode="wine"] .link-card-featured:is(:hover, :active) { background: #fff6ea; border-color: #fff6ea; }
.link-card-featured::before { background: radial-gradient(360px circle at var(--pointer-x, 50%) var(--pointer-y, 50%), var(--featured-glow), transparent 72%); }
.link-card:active { --card-motion-duration: .12s; transform: scale(.985); }
.card-top, .card-bottom { display: flex; justify-content: space-between; gap: 1rem; }
.card-top { align-items: flex-start; }
.card-icon { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; opacity: .84; }
.card-icon svg { width: 22px; height: 22px; }
.card-serial { font-family: var(--serif); font-size: 1.05rem; opacity: .6; }
.card-bottom { align-items: end; }
.card-bottom > div { min-width: 0; overflow-wrap: break-word; }
.card-tag { display: block; margin-bottom: .55rem; font-size: .75rem; letter-spacing: .08em; line-height: 1.35; font-weight: 700; opacity: .85; }
.card-bottom h3 { margin: 0; font-family: var(--serif); font-size: clamp(2.1rem, 3.5vw, 3.15rem); font-weight: 500; letter-spacing: -.045em; line-height: 1; }
.card-bottom p { margin: .65rem 0 0; font-size: .9375rem; opacity: .88; line-height: 1.6; }
.card-arrow { display: grid; flex: 0 0 43px; width: 43px; height: 43px; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-size: 1.2rem; opacity: .78; transition: transform .24s var(--editorial-ease), opacity .24s ease, color var(--theme-duration) ease; }
.link-card:is(:hover, :focus-visible) .card-arrow { color: var(--accent); opacity: 1; transform: translate(4px, -3px); }
.link-card-featured:is(:hover, :focus-visible) .card-arrow { color: var(--accent-fg); }

/* Closing / footer */
.closing { background: var(--closing); color: var(--closing-ink); padding-block: clamp(4.6rem, 8vw, 8rem); }
.closing :focus-visible { outline-color: var(--closing-ink); }
.closing-inner { display: flex; justify-content: space-between; align-items: end; gap: 3rem; }
.closing-label { margin-bottom: 1.4rem; font-weight: 700; font-size: .75rem; letter-spacing: .15em; opacity: .85; }
.closing h2 { font-size: clamp(4.3rem, 8vw, 8rem); }
.closing h2 em { color: inherit; }
.closing-aside { max-width: 270px; }
.closing-aside > p:first-child { font-size: .91rem; line-height: 1.75; opacity: .82; }
.button-closing { border-color: var(--closing-ink); color: var(--closing-ink); background: transparent; min-width: min(230px, 100%); }
.button-closing:hover { background: var(--closing-ink); color: var(--closing); }
.share-feedback { min-height: 1.2rem; margin: .5rem 0 0; font-size: .75rem; }
.site-footer { background: var(--paper); }
.footer-top { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding-block: 3rem; border-bottom: 1px solid var(--line); }
.footer-brand { width: 270px; }
.back-to-top { text-decoration: none; font-weight: 650; font-size: .78rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.back-to-top:hover { border-color: currentColor; }
.footer-bottom { display: flex; justify-content: space-between; gap: 2rem; padding-block: 1.5rem 2.25rem; color: var(--muted); font-size: .75rem; }

.theme-transition .hero-image-wrap::before,
.theme-transition :is(body, .site-header, .header-nav a, .hero-description, .hero-footnote, .hero-visual figcaption, h1 em, h2 em, .eyebrow, .hero-image-wrap, .mobile-index a, .section-transition, .transition-line, .links-section, .section-header > p, .group-heading, .group-heading > :last-child, .closing, .site-footer, .footer-top, .footer-bottom) {
  transition: background-color var(--theme-duration) ease, color var(--theme-duration) ease, border-color var(--theme-duration) ease;
}

@media (min-width: 1240px) {
  .visual-stamp { right: -24px; }
}
@media (max-width: 1020px) {
  .header-nav { gap: 1rem; }
  .hero { min-height: 540px; gap: 3.5rem; }
  h1 { font-size: clamp(4.25rem, 9.2vw, 8rem); }
  .hero-image-wrap img { aspect-ratio: .86; }
}
@media (max-width: 760px) {
  .container { width: min(100% - 2.2rem, 600px); }
  .header-inner { min-height: 75px; gap: .8rem; }
  .brand { width: clamp(153px, 30vw, 210px); min-width: 0; }
  .header-nav { display: none; }
  .header-actions { margin-left: auto; }
  .theme-switch { inline-size: 44px; min-height: 44px; padding: .5rem; }
  .theme-switch-text { display: none; }
  .header-book { font-size: .73rem; padding: .7rem .85rem; }
  .hero { grid-template-columns: 1fr; gap: 1.7rem; padding-block: 2.75rem 1.05rem; min-height: 0; }
  .hero-copy { padding-bottom: 0; }
  h1 { font-size: clamp(5.1rem, 17vw, 8.2rem); margin-bottom: 1.1rem; }
  .hero-description { max-width: 430px; margin-bottom: 1.15rem; }
  .mobile-index { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.2rem; margin-top: .25rem; }
  .mobile-index a { display: inline-flex; align-items: center; min-block-size: 44px; min-inline-size: 44px; color: var(--accent); font-size: .875rem; font-weight: 650; text-decoration: underline; text-underline-offset: .25em; }
  .hero-footnote { display: none; }
  .hero-visual { justify-self: stretch; max-width: none; }
  .hero-image-wrap { padding: 8px; border-radius: 155px 155px 5px 5px; }
  .hero-image-wrap::before { top: 13px; left: -7px; bottom: -9px; right: 7px; }
  .hero-image-wrap img { aspect-ratio: 1.4; object-position: center 58%; border-radius: 148px 148px 2px 2px; }
  .visual-stamp { right: 9px; bottom: 14px; width: 68px; height: 68px; font-size: .5rem; }
  .hero-visual figcaption { padding-top: .8rem; }
  .section-transition { padding-bottom: 1.75rem; }
  .section-header { align-items: start; flex-direction: column; gap: .9rem; margin-bottom: 1.5rem; }
  #atencion { margin-top: 1.5rem; }
  .section-header > p { margin-bottom: 0; }
  h2 { font-size: clamp(4.1rem, 13vw, 6.7rem); }
  .cards-grid { gap: .8rem; }
  .link-card { padding: 1.2rem; min-height: 245px; }
  .card-bottom h3 { font-size: clamp(1.8rem, 4.8vw, 2.35rem); }
  .card-bottom p { font-size: .875rem; }
  .closing-inner { align-items: start; flex-direction: column; }
  .closing h2 { font-size: clamp(4.2rem, 12vw, 6.5rem); }
  .closing-aside { max-width: 390px; }
}
@media (max-width: 560px) {
  .announcement { font-size: .52rem; gap: .7rem; min-height: 27px; }
  .announcement > span:first-child { display: none; }
  .header-inner { min-height: 67px; }
  .brand { width: clamp(151px, 38vw, 188px); }
  .header-book { min-height: 44px; gap: .55rem; }
  .hero { padding-block: 2.25rem .75rem; gap: 1.35rem; }
  .eyebrow { margin-bottom: 1.15rem; }
  h1 { font-size: clamp(3.75rem, 18vw, 7rem); }
  .hero-actions { gap: .8rem 1.2rem; }
  .hero-actions .button { min-height: 48px; font-size: .77rem; min-width: 0; }
  .text-link { font-size: .72rem; }
  .hero-image-wrap img { aspect-ratio: 1.72; }
  .hero-visual figcaption { gap: .4rem; }
  .section-transition { padding-block: .55rem 1.15rem; gap: .6rem; }
  .links-section { padding-block: .65rem 5rem; }
  .section-header h2 { font-size: clamp(2.9rem, 12vw, 4.7rem); }
  .group-heading { margin-top: 2.5rem; gap: .75rem; }
  .group-heading > :last-child { max-width: 125px; }
  .cards-grid { grid-template-columns: 1fr; }
  .link-card { min-height: 207px; padding: 1.3rem 1.3rem; gap: 2.25rem; }
  .card-bottom h3 { font-size: 2.55rem; }
  .card-bottom p { font-size: .9rem; }
  .closing { padding-block: 4.6rem; }
  .closing h2 { font-size: clamp(3.45rem, 14.25vw, 6rem); }
  .footer-top { padding-block: 2.5rem; }
  .footer-brand { width: min(59vw, 240px); }
  .footer-bottom { flex-direction: column; gap: .4rem; padding-block: 1.4rem 1.8rem; }
}
@media (max-width: 375px) {
  .container { width: calc(100% - 1.6rem); }
  .header-book { font-size: .7rem; padding-inline: .7rem; }
  .header-actions { gap: .4rem; }
  .brand { width: clamp(7rem, 39vw, 9.25rem); }
  .hero-actions { align-items: start; flex-direction: column; }
  .card-bottom h3 { font-size: 2.32rem; }
}
@media (prefers-reduced-motion: no-preference) {
  @keyframes editorial-hero-enter {
    from { opacity: var(--intro-opacity); translate: 0 var(--intro-offset); scale: var(--intro-scale, 1); }
    to { opacity: 1; translate: 0 0; scale: 1; }
  }
  @keyframes editorial-reveal {
    from { opacity: .58; translate: 0 18px; }
    to { opacity: 1; translate: 0 0; }
  }
  .hero-ready [data-hero-intro] { animation: editorial-hero-enter var(--intro-duration, 680ms) var(--editorial-ease) var(--intro-delay, 0ms) var(--intro-fill, backwards); }
  .hero-copy > .eyebrow { --intro-offset: 16px; --intro-opacity: .52; }
  .hero-copy h1 { --intro-delay: 100ms; --intro-duration: 820ms; --intro-offset: 24px; --intro-opacity: .48; }
  .hero-description { --intro-delay: 190ms; --intro-duration: 740ms; --intro-offset: 16px; --intro-opacity: .5; }
  .hero-controls { --intro-delay: 290ms; --intro-duration: 700ms; --intro-offset: 14px; --intro-opacity: .9; --intro-fill: none; }
  .hero-visual { --intro-delay: 270ms; --intro-duration: 900ms; --intro-offset: 20px; --intro-opacity: .53; --intro-scale: .985; }
  [data-reveal][data-visibility="visible"] { animation: editorial-reveal 640ms var(--editorial-ease) var(--reveal-delay, 0ms); }
  .cards-grid > .link-card + .link-card { --reveal-delay: 90ms; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .link-card:hover:not(:active) { transform: translateY(-5px); box-shadow: 0 13px 29px var(--shadow); }
  .link-card:hover::before { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .button:hover, .theme-switch:hover, .link-card:active, .button:is(:hover, :focus-visible) .button-arrow, .link-card:is(:hover, :focus-visible) .card-arrow { transform: none; }
}
