:root {
  --navy: #10243d;
  --navy-soft: #173b4a;
  --coral: #ee6455;
  --coral-dark: #c9483d;
  --mint: #58dfb7;
  --paper: #fffdf9;
  --cream: #f7f3ec;
  --ink: #25364b;
  --muted: #667386;
  --line: rgba(16, 36, 61, .15);
  --gold: #f2c66d;
  --danger: #a8362e;
  --shadow: 0 18px 48px rgba(16, 36, 61, .11);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }

.form-header {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  margin: 18px auto 0;
  padding: 13px 16px 13px 22px;
  background: rgba(255, 253, 249, .97);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(16, 36, 61, .09);
}

.form-brand { color: var(--navy); font-size: 1.18rem; font-weight: 780; letter-spacing: -.025em; text-decoration: none; }
.form-brand strong { color: var(--coral-dark); }
.form-header-actions { display: flex; align-items: center; gap: 18px; }
.form-header-actions > a { color: #596779; font-size: .85rem; font-weight: 800; text-decoration: none; }
.form-header-actions > a:hover, .form-header-actions > a:focus-visible { color: var(--coral-dark); }

.publication-language-selector { display: grid; grid-template-columns: repeat(10, auto); justify-content: center; gap: 7px; width: min(1060px, calc(100% - 40px)); margin: 10px auto 0; }
.publication-language-selector a { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 5px 7px; color: #596779; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; font-size: .7rem; font-weight: 850; text-decoration: none; }
.publication-language-selector a[aria-current="page"] { color: #fff; background: var(--navy); }
.publication-language-selector img { display: block; object-fit: cover; }
[dir="rtl"] .character-count { justify-self: start; }
[dir="rtl"] .photo-cover, [dir="rtl"] .review-photo:first-child::after { right: 9px; left: auto; }

.form-shell { width: min(1060px, calc(100% - 40px)); min-height: 60vh; margin: 24px auto 80px; }
.form-loading { display: grid; justify-items: center; gap: 14px; padding: 90px 20px; color: var(--muted); text-align: center; }
.loading-dot { width: 22px; height: 22px; background: var(--coral); border-radius: 50%; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .35; transform: scale(.72); } }

.form-intro { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(230px, .6fr); gap: 28px; padding: clamp(34px, 6vw, 64px); color: #fff; background: linear-gradient(135deg, var(--navy), #16443f); border-radius: 28px; box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 10px; color: #8ff0d1; font-size: .73rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.form-intro h1, .review-heading h1 { margin: 0; color: inherit; font-size: clamp(2.35rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.055em; text-wrap: balance; }
.form-intro > div > p:last-child { max-width: 690px; margin: 20px 0 0; color: rgba(255,255,255,.82); line-height: 1.65; }
.form-intro aside { display: grid; align-content: center; gap: 8px; padding: 24px; color: var(--navy); background: var(--paper); border-radius: 20px; }
.form-intro aside strong { font-size: 1.05rem; }
.form-intro aside span { color: var(--muted); font-size: .9rem; line-height: 1.5; }

.form-progress { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; margin: 20px 0; background: #e6e3dc; border: 1px solid var(--line); border-radius: 15px; }
.form-progress span { padding: 14px 16px; color: #687487; font-size: .82rem; font-weight: 850; text-align: center; }
.form-progress span[aria-current="step"] { color: #fff; background: var(--navy); }

[data-publication-form] { display: grid; gap: 18px; }
.form-card, .review-card { scroll-margin-top: 24px; padding: clamp(25px, 4vw, 42px); background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 30px rgba(16,36,61,.06); }
.section-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 17px; align-items: start; margin-bottom: 28px; }
.section-heading > span { display: grid; width: 45px; height: 45px; place-items: center; color: var(--navy); background: #dff7ee; border-radius: 50%; font-size: .78rem; font-weight: 950; }
.section-heading h2, .review-card h2 { margin: 0; color: var(--navy); font-size: clamp(1.45rem, 3vw, 2rem); letter-spacing: -.035em; }
.section-heading p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field-grid > label, .full-label { display: grid; align-content: start; gap: 8px; color: var(--navy); font-size: .9rem; font-weight: 820; }
.span-2 { grid-column: 1 / -1; }
input, select, textarea { width: 100%; min-height: 48px; padding: 11px 13px; color: var(--ink); background: #fff; border: 1px solid #bfc6cf; border-radius: 10px; outline: none; }
textarea { min-height: 170px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px rgba(238,100,85,.16); }
input[readonly] { color: #596779; background: #f1f0ec; }
input:invalid:not(:placeholder-shown), textarea:invalid:not(:placeholder-shown) { border-color: #bf554b; }

fieldset { min-width: 0; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 7px; color: var(--navy); font-size: .9rem; font-weight: 850; }
.choice { display: flex; align-items: flex-start; gap: 9px; color: #425167; font-size: .9rem; font-weight: 620; line-height: 1.45; }
.choice + .choice { margin-top: 10px; }
.choice input { flex: 0 0 auto; width: 18px; min-height: 18px; margin: 1px 0 0; accent-color: var(--coral); }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; }
.check-grid .choice + .choice { margin-top: 0; }
.full-label + .full-label { margin-top: 22px; }
.character-count { justify-self: end; color: var(--muted); font-size: .78rem; font-weight: 700; }
.field-guidance { color: var(--muted); font-size: .82rem; font-weight: 650; }
.field-validation { min-height: 1.25em; color: #a8362e; font-size: .82rem; font-weight: 800; }
.field-validation:empty { display: none; }
.form-policy { margin: 16px 0 0; padding: 13px 15px; color: #6d5a27; background: #fff7db; border-radius: 10px; font-size: .84rem; line-height: 1.5; }

.photo-uploader { display: grid; justify-items: center; gap: 9px; padding: 42px 22px; background: #f7faf9; border: 2px dashed #9eb4b0; border-radius: 18px; text-align: center; transition: .18s ease; }
.photo-uploader.is-dragging { background: #e6f9f2; border-color: #299d7e; transform: translateY(-2px); }
.photo-uploader strong { color: var(--navy); font-size: 1.1rem; }
.photo-uploader span { color: var(--muted); font-size: .85rem; }
.photo-uploader button { min-height: 44px; margin-top: 7px; padding: 9px 18px; color: #fff; background: var(--coral); border: 0; border-radius: 10px; font-weight: 850; }
.photo-status { margin: 15px 0 0; color: var(--muted); font-size: .84rem; font-weight: 750; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.photo-card { position: relative; overflow: hidden; background: #f0eee9; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 9px 20px rgba(16,36,61,.08); }
.photo-card[draggable="true"] { cursor: grab; }
.photo-card.is-dragging { opacity: .45; }
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-cover { position: absolute; top: 9px; left: 9px; padding: 5px 8px; color: var(--navy); background: var(--gold); border-radius: 7px; font-size: .69rem; font-weight: 900; }
.photo-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 8px; }
.photo-controls button { min-height: 34px; padding: 5px; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 7px; font-size: .74rem; font-weight: 820; }
.photo-controls button:hover, .photo-controls button:focus-visible { color: #fff; background: var(--navy); }
.field-error { margin: 12px 0 0; color: var(--danger); font-weight: 780; }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 6px; }
.form-actions p { margin: 0; color: var(--muted); font-size: .88rem; }
.primary-button { min-height: 52px; padding: 13px 24px; color: #fff; background: var(--coral); border: 0; border-radius: 11px; box-shadow: 0 12px 24px rgba(201,72,61,.22); font-weight: 900; }
.primary-button:hover, .primary-button:focus-visible { background: var(--coral-dark); outline: 3px solid rgba(238,100,85,.18); outline-offset: 3px; }

.review-view { display: grid; gap: 18px; }
.review-heading { padding: clamp(34px,6vw,64px); color: #fff; background: linear-gradient(135deg,var(--navy),#16443f); border-radius: 28px; box-shadow: var(--shadow); }
.review-heading > p:last-child { margin: 18px 0 0; color: rgba(255,255,255,.82); line-height: 1.55; }
[data-review-sections] { display: grid; gap: 18px; }
.review-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.review-card-heading button { min-height: 38px; padding: 7px 14px; color: var(--coral-dark); background: #fff1ed; border: 1px solid #ffd2c9; border-radius: 9px; font-weight: 850; }
.review-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 26px; margin: 0; }
.review-list div { min-width: 0; padding-bottom: 12px; border-bottom: 1px solid #ece9e3; }
.review-list dt { color: var(--muted); font-size: .76rem; font-weight: 850; text-transform: uppercase; }
.review-list dd { margin: 6px 0 0; overflow-wrap: anywhere; color: var(--navy); font-weight: 720; line-height: 1.5; white-space: pre-wrap; }
.review-photos { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.review-photo { position: relative; overflow: hidden; border-radius: 12px; }
.review-photo img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.review-photo:first-child::after { position: absolute; top: 8px; left: 8px; padding: 5px 8px; color: var(--navy); background: var(--gold); border-radius: 6px; content: "Portada"; font-size: .68rem; font-weight: 900; }
.validation-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px 30px; color: #fff; background: var(--navy); border-radius: 18px; }
.validation-panel strong { font-size: 1.06rem; }
.validation-panel p { margin: 6px 0 0; color: rgba(255,255,255,.72); font-size: .88rem; }
.validation-panel button { min-width: 130px; min-height: 48px; color: #7a7f87; background: #dedede; border: 0; border-radius: 10px; font-weight: 900; }
.validation-note { margin: -8px 6px 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.code-panel, .submission-success { margin-top: 18px; padding: 28px 30px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 36px rgba(14,52,66,.08); }
.code-panel h2, .submission-success h2 { margin: 0 0 8px; color: var(--navy); }
.code-panel form { display: flex; align-items: end; gap: 14px; margin-top: 18px; }
.code-panel label { display: grid; flex: 1; gap: 7px; color: var(--navy); font-size: .84rem; font-weight: 800; }
.code-panel input { min-height: 52px; padding: 10px 14px; border: 1px solid #a9b4bc; border-radius: 9px; font-size: 1.35rem; font-weight: 900; letter-spacing: .34em; }
.submission-success { color: var(--navy); background: #e9f8f1; border-color: #9dd6ba; }
.submission-success .primary-button { display: inline-flex; width: auto; margin-top: 10px; text-decoration: none; }
.server-status { margin: 12px 0 0; color: var(--muted); font-size: .82rem; }

.form-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px 24px; padding: 30px 20px; color: #647184; background: var(--paper); border-top: 1px solid var(--line); font-size: .84rem; }
.form-footer p { margin: 0; }
.form-footer a { font-weight: 800; text-underline-offset: 3px; }

@media (max-width: 800px) {
  .form-intro { grid-template-columns: 1fr; }
  .form-progress { grid-template-columns: repeat(2,1fr); }
  .photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .review-photos { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 620px) {
  .publication-language-selector { grid-template-columns: repeat(5, auto); width: calc(100% - 24px); }
  .form-header { align-items: flex-start; width: calc(100% - 24px); padding: 13px; }
  .form-header-actions { align-items: flex-end; flex-direction: column-reverse; gap: 8px; }
  .form-header-actions > a { padding-right: 7px; }
  .form-shell { width: calc(100% - 24px); margin-top: 14px; }
  .form-intro, .review-heading { padding: 34px 24px; border-radius: 22px; }
  .form-intro h1, .review-heading h1 { font-size: clamp(2.35rem,12vw,3.8rem); }
  .form-progress span { padding: 12px 8px; font-size: .72rem; }
  .form-card, .review-card { padding: 24px 18px; border-radius: 18px; }
  .section-heading { grid-template-columns: 1fr; }
  .field-grid, .check-grid, .review-list { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .photo-grid, .review-photos { grid-template-columns: 1fr 1fr; gap: 9px; }
  .photo-controls { grid-template-columns: 1fr 1fr; }
  .form-actions, .validation-panel { align-items: stretch; flex-direction: column; }
  .code-panel form { align-items: stretch; flex-direction: column; }
  .primary-button, .validation-panel button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .loading-dot { animation: none; }
}
