/* =========================================================
   Professor Pablo — Base Styles (themeable + optimized)
   ========================================================= */

/* ---------- Core tokens (neutrals, layout scales) ---------- */
:root{
  /* Neutrals */
  --bg:#f9f9f9;
  --panel:#ffffff;
  --muted:#6b7280;
  --ink:#111111;
  --ink-2:#333333;
  --line:#E5E7EB;
  --brand:#1E2A38;             /* brand navy */

  /* Radii & shadows */
  --radius:18px;
  --shadow:0 4px 12px rgba(0,0,0,.08);

  /* Layout containers */
  --container-max:1100px;

  /* Gallery sizing */
  --gallery-col:33%;            /* gallery column width ratio (desktop) */
  --gallery-max:460px;          /* hard cap for gallery column */
  --main-width: clamp(280px, 36vw, 420px); /* main image viewport width */
  --thumb-size:56px;
  --gap:10px;
  --gallery-radius:12px;
  --gallery-shadow:0 6px 20px rgba(0,0,0,.15);
}

/* ---------- Fixed color palette (one-time) ---------- */
:root{
  /* Reds */
  --red-300:#D88A8A;
  --red-500:#B34747;            /* softened tie red */
  --red-700:#8B1A1A;
  --red-bright:#DD0000;

  /* Blues */
  --blue-500:#2563eb;

  /* Messaging tints */
  --imessage-blue:#0A84FF;
  --sms-green:#34C759;
  --bubble-gray:#E5E5EA;
}

/* ---------- Semantic theme tokens (used by components) ---------- */
/* Default theme (blue) */
:root{
  --accent-thumb: var(--blue-500);
  --accent: var(--blue-500);
}

/* Red theme override (set data-theme="red" on html or body) */
[data-theme="red"]{
  --accent-thumb: var(--red-500);
/* =========================================================
  --accent: var(--red-500);
}

   Base elements
   ========================================================= */
html,body{height:100%}
body{
  margin:0;
  font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,Inter,Helvetica,Arial,sans-serif;
  background:var(--bg);
  color:var(--ink);
}
.container{max-width:var(--container-max);margin:auto;padding:0 20px}
h1,h2,h3{color:var(--brand)}
h2{margin:0 0 18px;font-size:clamp(22px,2.4vw,28px)}
p{color:var(--ink-2)}

/* Base button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0.5rem 1.1rem;
  border-radius: 999px;

  border: 1px solid transparent;
  background: transparent;
  color: inherit;

  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;

  cursor: pointer;
  text-decoration: none;
  margin-left:1rem;

  transition:
    background-color 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.08s ease;
}

/* Primary (red) button */
.btn.primary {
  background: var(--red-bright);
  border-color: var(--red-bright);
  color: #fff;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* Hover/active/focus states */
.btn.primary:hover {
  background: var(--red-700);
  border-color: var(--red-700);
  transform: translateY(-1px);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.3);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px #000,
    0 0 0 4px rgba(255, 255, 255, 0.8);
}

/* Disabled state */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* Newsletter-specific adjustments */
.newsletter-submit {
  padding-block: 0.7rem;
  padding-inline: 1.6rem;
  font-size: 0.95rem;
}

#newsletter .btn.primary {
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

section{padding:20px}


.pablo-tie {
  height: 6px;
  background: var(--red-bright);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* =========================================================
   Header (unchanged, tidy)
   ========================================================= */
header{position:sticky;top:0;z-index:50;background:#111;}
.nav{display:flex;align-items:center;justify-content:space-between;padding-top:12px;padding-bottom:12px;}
.brand{display:flex;align-items:center;gap:12px}
.brand h1{font-size:26px;color:#F1F1F1;margin:0;letter-spacing:.2px}
.brand small{display:block;color:#A7A7A7;margin-top:2px}

/* =========================================================
   Conversation mock (kept for your page sections)
   ========================================================= */
/* Base: mobile-first */
.container.chat {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

#hero
{
	padding-bottom:0;
}

#conversation
{
	padding-top:0;
}

/* Desktop: when screens are wide enough */
@media (min-width: 1200px) {
  .container.chat {
    max-width: 40%;
  }
}

.chat-wrapper{display:flex;gap:30px;align-items:stretch}
@media(max-width:880px){.chat-wrapper{flex-direction:column}}

.iphone{width:min(640px,60%)}
@media(max-width:880px){.iphone{width:100%}}

.bezel{background:#0b0b0b;border:1px solid #2B2B2B;border-radius:36px;padding:14px;box-shadow:0 12px 32px rgba(0,0,0,.45)}
.screen{background:#F3F3F3;border-radius:28px;min-height:300px;padding:10px;display:flex;flex-direction:column}
.status{position:relative;color:#111;font-size:14px;text-align:center;padding:6px 0}
.notch{position:absolute;top:-14px;left:50%;transform:translateX(-50%);width:120px;height:20px;background:#0b0b0b;border:1px solid #2B2B2B;border-top:none;border-radius:0 0 14px 14px}

.thread{display:flex;flex-direction:column;gap:8px;padding:6px}
.row{display:flex}
.left{justify-content:flex-start}
.right{justify-content:flex-end}
.bubble{
  max-width:75%;
  padding:10px 12px;
  border-radius:18px;
  font-size:16px;line-height:1.45;
  word-wrap:break-word;
  box-shadow:0 2px 6px rgba(0,0,0,.06);
}
.bubble.reader{ background:#DDD;color:#000;border-top-left-radius:6px; }
.bubble.pablo{ background:var(--imessage-blue);color:#fff;border-top-right-radius:6px; }
/* Optional green mode: add data-bubble="green" on .screen */
[data-bubble="green"] .bubble.pablo{ background:var(--sms-green); }

/* Pablo side image */
.pablo-side{flex:1;display:flex}
.pablo-frame{
  overflow:hidden;
  display:flex;align-items:center;justify-content:center;width:100%;
}
.pablo-frame img{height:auto;width:100%;object-fit:contain}

/* =========================================================
   Books (two-column on desktop, stacked on mobile)
   ========================================================= */
.books{ max-width:1000px;margin:0 auto 3rem auto;display:grid;gap:2rem;scroll-margin-top: 80px; }
.book-header
{
	margin-bottom:0;
}
.book{
  background:#fff;border:1px solid var(--line);
  border-radius:12px;padding:1.25rem;
  box-shadow:0 3px 10px rgba(0,0,0,.07);

  /* Two-column grid: [gallery | details] */
  display:grid;
  grid-template-columns:
    minmax(260px, var(--gallery-col))
    minmax(280px, calc(100% - var(--gallery-col)));
  column-gap:2rem;
  align-items:start;
}

/* Title + teaser span full width above columns */

.book .book-title
{
	margin-bottom:0.5rem;
	grid-column: 1 / -1;
}

.book > p:first-of-type{
  grid-column:1 / -1;
  margin-bottom:.5rem;
}

.book .book-summary
{
	margin-top:0rem;
	margin-bottom:1rem;
}

/* Left column: gallery */
.book .gallery{
  grid-column:1 / 2;
  width:auto;
  max-width:var(--gallery-max);
  min-width:0;                     /* critical for shrinking inside grid */
  justify-self:start;
}

/* Right column: description */
.book .book-details{
  grid-column:2 / 3;
  font-size:1rem;
  line-height:1.6;
  min-width:0;
}
.book .book-details ul{
  list-style:disc;
  margin:1em 0 1em 1.5em;
  padding:0;
}
.book .book-details ul li
{
	margin-bottom:0.4rem;
}
.book .book-details p{ margin:.5em 0; }
.amazon-link img{ height:40px; margin-top:.5em; }

/* =========================================================
   Gallery core
   ========================================================= */
.gallery{ user-select:none; }
.gallery-main{ position:relative; }

/* Viewport fits its column, width controlled by --main-width cap */
.gallery-viewport{
  position:relative;
  width:100%;
  max-width: var(--main-width);
  margin:0 auto;
  border-radius: var(--gallery-radius);
  overflow:hidden;
  box-shadow: var(--gallery-shadow);
  background:#f6f7f8;
  touch-action: pan-y;
  cursor: zoom-in; /* click to open lightbox */
}
.gallery-rail{
  display:flex;
  transition: transform 280ms ease;
  will-change: transform;
}
.gallery-rail img{
  flex:0 0 100%;
  width:100%;
  height:auto;
  object-fit:contain;
  background:#fff;
}

/* arrows over main image */
.gallery-arrow{
  position:absolute;top:50%;transform:translateY(-50%);
  width:36px;height:36px;border:none;border-radius:999px;
  background:rgba(0,0,0,.55);color:#fff;display:grid;place-items:center;cursor:pointer;z-index:2;
}
.gallery-arrow:hover{ background: rgba(0,0,0,.7); }
.gallery-arrow:active{ transform: translateY(-50%) scale(.98); }
.arrow-left{ left: 8px; }
.arrow-right{ right: 8px; }
.gallery-arrow svg{ width: 18px; height: 18px; }

/* thumbs */
.gallery-thumbs{ margin-top: var(--gap); display:grid; grid-template-columns:1fr; }
.thumbs-track{
  display:flex; gap:8px; overflow:hidden; padding:2px; border-radius:10px;
  background:#f3f4f6; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); cursor:grab;
}
.thumbs-track:active{ cursor:grabbing; }
.thumb{
  flex:0 0 auto; width:var(--thumb-size); height:var(--thumb-size);
  border-radius:8px; overflow:hidden; position:relative;
  box-shadow:0 1px 4px rgba(0,0,0,.08); background:#fff;
  border:2px solid transparent;   /* so selection border doesn't shift layout */
}
.thumb img{ width:100%; height:100%; object-fit:cover; }

/* Active thumbnail highlight (theme-aware) */
.thumb[aria-current="true"]{
  border:3px solid var(--accent-thumb);   /* themed red/blue */
}

/* helper text */
.hint{ margin-top:6px; font-size:12px; color:#6b7280; text-align:center; }

/* =========================================================
   Lightbox
   ========================================================= */
.lightbox{
  position:fixed; inset:0;
  display:none; align-items:center; justify-content:center;
  background: rgba(0,0,0,.8);
  z-index:9999;
  cursor: zoom-out; /* backdrop */
}
.lightbox[open]{ display:flex; }

.lightbox-inner{
  position:relative;
  width:min(96vw, 1200px);
  height:88vh;
  border-radius:14px;
  overflow:hidden;              /* clip image & scrims to box */
  background:#000;
  box-shadow:0 16px 64px rgba(0,0,0,.55);
  touch-action: pan-y;
  cursor: default;              /* content */
}

/* Fit image perfectly (no overflow) */
.lightbox-inner .gallery-viewport{ position:absolute; inset:0; width:auto; height:auto; }
.lightbox-inner .gallery-rail{
  display:flex; height:100%;
  transition: transform 280ms ease;
  will-change: transform;
}
.lightbox-inner .gallery-rail img{
  flex:0 0 100%;
  width:100%; height:100%;
  object-fit:contain;
  max-width:100%; max-height:100%;
  background:#000;
}

/* Edge scrims to separate arrows from image (desktop only) */
@media (min-width:900px){
  .lightbox-inner::before,
  .lightbox-inner::after{
    content:"";
    position:absolute; top:0; bottom:0; width:72px; pointer-events:none;
  }
  .lightbox-inner::before{ left:0; background:linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,0)); }
  .lightbox-inner::after{ right:0; background:linear-gradient(270deg, rgba(0,0,0,.55), rgba(0,0,0,0)); }
}

/* Lightbox arrows */
.lightbox .gallery-arrow{
  position:absolute;
  top:50%; transform:translateY(-50%);
  width:48px; height:48px;
  border:none; border-radius:999px;
  display:grid; place-items:center;
  cursor:pointer; z-index:3;
  box-shadow:0 4px 18px rgba(0,0,0,.35);
}

/* Mobile: overlay on the image edges */
@media (max-width:899px){
  .lightbox .gallery-arrow{ background: rgba(0,0,0,.55); color:#fff; }
  .lightbox .arrow-left{ left:10px; }
  .lightbox .arrow-right{ right:10px; }
  .lightbox .gallery-arrow:hover{ background: rgba(0,0,0,.7); }
}

/* Desktop: bright buttons */
@media (min-width:900px){
  .lightbox .gallery-arrow{ background:#ffffff; color:#111; }
  .lightbox .arrow-left{ left:14px; }
  .lightbox .arrow-right{ right:14px; }
  .lightbox .gallery-arrow:hover{ filter: brightness(0.92); }
}
.lightbox .gallery-arrow svg{ width:22px; height:22px; }

/* Close button */
.lightbox-close{
  position:absolute; top:12px; right:12px;
  width:44px; height:44px;
  display:grid; place-items:center;
  border:2px solid rgba(255,255,255,.9);
  border-radius:12px;
  background: rgba(0,0,0,.8);
  color:#fff; cursor:pointer; z-index:4;
  box-shadow: 0 6px 22px rgba(0,0,0,.5);
}
.lightbox-close:hover{ background: rgba(0,0,0,.9); }

#newsletter
{
	background:#111;
	color:#fff;
}

#newsletter .title
{
	color:var(--red-bright);
}

.newsletter-message {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  min-height: 1.2em; /* reserve a little space so layout doesn't jump */
}

.newsletter-message.is-success {
  color: #bbf7d0; /* soft green */
}

.newsletter-message.is-error {
  color: #fecaca; /* soft red */
}

/* Newsletter section */
#newsletter {
  background: #111;
  color: #fff;
  padding: 3rem 0;
}

#newsletter h2 {
  font-size: clamp(1.6rem, 2vw + 0.5rem, 2.2rem);
  margin-bottom: 0.5rem;
  color: #fdf2f2; /* soft, readable “warm white” */
}

#newsletter .newsletter-lead {
  margin: 0 0 1.5rem;
  color: #d1d5db;
}

/* Layout for form */
.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Input styling */
.newsletter-input {
  flex: 1 1 240px;
  min-width: 0;
  max-width: 320px; 
  padding: 0.65rem 0.85rem;
  border-radius: 999px;
  border: 1px solid #2b2b2b;
  background: #0f0f0f;
  color: #fff;
  font-size: 0.95rem;
}

.newsletter-input::placeholder {
  color: #6b7280;
}

.newsletter-input:focus {
  outline: none;
  border-color: var(--red-500);
  box-shadow: 0 0 0 2px rgba(179, 71, 71, 0.45);
}

/* Button */
.newsletter-submit {
  padding-inline: 1.4rem;
  padding-block: 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* Honeypot – hide from humans but keep accessible-ish to bots */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Screen-reader-only helper class if you want it elsewhere too */
.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;
}

/* =========================================================
   Responsive stacking
   ========================================================= */
@media (max-width:900px){
  .book{
    grid-template-columns:1fr;  /* stack */
    gap:1.25rem;
  }
  .book .gallery,
  .book .book-details{
    grid-column:1 / -1;
    max-width:100%;
  }
  header nav {
    display: flex;
    min-width:9rem;
    flex-direction: column;   /* stack vertically */
    align-items: flex-end;    /* push them to the right */
    gap: 0.35rem;             /* small vertical space */
    margin-top: 0.75rem;      /* optional breathing room */
  }

  header nav .btn {
    width: auto;              /* keep the buttons natural size */
  }  
  #books
  {
  	scroll-margin-top:120px;
  }
}

/* Small screens: narrow main image cap */
@media (max-width:480px){
  :root{ --main-width: clamp(260px, 92vw, 360px); }
}
