:root {
  --ink: #17362d;
  --leaf: #1f7a52;
  --mint: #dff4df;
  --sun: #ffd54d;
  --coral: #f36c50;
  --sky: #a9e5e1;
  --paper: #fffdf7;
  --line: #17362d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Trebuchet MS", Arial, sans-serif; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.shell { min-height: 100vh; overflow: hidden; }
.notice { background: var(--ink); color: white; text-align: center; padding: 9px 16px; font-weight: 800; font-size: 13px; }
.nav { height: 78px; display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: auto; padding: 0 22px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 1000; color: var(--ink); text-decoration: none; font-size: 21px; }
.mark { width: 42px; height: 42px; background: var(--sun); border: 2px solid var(--ink); border-radius: 50% 50% 48% 18%; display: grid; place-items: center; transform: rotate(-8deg); box-shadow: 3px 3px 0 var(--ink); }
.mark b { transform: rotate(8deg); font-size: 22px; }
.navlinks { display: flex; gap: 24px; align-items: center; font-weight: 800; }
.navlinks a { color: var(--ink); text-decoration: none; }
.iconBtn { border: 2px solid var(--ink); background: white; width: 45px; height: 45px; border-radius: 50%; font-weight: 900; position: relative; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); }
.badge { position: absolute; top: -8px; right: -7px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--coral); font-size: 12px; border: 2px solid var(--ink); }

.hero { background: var(--mint); border-block: 2px solid var(--ink); position: relative; }
.heroInner { min-height: 600px; max-width: 1180px; padding: 64px 22px 54px; margin: auto; display: grid; grid-template-columns: 1.02fr .98fr; gap: 52px; align-items: center; }
.eyebrow { display: inline-flex; padding: 8px 12px; border: 2px solid var(--ink); background: var(--sun); font-weight: 900; transform: rotate(-2deg); }
h1 { font-family: Georgia, serif; font-size: clamp(52px, 7vw, 92px); line-height: .94; margin: 22px 0; letter-spacing: 0; max-width: 720px; }
.hero p { font-size: 20px; line-height: 1.55; max-width: 590px; }
.actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.btn { border: 2px solid var(--ink); background: var(--coral); color: white; padding: 14px 20px; font-weight: 900; cursor: pointer; text-decoration: none; box-shadow: 5px 5px 0 var(--ink); transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translate(2px,2px); box-shadow: 3px 3px 0 var(--ink); }
.btn.alt { background: white; color: var(--ink); }
.heroPhoto { aspect-ratio: 1/1; border: 2px solid var(--ink); background: url("/products.png") center/cover; box-shadow: 12px 12px 0 var(--coral); position: relative; border-radius: 4px; }
.photoTag { position: absolute; right: -16px; bottom: 24px; background: var(--sun); border: 2px solid var(--ink); padding: 12px 16px; font-weight: 1000; transform: rotate(-4deg); }

.band { background: var(--sun); border-bottom: 2px solid var(--ink); padding: 13px; display: flex; gap: 42px; justify-content: center; font-weight: 1000; overflow: hidden; white-space: nowrap; }
.section { max-width: 1180px; margin: auto; padding: 82px 22px; }
.sectionHead { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
h2 { font-family: Georgia, serif; font-size: clamp(38px, 5vw, 58px); margin: 0; letter-spacing: 0; }
.sectionHead p { max-width: 430px; line-height: 1.5; }
.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.product { border: 2px solid var(--ink); background: white; box-shadow: 6px 6px 0 var(--ink); overflow: hidden; }
.productImage { aspect-ratio: 4/3; background-image: url("/products.png"); background-size: 300% auto; border-bottom: 2px solid var(--ink); }
.productImage.basket { background-position: 0 70%; }
.productImage.earrings { background-position: 50% 70%; }
.productImage.axolotl { background-position: 100% 70%; }
.productImage.uploaded { background-position: center; background-size: cover; }
.productBody { padding: 19px; }
.pill { display: inline-block; padding: 5px 9px; background: var(--sky); border: 1.5px solid var(--ink); font-size: 12px; font-weight: 900; }
.product h3 { font-size: 22px; margin: 14px 0 7px; }
.product p { min-height: 48px; line-height: 1.45; }
.productFoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; }
.price { font-size: 22px; font-weight: 1000; }
.add { width: 42px; height: 42px; border: 2px solid var(--ink); background: var(--sun); font-size: 25px; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); }

.story { background: var(--sky); border-block: 2px solid var(--ink); }
.storyInner { max-width: 1180px; margin: auto; padding: 76px 22px; display: grid; grid-template-columns: .8fr 1.2fr; gap: 70px; align-items: center; }
.storyBadge { aspect-ratio: 1; border-radius: 50%; background: var(--leaf); border: 2px solid var(--ink); display: grid; place-items: center; color: white; text-align: center; padding: 48px; box-shadow: 12px 12px 0 var(--sun); }
.storyBadge strong { font: 700 42px/1.05 Georgia, serif; }
.story p { font-size: 18px; line-height: 1.7; }
.promise { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-top: 28px; }
.promise div { border-top: 2px solid var(--ink); padding-top: 12px; font-weight: 900; }

.footer { background: var(--ink); color: white; padding: 50px 22px; }
.footerInner { max-width: 1180px; margin: auto; display: flex; justify-content: space-between; gap: 30px; align-items: end; }
.footer a { color: var(--sun); }

.drawer { position: fixed; inset: 0; background: #17362d99; z-index: 20; display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.cart { width: min(440px,100%); height: 100%; background: var(--paper); padding: 24px; border-left: 2px solid var(--ink); overflow: auto; }
.cartTop { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--ink); padding-bottom: 18px; }
.close { border: 0; background: transparent; font-size: 30px; cursor: pointer; }
.cartLine { display: flex; justify-content: space-between; padding: 20px 0; border-bottom: 1px solid #9ab9af; gap: 12px; }
.total { display: flex; justify-content: space-between; font-size: 22px; font-weight: 1000; margin: 24px 0; }
.checkout { width: 100%; }
.small { font-size: 12px; line-height: 1.45; opacity: .75; margin-top: 14px; }

.studioShell { min-height: 100vh; background: var(--mint); padding: 28px max(18px, calc((100vw - 1180px) / 2)); }
.studioHeader { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 2px solid var(--ink); }
.studioHeader > form { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.studioHeader a { color: var(--ink); font-weight: 900; }
.studioIntro { display: grid; grid-template-columns: 1.2fr .8fr; align-items: end; gap: 40px; padding: 56px 0 36px; }
.studioIntro h1 { margin-bottom: 0; }
.studioIntro p { max-width: 500px; font-size: 19px; line-height: 1.55; }
.studioGrid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 28px; align-items: start; }
.studioSectionTitle { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.studioSectionTitle h2, .editorCard h2, .ordersCard h2 { font-size: clamp(30px, 4vw, 44px); }
.studioProducts { display: grid; gap: 12px; }
.studioProduct { background: white; border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); display: flex; align-items: stretch; }
.studioProduct.isHidden { opacity: .66; }
.studioProductMain { flex: 1; border: 0; background: transparent; display: grid; grid-template-columns: 1fr auto; gap: 5px 16px; text-align: left; padding: 16px; color: var(--ink); cursor: pointer; }
.studioProductMain span { font-weight: 900; }
.studioProductMain small { grid-column: 1 / -1; }
.dangerLink, .textButton { border: 0; background: transparent; padding: 12px; font-weight: 900; text-decoration: underline; cursor: pointer; color: #8d2c20; }
.textButton { color: var(--ink); }
.editorCard, .ordersCard, .studioNotice { background: white; border: 2px solid var(--ink); padding: 26px; box-shadow: 7px 7px 0 var(--coral); }
.editorCard label { display: block; font-weight: 900; margin-top: 16px; }
.editorCard input:not([type="checkbox"]), .editorCard textarea, .editorCard select { display: block; width: 100%; padding: 12px; border: 2px solid var(--ink); background: white; margin-top: 7px; border-radius: 0; }
.fieldRow { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkField { display: flex !important; align-items: center; gap: 10px; }
.checkField input { width: 20px; height: 20px; }
.editorPreview { display: block; width: min(100%, 360px); aspect-ratio: 4/3; object-fit: cover; border: 2px solid var(--ink); margin-top: 14px; }
.photoHint { padding: 12px; background: var(--mint); border-left: 4px solid var(--leaf); }
.editorActions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.studioMessage { font-weight: 900; }
.ordersCard { margin-top: 34px; box-shadow: 7px 7px 0 var(--sun); }
.ordersTable { border-top: 2px solid var(--ink); }
.orderRow { display: grid; grid-template-columns: 120px 100px 120px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid #9ab9af; align-items: center; }
.orderRow strong { text-transform: capitalize; }
.orderRow small { overflow-wrap: anywhere; }
.studioNotice { max-width: 620px; margin: 15vh auto; text-align: center; }
.studioNotice h1 { font-size: 58px; }

.successShell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--mint); }
.successCard { max-width: 650px; text-align: center; background: white; border: 2px solid var(--ink); padding: clamp(28px, 6vw, 58px); box-shadow: 10px 10px 0 var(--coral); }
.successCard .mark { margin: 0 auto 24px; }
.successCard h1 { font-size: clamp(44px, 7vw, 68px); }
.successCard p { font-size: 18px; line-height: 1.6; margin-bottom: 28px; }

.loginShell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--mint); }
.loginCard { width: min(520px, 100%); background: white; border: 2px solid var(--ink); padding: clamp(28px, 6vw, 48px); box-shadow: 9px 9px 0 var(--coral); }
.loginCard .brand { margin-bottom: 38px; }
.loginCard h1 { font-size: clamp(44px, 8vw, 64px); }
.loginCard p { line-height: 1.55; }
.loginCard label { display: block; margin-top: 18px; font-weight: 900; }
.loginCard input { display: block; width: 100%; padding: 13px; border: 2px solid var(--ink); margin-top: 7px; }
.loginCard .btn { margin-top: 24px; width: 100%; }
.formError { background: #ffe0da; border-left: 5px solid #8d2c20; padding: 12px; font-weight: 900; }
.studioProductMain { font: inherit; }
.studioProductMain:focus-visible, .add:focus-visible, .btn:focus-visible, .textButton:focus-visible, .iconBtn:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; }
.editorPreview { height: auto; }

@media (max-width: 820px) {
  .navlinks a { display: none; }
  .heroInner, .storyInner { grid-template-columns: 1fr; }
  .heroInner { padding-top: 45px; }
  .heroPhoto { order: -1; max-height: 420px; }
  .products { grid-template-columns: 1fr 1fr; }
  .sectionHead { align-items: start; flex-direction: column; }
  .studioIntro, .studioGrid { grid-template-columns: 1fr; }
  .orderRow { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .brand span:last-child { max-width: 150px; line-height: 1; }
  h1 { font-size: 51px; }
  .heroInner { gap: 30px; min-height: auto; }
  .products { grid-template-columns: 1fr; }
  .storyInner { gap: 36px; }
  .storyBadge strong { font-size: 34px; }
  .promise { grid-template-columns: 1fr; }
  .footerInner { align-items: start; flex-direction: column; }
  .band { justify-content: flex-start; }
  .studioHeader { align-items: flex-start; flex-direction: column; }
  .studioHeader > form { align-items: flex-start; flex-direction: column; }
  .studioIntro { padding-top: 36px; }
  .fieldRow { grid-template-columns: 1fr; }
  .orderRow { grid-template-columns: 1fr; }
}

/* ---- Historias · Stories ------------------------------------------------- */
.lang.en { display: none; }
main[data-lang="en"] .lang.es { display: none; }
main[data-lang="en"] .lang.en { display: revert; }

.langToggle { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.langToggle button { border: 0; background: transparent; padding: 6px 12px; font-weight: 700; cursor: pointer; color: var(--ink); }
.langToggle button.isActive { background: var(--ink); color: var(--paper); }

.storiesHero .heroInner { display: block; }
.storyGrid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.storyCard { display: flex; flex-direction: column; border: 2px solid var(--ink); border-radius: 18px; overflow: hidden; background: var(--paper); text-decoration: none; color: inherit; transition: transform .15s ease, box-shadow .15s ease; }
.storyCard:hover { transform: translateY(-4px); box-shadow: 0 14px 30px #17362d33; }
.storyCover { width: 100%; height: 200px; object-fit: cover; display: block; }
.storyCoverPlaceholder { display: grid; place-items: center; font-size: 44px; color: #ffffffcc; background: linear-gradient(135deg, #3f6b3a, #c07a4a); }
.storyCardBody { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.storyCardBody h3 { margin: 0; }
.storyCardBody small { color: #5b5b52; }
.emptyStories { grid-column: 1 / -1; text-align: center; color: #5b5b52; }

.storyArticle { max-width: 760px; margin: 0 auto; padding: 12px 4px 60px; display: flex; flex-direction: column; gap: 16px; }
.storyArticle h1 { margin: 0; }
.storyDate { color: #5b5b52; }
.storyArticle .storyCover { height: auto; max-height: 460px; border-radius: 18px; border: 2px solid var(--ink); }
.storyBody { font-size: 1.08rem; line-height: 1.7; }
.storyBody p { margin: 0 0 14px; }
.storyVideo { width: 100%; border-radius: 16px; border: 2px solid var(--ink); background: #000; }
.videoWrap { position: relative; width: 100%; padding-top: 56.25%; border-radius: 16px; overflow: hidden; border: 2px solid var(--ink); }
.videoWrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* studio stories manager */
.storiesAdminGrid { display: grid; gap: 24px; grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.4fr); align-items: start; }
@media (max-width: 820px) { .storiesAdminGrid { grid-template-columns: 1fr; } }

/* ---- Foto de producto: recorte uniforme sin importar el tamaño original --- */
img.productImage { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: center; display: block; background: #f2ede1; }
/* Vista previa en el editor: sin deformar */
.editorPreview { width: 100%; max-height: 260px; object-fit: cover; border: 2px solid var(--ink); display: block; }

/* ---- Recortador de foto (cropper) ---------------------------------------- */
.cropOverlay { position: fixed; inset: 0; background: #17362dcc; z-index: 60; display: grid; place-items: center; padding: 16px; }
.cropCard { background: var(--paper); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); padding: 18px; width: min(520px, 100%); }
.cropCard h3 { margin: 0 0 10px; font-family: Georgia, serif; }
.cropFrame { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border: 2px solid var(--ink); background: #000; touch-action: none; cursor: grab; }
.cropFrame.dragging { cursor: grabbing; }
.cropFrame img { position: absolute; top: 0; left: 0; max-width: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.cropHint { font-size: 12.5px; color: #5b5b52; margin: 8px 0 0; }
.cropTools { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.cropTools input[type="range"] { flex: 1; }
.cropActions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Portada editable (hero) --------------------------------------------- */
.heroPhoto { background: #f2ede1; overflow: hidden; }
.heroPhotoImg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.heroCard { margin-bottom: 8px; }
.heroEditRow { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.heroPreviewBox { width: 180px; aspect-ratio: 1 / 1; border: 2px solid var(--ink); overflow: hidden; box-shadow: 4px 4px 0 var(--ink); background: #f2ede1; flex: none; }
.heroPreviewBox img { width: 100%; height: 100%; object-fit: cover; display: block; }
.heroEditControls { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.heroEditControls label.btn { cursor: pointer; }
