:root {
    --ink: #123047;
    --ink-deep: #092132;
    --teal: #087f8c;
    --orange: #f27a24;
    --paper: #f4f7f6;
    --white: #ffffff;
    --muted: #526671;
    --line: #cbd8d9;
    --display: "Newsreader", Georgia, serif;
    --sans: "DM Sans", Arial, sans-serif;
    --page: min(1180px, calc(100% - 48px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}
body.menu-open { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
::selection { color: var(--white); background: var(--teal); }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: fixed; z-index: 100; top: 10px; left: 10px; padding: 10px 16px;
    color: var(--white); background: var(--ink); transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.reading-progress { position: fixed; z-index: 80; inset: 0 0 auto; height: 3px; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--orange); }

.site-header {
    position: absolute; z-index: 20; top: 0; left: 50%; display: flex;
    width: var(--page); min-height: 104px; align-items: center; justify-content: space-between;
    transform: translateX(-50%);
}
.brand img { width: 236px; height: auto; }
.main-nav { display: flex; align-items: center; gap: 34px; font-size: .92rem; font-weight: 600; }
.main-nav a { text-decoration: none; }
.main-nav a:not(.nav-contact):hover { color: var(--teal); }
.nav-contact { padding: 10px 18px; border: 1px solid var(--ink); border-radius: 99px; }
.nav-contact:hover { color: var(--white); background: var(--ink); }
.menu-button { display: none; }

.hero {
    position: relative; display: grid; min-height: 810px; padding: 150px max(24px, calc((100% - 1180px) / 2)) 72px;
    grid-template-columns: minmax(0, .94fr) minmax(440px, 1.06fr); align-items: center; overflow: hidden;
}
.hero::before {
    position: absolute; content: ""; width: 52vw; height: 52vw; min-width: 650px; min-height: 650px;
    right: -15vw; top: -18vw; border: 1px solid rgba(8,127,140,.16); border-radius: 50%;
    box-shadow: 0 0 0 70px rgba(8,127,140,.035), 0 0 0 140px rgba(8,127,140,.025);
}
.hero-copy { position: relative; z-index: 2; max-width: 640px; padding-right: 9%; }
.kicker { margin: 0 0 20px; color: var(--teal); font-size: .8rem; font-weight: 700; letter-spacing: .08em; }
.hero h1, .section-heading h2, .about h2, .contact h2, .book-dialog h2 {
    font-family: var(--display); font-weight: 600; line-height: .98; letter-spacing: -.035em;
    text-wrap: balance;
}
.hero h1 { max-width: 650px; margin: 0; font-size: clamp(3rem, 4.5vw, 4.6rem); line-height: 1.05; }
.hero-intro { max-width: 590px; margin: 34px 0 0; color: var(--muted); font-size: 1.12rem; }
.hero-actions { display: flex; margin-top: 38px; align-items: center; gap: 30px; }
.button { display: inline-flex; min-height: 48px; padding: 11px 22px; align-items: center; justify-content: center; border-radius: 99px; font-weight: 700; text-decoration: none; }
.button-primary { color: var(--white); background: var(--ink); box-shadow: 0 8px 26px rgba(18,48,71,.15); }
.button-primary:hover { background: var(--teal); }
.text-link { font-size: .93rem; font-weight: 700; text-underline-offset: 5px; }
.hero-visual { position: relative; z-index: 1; width: 100%; aspect-ratio: 4 / 4.7; overflow: hidden; border-radius: 48% 48% 12px 12px; }
.hero-visual::after { position: absolute; content: ""; inset: 0; background: linear-gradient(180deg, transparent 62%, rgba(9,33,50,.35)); }
.hero-visual img { width: 100%; height: 100%; object-fit: cover; object-position: 47% center; }
.hero-stamp {
    position: absolute; z-index: 2; right: 9%; bottom: 8%; display: grid; width: 74px; height: 74px;
    grid-template: 1fr 1fr / 1fr 1fr; color: var(--white); border: 2px solid rgba(255,255,255,.8); font-size: 1.6rem; line-height: 1;
}
.hero-stamp span { display: grid; place-items: center; }
.hero-stamp span:first-child { color: var(--ink-deep); background: var(--orange); }
.hero-stamp span:last-child { grid-column: 2; grid-row: 2; background: var(--teal); }
.hero-note {
    position: absolute; left: max(24px, calc((100% - 1180px) / 2)); bottom: 54px; display: flex;
    margin: 0; align-items: center; gap: 13px; color: var(--muted); font-size: .72rem; font-weight: 700;
}
.hero-note span { width: 4px; height: 4px; border-radius: 50%; background: var(--orange); }

.catalog { padding: 130px max(24px, calc((100% - 1180px) / 2)); color: var(--white); background: var(--ink-deep); }
.section-heading { display: grid; margin-bottom: 105px; grid-template-columns: 1.2fr .8fr; align-items: end; gap: 60px; }
.section-heading h2 { margin: 0; font-size: clamp(3.2rem, 5.4vw, 4.8rem); }
.section-heading p { max-width: 470px; margin: 0 0 10px; color: #b6c8cc; }
.book-list { display: grid; gap: 140px; }
.book { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); align-items: center; gap: clamp(55px, 9vw, 130px); }
.book:nth-child(even) { grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); }
.book:nth-child(even) .book-cover-wrap { order: 2; }
.book-cover-wrap { position: relative; justify-self: center; }
.book-cover { width: min(365px, 30vw); max-height: 535px; object-fit: cover; box-shadow: 26px 28px 0 rgba(255,255,255,.045), 0 30px 75px rgba(0,0,0,.3); }
.book-copy { max-width: 610px; }
.book-year { margin: 0 0 12px; color: #55c4c4; font-size: .82rem; font-weight: 700; }
.book h3 { margin: 0; font-family: var(--display); font-size: clamp(2.7rem, 4vw, 4.1rem); font-weight: 500; line-height: 1.02; letter-spacing: -.03em; text-wrap: balance; }
.book-subtitle { max-width: 560px; margin: 13px 0 24px; color: var(--orange); font-family: var(--display); font-size: clamp(1.5rem, 2.3vw, 2.1rem); line-height: 1.15; }
.book-author { margin: 0 0 20px; font-weight: 700; }
.book-summary { max-width: 600px; color: #c7d4d6; }
.book-meta { margin-top: 23px; color: #8fa7ac; font-size: .8rem; }
.book-more { margin-top: 18px; padding: 0 0 5px; color: var(--white); background: none; border: 0; border-bottom: 1px solid var(--orange); cursor: pointer; font-size: .9rem; font-weight: 700; }
.book-more:hover { color: #68d1d0; }

.about { display: grid; width: var(--page); padding: 140px 0; margin: auto; grid-template-columns: 1fr 1fr; gap: 10vw; }
.about-title-wrap { position: relative; }
.about-title-wrap::before { position: absolute; content: ""; width: 56px; height: 8px; top: -34px; background: linear-gradient(90deg, var(--orange) 50%, var(--teal) 50%); }
.about h2 { margin: 0; font-size: clamp(2.4rem, 3.3vw, 3.4rem); line-height: 1.08; }
.about-copy { padding-top: 53px; color: var(--muted); font-size: 1.05rem; }
.about-copy > p:first-child { color: var(--ink); font-size: 1.25rem; }

.contact { display: grid; padding: 105px max(24px, calc((100% - 1180px) / 2)); color: var(--white); background: var(--teal); grid-template-columns: 1.1fr .9fr; align-items: end; gap: 80px; }
.contact .kicker { color: #b6f2ed; }
.contact h2 { max-width: 660px; margin: 0; font-size: clamp(2.8rem, 4vw, 4.5rem); line-height: 1.05; }
.contact-action { padding-bottom: 8px; }
.contact-action > p:first-child { max-width: 470px; color: #d4eeee; }
.contact-action > a { display: inline-block; margin: 22px 0; font-family: var(--display); font-size: clamp(1.45rem, 2.5vw, 2.25rem); text-decoration-thickness: 1px; text-underline-offset: 7px; }
.location { font-size: .8rem; font-weight: 700; }

.site-footer { display: grid; width: var(--page); min-height: 155px; margin: auto; grid-template-columns: 1fr auto auto; align-items: center; gap: 44px; color: var(--muted); font-size: .76rem; }
.site-footer img { width: 180px; height: auto; }
.site-footer a { color: var(--ink); font-weight: 700; text-underline-offset: 3px; }

.book-dialog { width: min(920px, calc(100% - 32px)); max-height: calc(100vh - 36px); padding: 0; overflow: auto; overscroll-behavior: contain; color: var(--ink); background: var(--paper); border: 0; border-radius: 8px; box-shadow: 0 30px 100px rgba(0,0,0,.35); }
.book-dialog::backdrop { background: rgba(5,22,33,.82); backdrop-filter: blur(8px); }
.dialog-grid { display: grid; padding: 62px; grid-template-columns: 245px 1fr; gap: 55px; }
.dialog-grid > img { width: 245px; max-height: 390px; object-fit: cover; box-shadow: 12px 14px 0 #dbe5e4; }
.book-dialog h2 { margin: 0; font-size: 3.2rem; }
.dialog-subtitle { margin: 5px 0 24px; color: var(--teal); font-family: var(--display); font-size: 1.5rem; line-height: 1.15; }
.dialog-isbn { color: var(--muted); font-size: .8rem; }
.book-dialog .button { margin-top: 14px; }
.dialog-close { position: absolute; z-index: 2; top: 13px; right: 18px; padding: 0; color: var(--ink); background: none; border: 0; cursor: pointer; font-size: 2rem; line-height: 1; }

@keyframes reveal { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.hero-copy > * { animation: reveal .7s both; }
.hero-copy > :nth-child(2) { animation-delay: .08s; }
.hero-copy > :nth-child(3) { animation-delay: .16s; }
.hero-copy > :nth-child(4) { animation-delay: .24s; }
.hero-visual { animation: reveal .9s .12s both; }

@media (max-width: 880px) {
    :root { --page: min(calc(100% - 32px), 680px); }
    .site-header { min-height: 82px; }
    .brand img { width: 195px; }
    .menu-button { position: relative; z-index: 31; display: grid; width: 45px; height: 45px; padding: 12px 9px; place-content: center; gap: 7px; background: var(--paper); border: 1px solid var(--line); border-radius: 50%; }
    .menu-button span:not(.sr-only) { display: block; width: 21px; height: 2px; background: var(--ink); transition: transform .2s; }
    .menu-button[aria-expanded="true"] span:first-child { transform: translateY(4.5px) rotate(45deg); }
    .menu-button[aria-expanded="true"] span:nth-child(2) { transform: translateY(-4.5px) rotate(-45deg); }
    .main-nav { position: fixed; z-index: 30; inset: 0; display: none; padding: 120px 30px 40px; flex-direction: column; justify-content: center; color: var(--white); background: var(--ink-deep); font-family: var(--display); font-size: 2.3rem; }
    .main-nav.open { display: flex; }
    .nav-contact { padding: 0; border: 0; }
    .hero { min-height: auto; padding: 125px 16px 70px; grid-template-columns: 1fr; }
    .hero-copy { width: var(--page); padding: 0; margin: 0 auto 55px; }
    .hero h1 { font-size: clamp(2.8rem, 10.8vw, 4rem); }
    .hero-visual { width: var(--page); max-height: 650px; margin: auto; aspect-ratio: 4 / 4.6; }
    .hero-note { display: none; }
    .section-heading, .about, .contact { grid-template-columns: minmax(0, 1fr); }
    .about > *, .contact > * { min-width: 0; }
    .section-heading { margin-bottom: 90px; gap: 28px; }
    .book-list { gap: 115px; }
    .book, .book:nth-child(even) { grid-template-columns: minmax(180px, .72fr) 1.28fr; gap: 45px; }
    .book:nth-child(even) .book-cover-wrap { order: initial; }
    .book-cover { width: 100%; }
    .about { gap: 20px; }
    .about-copy { padding-top: 10px; }
    .contact { gap: 30px; }
    .site-footer { padding: 35px 0; grid-template-columns: 1fr 1fr; gap: 14px; }
    .site-footer img { grid-column: 1 / -1; margin-bottom: 12px; }
}

@media (max-width: 590px) {
    body { font-size: 16px; }
    .hero-actions { align-items: flex-start; flex-direction: column; gap: 20px; }
    .hero-visual { aspect-ratio: 4 / 5.2; border-radius: 46% 46% 8px 8px; }
    .catalog { padding-top: 95px; padding-bottom: 100px; }
    .section-heading h2 { font-size: 3.1rem; }
    .book, .book:nth-child(even) { grid-template-columns: 1fr; gap: 48px; }
    .book-cover-wrap { width: min(78%, 320px); }
    .book-copy { padding: 0 2px; }
    .book h3 { font-size: 2.7rem; }
    .about { padding: 105px 0; }
    .about h2 { font-size: 2.35rem; }
    .contact { padding-top: 85px; padding-bottom: 85px; }
    .contact h2 { font-size: 2.75rem; }
    .site-footer { grid-template-columns: 1fr; }
    .dialog-grid { padding: 56px 24px 34px; grid-template-columns: 1fr; gap: 35px; }
    .dialog-grid > img { width: min(65%, 230px); margin: auto; }
    .book-dialog h2 { font-size: 2.7rem; }
}

#publicaciones, #editorial, #contacto { scroll-margin-top: 24px; }
.error-page { display: grid; min-height: 100vh; padding: 32px; place-items: center; }
.error-card { width: min(680px, 100%); text-align: center; }
.error-card img { width: 230px; height: auto; margin: 0 auto 60px; }
.error-code { margin: 0 0 12px; color: var(--teal); font-weight: 700; }
.error-card h1 { margin: 0; font-family: var(--display); font-size: clamp(3rem, 8vw, 5.5rem); line-height: 1; text-wrap: balance; }
.error-card > p:not(.error-code) { max-width: 520px; margin: 28px auto; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
