.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 110;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--action);
  color: #1a1004;
  font-weight: 900;
  transform: translateY(-150%);
  transition: transform 180ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

.portal-body :where(a, button, input, textarea, select):focus-visible {
  outline: 3px solid var(--action);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.portal-body {
  min-height: 100vh;
  background: var(--black);
}

.portal-body .nav a[aria-current="page"] {
  color: var(--action);
}

.portal-simple-header {
  display: flex;
  justify-content: space-between;
}

.portal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.portal-top-link,
.portal-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.portal-logout {
  border-color: rgba(var(--action-rgb), 0.58);
  background: rgba(var(--action-rgb), 0.12);
  color: var(--action);
}

.portal-main {
  min-height: calc(100svh - 92px);
}

.portal-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-height: min(72svh, 720px);
  overflow: hidden;
  padding: 150px clamp(18px, 4vw, 64px) clamp(64px, 9vw, 112px);
  background: #080807;
}

.portal-hero::before,
.portal-hero::after {
  content: "";
  position: absolute;
  inset: 0;
}

.portal-hero::before {
  z-index: -2;
  background: url("assets/images/polarizado-nano-carbon.jpg") center 58% / cover no-repeat;
  filter: saturate(0.68) contrast(1.12);
}

.portal-hero::after {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.84), rgba(0, 0, 0, 0.35) 64%, rgba(0, 0, 0, 0.62)),
    linear-gradient(0deg, rgba(5, 6, 5, 0.94), transparent 64%, rgba(5, 6, 5, 0.58));
}

.portal-hero-inner {
  width: min(100%, 1280px);
  margin: 0 auto;
}

.portal-hero h1 {
  max-width: 900px;
  margin-bottom: 22px;
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.96;
  text-wrap: balance;
}

.portal-lead {
  max-width: 670px;
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.7;
  text-wrap: pretty;
}

.portal-section {
  min-height: 44svh;
  padding: clamp(72px, 10vw, 128px) clamp(18px, 4vw, 64px);
}

.portal-section-inner {
  width: min(100%, 1280px);
  margin: 0 auto;
}

.gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: clamp(30px, 5vw, 54px);
}

.gallery-heading h2 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4.6vw, 4.8rem);
  text-wrap: balance;
}

.gallery-heading p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  text-wrap: pretty;
}

.gallery-region {
  position: relative;
}

.work-grid,
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.work-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #171715;
  color: var(--white);
}

.work-card-trigger {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: zoom-in;
}

.work-card-trigger:focus-visible {
  outline-offset: -4px;
}

.work-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.88), transparent 58%, rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.work-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.86) contrast(1.06);
  transition: transform 420ms ease-out, filter 420ms ease-out;
}

.work-card:hover img {
  transform: scale(1.035);
  filter: saturate(1) contrast(1.08);
}

.work-card-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(20px, 3vw, 30px);
}

.work-card h2 {
  max-width: 28ch;
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 700;
  line-height: 1.16;
  text-wrap: balance;
}

.work-card-count {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: var(--action);
  color: #1a1004;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.work-card.is-broken {
  display: grid;
  place-items: center;
  min-height: 240px;
  background: #211f1b;
}

.work-card.is-broken::before {
  content: "Imagen no disponible";
  padding: 24px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 800;
  text-align: center;
}

.work-card.is-broken .work-card-trigger > img,
.work-card.is-broken::after {
  display: none;
}

.lightbox-open {
  overflow: hidden;
}

.work-lightbox {
  width: min(94vw, 1200px);
  height: min(92svh, 900px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #080807;
  color: var(--white);
}

.work-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
}

.work-lightbox-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
}

.work-lightbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.work-lightbox-head h2 {
  margin: 0 0 3px;
  font-size: 1.15rem;
  line-height: 1.25;
  text-wrap: balance;
}

.work-lightbox-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
}

.work-lightbox-close,
.work-lightbox-nav {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-size: 1.45rem;
  cursor: pointer;
  transition: border-color 180ms ease-out, background 180ms ease-out;
}

.work-lightbox-close:hover,
.work-lightbox-nav:hover {
  border-color: var(--action);
  background: rgba(var(--action-rgb), 0.16);
}

.work-lightbox-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: #020302;
}

.work-lightbox-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.work-lightbox-stage img.is-broken {
  opacity: 0.18;
}

.work-lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
}

.work-lightbox-nav.is-previous {
  left: 14px;
}

.work-lightbox-nav.is-next {
  right: 14px;
}

.work-lightbox-thumbnails {
  display: flex;
  gap: 8px;
  min-height: 78px;
  padding: 10px 16px;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  background: #10110f;
}

.work-lightbox-thumbnails button {
  flex: 0 0 76px;
  width: 76px;
  height: 56px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 5px;
  background: #22231f;
  cursor: pointer;
  opacity: 0.62;
}

.work-lightbox-thumbnails button[aria-current="true"] {
  border-color: var(--action);
  opacity: 1;
}

.work-lightbox-thumbnails img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.skeleton-card {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: #dedbd3;
  animation: portal-pulse 1.2s ease-in-out infinite alternate;
}

.skeleton-card:nth-child(2n) {
  animation-delay: 120ms;
}

.skeleton-card:nth-child(3n) {
  animation-delay: 240ms;
}

@keyframes portal-pulse {
  from { opacity: 0.52; }
  to { opacity: 1; }
}

.portal-state {
  display: grid;
  justify-items: start;
  gap: 12px;
  min-height: 260px;
  padding: clamp(30px, 5vw, 54px);
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.56);
}

.portal-state h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3.5vw, 3rem);
  line-height: 1.05;
  text-wrap: balance;
}

.portal-state p {
  max-width: 620px;
  margin: 0;
  color: #5d584f;
  line-height: 1.68;
}

.gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 34px;
}

.portal-button-secondary {
  border-color: var(--ink);
  background: transparent;
  color: var(--ink);
}

.button:disabled,
.portal-top-link[aria-disabled="true"] {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.portal-form-status {
  min-height: 1.5em;
  margin: 0;
  color: #5d584f;
  font-size: 0.9rem;
  line-height: 1.5;
}

.portal-form-status.is-error {
  color: #8e241f;
}

.portal-form-status.is-success {
  color: #28633b;
}

.auth-main {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 124px 18px 54px;
  overflow: hidden;
}

.auth-main::before,
.auth-main::after {
  content: "";
  position: absolute;
  inset: 0;
}

.auth-main::before {
  z-index: -2;
  background: url("assets/images/render-carro-polarizado.webp") center 74% / min(1100px, 92vw) auto no-repeat;
  opacity: 0.58;
}

.auth-main::after {
  z-index: -1;
  background:
    radial-gradient(circle at 74% 25%, rgba(var(--action-rgb), 0.18), transparent 24rem),
    linear-gradient(90deg, rgba(5, 6, 5, 0.96), rgba(5, 6, 5, 0.7)),
    linear-gradient(135deg, #050605, #181510 52%, #050605);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(340px, 0.48fr);
  gap: clamp(34px, 8vw, 96px);
  align-items: center;
  width: min(100%, 1120px);
}

.auth-copy h1 {
  max-width: 690px;
  margin-bottom: 22px;
  font-size: clamp(2.8rem, 6vw, 5.5rem);
  line-height: 0.96;
  text-wrap: balance;
}

.auth-copy > p:not(.eyebrow) {
  max-width: 580px;
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.72;
  text-wrap: pretty;
}

.portal-form {
  display: grid;
  gap: 20px;
  padding: clamp(24px, 4vw, 38px);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
}

.portal-form-field {
  display: grid;
  gap: 9px;
  color: #33302b;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.portal-form-field input,
.portal-form-field textarea {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.26);
  border-radius: 7px 7px 0 0;
  outline: 0;
  background: #f4f3ef;
  color: #111;
  padding: 15px 14px;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 160ms ease-out, background 160ms ease-out;
}

.portal-form-field input::placeholder,
.portal-form-field textarea::placeholder {
  color: #625e56;
  opacity: 1;
}

.portal-form-field input:focus,
.portal-form-field textarea:focus {
  border-color: var(--action-dark);
  background: #fff;
}

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 92px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--action-dark);
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
  transform: translateY(-50%);
}

.auth-submit {
  width: 100%;
  border: 0;
}

.auth-help {
  margin: -4px 0 0;
  color: #625e56;
  font-size: 0.84rem;
  line-height: 1.5;
}

.admin-body {
  color-scheme: light;
  background: var(--paper);
  color: var(--ink);
}

.admin-main {
  min-height: 100svh;
  padding: 118px clamp(18px, 4vw, 64px) clamp(68px, 9vw, 110px);
  background:
    radial-gradient(circle at 84% 8%, rgba(var(--action-rgb), 0.16), transparent 22rem),
    var(--paper);
}

.admin-shell {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.admin-auth-state {
  display: grid;
  place-items: center;
  min-height: 52svh;
  color: #5d584f;
  font-weight: 700;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 38px;
}

.admin-heading h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 4vw, 4rem);
  line-height: 1;
  text-wrap: balance;
}

.admin-heading p {
  max-width: 620px;
  margin: 0;
  color: #5d584f;
  line-height: 1.65;
}

.admin-identity {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid rgba(var(--action-rgb), 0.42);
  border-radius: var(--radius);
  background: rgba(var(--action-rgb), 0.1);
  color: #6c4313;
  font-size: 0.76rem;
  font-weight: 900;
}

.upload-panel {
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  background: var(--white);
}

.upload-panel h2,
.admin-recent h2 {
  margin-bottom: 10px;
  font-size: 1.55rem;
  line-height: 1.15;
}

.upload-intro,
.admin-recent-head p {
  margin: 0;
  color: #5d584f;
  line-height: 1.62;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  gap: clamp(24px, 5vw, 52px);
  margin-top: 30px;
}

.upload-picker {
  display: grid;
  gap: 14px;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  min-height: 330px;
  padding: 28px;
  border: 1px dashed rgba(0, 0, 0, 0.34);
  border-radius: var(--radius);
  background: #f3f1eb;
  color: #3d3932;
  text-align: center;
  cursor: pointer;
  transition: border-color 180ms ease-out, background 180ms ease-out;
}

.upload-dropzone:hover,
.upload-dropzone.is-dragging {
  border-color: var(--action-dark);
  background: rgba(var(--action-rgb), 0.12);
}

.upload-dropzone strong,
.upload-dropzone span {
  display: block;
}

.upload-dropzone strong {
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.upload-dropzone span {
  color: #625e56;
  font-size: 0.88rem;
  line-height: 1.55;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.upload-preview {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #191916;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview figcaption {
  position: absolute;
  right: 7px;
  bottom: 7px;
  padding: 5px 7px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 900;
}

.upload-preview-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.8);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.selected-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #504c44;
  font-size: 0.84rem;
}

.selected-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--action-dark);
  font-weight: 900;
  cursor: pointer;
}

.upload-fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.upload-fields .portal-form-field {
  flex: 1 1 auto;
  align-content: start;
}

.upload-submit {
  width: 100%;
  border: 0;
}

.upload-progress {
  display: grid;
  gap: 7px;
  color: #5d584f;
  font-size: 0.82rem;
}

.upload-progress progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  accent-color: var(--action-dark);
}

.admin-recent {
  margin-top: clamp(50px, 7vw, 78px);
}

.admin-recent-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.admin-recent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-recent-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.admin-recent-item img {
  width: 92px;
  aspect-ratio: 4 / 3;
  border-radius: 5px;
  object-fit: cover;
  background: #ddd8cf;
}

.admin-recent-item strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.admin-recent-details {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
}

.admin-recent-details > span {
  color: #625e56;
  font-size: 0.76rem;
}

.admin-delete-button {
  justify-self: start;
  min-height: 36px;
  margin-top: 3px;
  padding: 0 10px;
  border: 1px solid rgba(142, 36, 31, 0.38);
  border-radius: var(--radius);
  background: transparent;
  color: #8e241f;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.admin-delete-button:hover {
  background: rgba(142, 36, 31, 0.08);
}

.admin-delete-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.admin-empty {
  padding: 24px;
  border: 1px solid var(--dark-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.56);
  color: #5d584f;
  line-height: 1.6;
}

@media (max-width: 1080px) {
  .gallery-heading,
  .admin-heading,
  .admin-recent-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .work-grid,
  .skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-layout,
  .upload-form {
    grid-template-columns: 1fr;
  }

  .auth-layout {
    width: min(100%, 720px);
  }

  .upload-fields .portal-form-field {
    flex: initial;
  }

  .admin-recent-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .portal-simple-header {
    min-height: 68px;
  }

  .portal-simple-header .brand > span:last-child {
    display: none;
  }

  .portal-header-actions {
    gap: 6px;
  }

  .portal-top-link,
  .portal-logout {
    min-height: 40px;
    padding: 0 10px;
    font-size: 0.64rem;
    letter-spacing: 0.06em;
  }

  .portal-hero {
    min-height: 68svh;
    padding: 136px 18px 62px;
  }

  .portal-hero h1 {
    font-size: clamp(2.6rem, 13vw, 4rem);
  }

  .work-grid,
  .skeleton-grid,
  .admin-recent-grid {
    grid-template-columns: 1fr;
  }

  .work-card {
    aspect-ratio: 5 / 4;
  }

  .auth-main {
    align-items: start;
    padding-top: 112px;
  }

  .auth-copy h1 {
    font-size: clamp(2.45rem, 12vw, 3.6rem);
  }

  .portal-form {
    padding: 22px 18px;
  }

  .admin-main {
    padding-top: 104px;
  }

  .upload-panel {
    padding: 22px 16px;
  }

  .upload-dropzone {
    min-height: 260px;
  }

  .selected-file {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-lightbox {
    width: 100vw;
    height: 100svh;
    border-radius: 0;
  }

  .work-lightbox-head {
    padding: 12px;
  }

  .work-lightbox-nav.is-previous {
    left: 8px;
  }

  .work-lightbox-nav.is-next {
    right: 8px;
  }

  .admin-recent-item {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .admin-recent-item img {
    width: 84px;
  }
}

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