:root {
  --ink: #0b132b;
  --ink-2: #14213d;
  --teal: #1fb6a6;
  --teal-dark: #12877a;
  --amber: #f4b15a;
  --amber-dark: #d8892f;
  --sky: #e8f3ff;
  --muted: #8aa1c1;
  --white: #ffffff;
  --card: #f9fbff;
  --border: rgba(15, 32, 66, 0.12);
  --shadow: 0 24px 60px rgba(10, 27, 60, 0.18);
  --shadow-soft: 0 18px 36px rgba(10, 27, 60, 0.12);
  --radius: 20px;
  --radius-lg: 28px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Figtree", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 8% 12%, rgba(244, 177, 90, 0.25), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(31, 182, 166, 0.2), transparent 40%),
    linear-gradient(180deg, #f7f9ff 0%, #f2f6fb 40%, #f6f2ed 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
}

.portal {
  position: relative;
  min-height: 100vh;
}

.portal::before,
.portal::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
}

.portal::before {
  background: rgba(31, 182, 166, 0.4);
  top: -120px;
  right: -80px;
}

.portal::after {
  background: rgba(244, 177, 90, 0.4);
  bottom: 140px;
  left: -140px;
}

.hero {
  position: relative;
  z-index: 1;
  max-width: none;
  margin: 0;
  padding: 2rem clamp(1.5rem, 4vw, 4.5rem) 2rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.6rem;
  align-items: center;
  animation: fade-in 0.8s ease-out;
}

.hero-left h1 {
  font-family: "Raleway", "Figtree", sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.05;
  margin-bottom: 0.5rem;
}

.hero-desc {
  color: var(--ink-2);
  line-height: 1.55;
  font-size: 0.95rem;
  max-width: 520px;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}

.brand img {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.brand-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.7rem;
  color: var(--muted);
}

.brand-name {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: "Raleway", sans-serif;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1rem 0 0.9rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-chip {
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  background: rgba(31, 182, 166, 0.12);
  color: #0c6b62;
  font-weight: 600;
  font-size: 0.75rem;
}

.hero-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(15, 32, 66, 0.1);
  height: clamp(220px, 26vw, 320px);
  transform: translateY(0);
  animation: float-in 1.2s ease-out;
}

.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: rgba(11, 19, 43, 0.82);
  color: var(--white);
  border-radius: 16px;
  padding: 0.6rem 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  font-size: 0.72rem;
}

.hero-overlay strong {
  display: block;
  font-size: 1rem;
}

.portal-shell {
  max-width: none;
  margin: 0;
  padding: 0 clamp(1.5rem, 4vw, 4.5rem) 4rem;
  position: relative;
  z-index: 1;
}

.catalog,
.viewer {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(15, 32, 66, 0.08);
  box-shadow: var(--shadow-soft);
}

.catalog {
  padding: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(420px, 92vw);
  transform: translateX(-110%);
  transition: transform 0.35s ease;
  z-index: 6;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.portal-shell.menu-open .catalog {
  transform: translateX(0);
}

.catalog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 43, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 5;
}

.portal-shell.menu-open .catalog-overlay {
  opacity: 1;
  pointer-events: auto;
}

.catalog-top {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.catalog h2,
.viewer h2,
.modal h2 {
  font-family: "Raleway", sans-serif;
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.catalog p,
.viewer p {
  color: var(--ink-2);
  line-height: 1.6;
}

.catalog-controls {
  display: grid;
  gap: 0.8rem;
  min-width: 240px;
}

.search {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.search input {
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--white);
}

.view-toggle {
  display: inline-flex;
  background: rgba(232, 243, 255, 0.8);
  border-radius: var(--radius-pill);
  padding: 0.3rem;
  gap: 0.3rem;
  border: 1px solid rgba(15, 32, 66, 0.1);
}

.toggle {
  border: none;
  background: transparent;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-2);
}

.toggle.active {
  background: var(--white);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}

.catalog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}

.catalog.is-list .catalog-list {
  grid-template-columns: 1fr;
}

.catalog-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 12px 24px rgba(10, 27, 60, 0.08);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border 0.25s ease;
  animation: card-in 0.6s ease forwards;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

.catalog-card:focus-visible {
  outline: 2px solid rgba(31, 182, 166, 0.8);
  outline-offset: 2px;
}

.catalog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(31, 182, 166, 0.4);
}

.catalog-card.is-active {
  border-color: var(--teal);
  box-shadow: 0 18px 40px rgba(31, 182, 166, 0.2);
}

.catalog-card-cover {
  height: 120px;
  background: linear-gradient(135deg, rgba(31, 182, 166, 0.2), rgba(244, 177, 90, 0.25));
  position: relative;
}

.catalog-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-card-body {
  padding: 1rem 1.1rem 1.2rem;
  display: grid;
  gap: 0.6rem;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: baseline;
}

.card-top h3 {
  font-size: 1rem;
  font-weight: 700;
}

.card-date {
  font-size: 0.75rem;
  color: var(--muted);
}

.card-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-2);
}

.card-desc {
  font-size: 0.85rem;
  color: #4a5775;
  line-height: 1.5;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(31, 182, 166, 0.12);
  color: #0c6b62;
  font-size: 0.7rem;
  font-weight: 600;
}

.catalog.is-list .catalog-card {
  flex-direction: row;
  align-items: center;
  gap: 1rem;
}

.catalog.is-list .catalog-card-cover {
  width: 120px;
  height: 90px;
  flex-shrink: 0;
}

.catalog.is-list .catalog-card-body {
  padding: 1rem;
}

.catalog-empty {
  text-align: center;
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px dashed rgba(15, 32, 66, 0.2);
  background: rgba(232, 243, 255, 0.6);
}

.viewer {
  padding: 2.2rem;
  display: grid;
  gap: 1.6rem;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.viewer-header .section-kicker {
  font-size: 0.6rem;
  margin-bottom: 0.2rem;
}

.viewer-header h2 {
  font-size: 1.15rem;
  margin-bottom: 0.2rem;
}

.viewer-header p {
  font-size: 0.85rem;
  margin-bottom: 0;
}

.viewer-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.viewer-actions .btn {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.viewer-frame {
  position: relative;
  min-height: min(900px, 80vh);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(232, 243, 255, 0.6);
}

.viewer-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--white);
}

.viewer-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  background: var(--white);
}

.viewer-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
  background: var(--white);
}

.viewer-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  color: #4a5775;
}

.portal-footer {
  max-width: none;
  margin: 0;
  padding: 2.5rem clamp(1.5rem, 4vw, 4.5rem) 3.5rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--ink-2);
}

.footer-links {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

.link-button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
}

.btn {
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary {
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 12px 24px rgba(31, 182, 166, 0.3);
}

.btn.primary:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.btn.ghost {
  background: rgba(232, 243, 255, 0.8);
  color: var(--ink-2);
}

.btn.outline {
  background: transparent;
  border: 1px solid rgba(15, 32, 66, 0.2);
  color: var(--ink-2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(15, 32, 66, 0.15);
  background: rgba(11, 19, 43, 0.06);
  color: var(--ink-2);
  font-size: 1.4rem;
  cursor: pointer;
}

.icon-button.danger {
  border-color: rgba(244, 177, 90, 0.6);
  color: var(--amber);
  background: rgba(244, 177, 90, 0.15);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(11, 19, 43, 0.55);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(960px, 92vw);
  max-height: 88vh;
  overflow: hidden;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto 1fr;
  position: relative;
  z-index: 2;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.8rem 2rem 1.2rem;
  background: linear-gradient(90deg, rgba(31, 182, 166, 0.12), rgba(244, 177, 90, 0.2));
}

.modal-body {
  overflow-y: auto;
  padding: 1.6rem 2rem 2rem;
  display: grid;
  gap: 2rem;
}

.admin-section {
  display: grid;
  gap: 1rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.admin-grid label,
.admin-items label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-grid input,
.admin-items input,
.admin-items textarea,
.admin-section textarea {
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.span-2 {
  grid-column: span 2;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.admin-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.admin-items {
  display: grid;
  gap: 1.2rem;
}

.admin-item {
  border: 1px solid rgba(15, 32, 66, 0.12);
  border-radius: 16px;
  padding: 1rem 1.2rem 1.2rem;
  background: rgba(232, 243, 255, 0.4);
  display: grid;
  gap: 0.8rem;
}

.admin-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-item-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.file-picker {
  display: grid;
  gap: 0.4rem;
  align-content: start;
  font-size: 0.85rem;
  color: var(--muted);
}

.file-picker .btn {
  justify-self: start;
}

.file-name {
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-footer {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-in {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-right {
    order: -1;
  }
}

@media (max-width: 820px) {
  .catalog {
    width: 100%;
  }

  .hero {
    padding: 3.5rem 1.6rem 3rem;
  }

  .portal-shell {
    padding: 0 1.6rem 3rem;
  }

  .catalog,
  .viewer {
    padding: 1.6rem;
  }

  .viewer-frame {
    min-height: 360px;
  }

  .modal-body {
    padding: 1.4rem;
  }
}

@media (max-width: 640px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .catalog-top {
    flex-direction: column;
    align-items: stretch;
  }

  .viewer-header {
    flex-direction: column;
  }

  .catalog.is-list .catalog-card {
    flex-direction: column;
  }

  .catalog.is-list .catalog-card-cover {
    width: 100%;
    height: 140px;
  }

  .portal-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
