:root {
  color-scheme: light;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ea;
  --surface: #ffffff;
  --soft: #f1f5f9;
  --teal: #073b3f;
  --teal-light: #dff7f2;
  --teal-mid: #0f766e;
  --amber: #d97706;
  --radius: 18px;
  --shadow: 0 18px 48px -34px rgba(15, 23, 42, 0.55);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.1), transparent 30rem),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.site-header {
  border-bottom: 1px solid rgba(203, 213, 225, 0.8);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.header-inner,
.content,
.site-footer {
  width: min(100% - 40px, 1240px);
  margin-inline: auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  border-radius: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: var(--teal);
  color: white;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.04em;
  box-shadow: 0 8px 20px -12px rgba(7, 59, 63, 0.7);
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(241, 245, 249, 0.85);
}

.nav-tabs a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 9px;
  color: #475569;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.nav-tabs a:hover,
.nav-tabs a[aria-current="page"] {
  background: white;
  color: var(--teal);
  box-shadow: 0 3px 12px -8px rgba(15, 23, 42, 0.6);
}

.content {
  min-height: calc(100vh - 170px);
  padding-block: 52px;
}

.page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 32px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 0 0 12px;
  padding: 0 10px;
  border: 1px solid #a7e4d9;
  border-radius: 999px;
  background: #ecfdf8;
  color: #115e59;
  font-size: 12px;
  font-weight: 700;
}

.eyebrow.amber {
  border-color: #f5d38e;
  background: #fffbeb;
  color: #92400e;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(32px, 5vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.lead {
  max-width: 650px;
  margin: 14px 0 0;
  color: #475569;
  font-size: 16px;
  line-height: 1.7;
}

.intro-note {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.catalog-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.catalog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 60px -34px rgba(15, 23, 42, 0.65);
}

.catalog-cover {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  background: #fffbeb;
}

.catalog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.catalog-title,
.catalog-action {
  display: block;
}

.catalog-title {
  font-size: 14px;
  font-weight: 750;
}

.catalog-action {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.external-mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--soft);
  color: #475569;
  font-size: 16px;
  transition: background 180ms ease, color 180ms ease;
}

.catalog-card:hover .external-mark {
  background: var(--teal);
  color: white;
}

.price-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: start;
  gap: 34px;
}

.search-panel {
  margin-top: 30px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
  box-shadow: 0 28px 80px -48px rgba(15, 23, 42, 0.65);
}

.search-form {
  display: flex;
  gap: 12px;
}

.search-form input {
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  outline: none;
  text-transform: uppercase;
}

.search-form input:focus {
  border-color: var(--teal-mid);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.search-form button {
  height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--teal);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.search-form button:hover {
  background: #115e59;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.example-button {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.example-button:hover {
  border-color: #99d8ce;
  background: #ecfdf8;
}

.price-result {
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid #9fe2d7;
  border-radius: 16px;
  background: rgba(236, 253, 248, 0.78);
}

.result-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 26px;
}

.result-reference {
  margin: 0;
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 800;
}

.result-description {
  margin: 8px 0 0;
  font-size: 19px;
  font-weight: 750;
}

.result-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.result-price {
  min-width: 155px;
  padding-left: 28px;
  border-left: 1px solid #9fe2d7;
  text-align: right;
}

.result-price strong {
  display: block;
  color: var(--teal);
  font-size: 30px;
  letter-spacing: -0.03em;
}

.result-price span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.not-found {
  padding: 34px;
  border-color: #cbd5e1;
  background: #f8fafc;
  text-align: center;
}

.not-found .result-description {
  font-size: 17px;
}

.side-note {
  margin-top: 54px;
  padding: 24px;
  border-radius: 18px;
  background: var(--teal);
  color: white;
}

.side-note h2 {
  margin: 0;
  font-size: 16px;
}

.side-note p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  line-height: 1.65;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-block: 0 30px;
  color: var(--muted);
  font-size: 12px;
}

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.35);
  outline-offset: 3px;
}

@media (min-width: 720px) {
  .catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1040px) {
  .catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
  }
}

@media (max-width: 820px) {
  .header-inner,
  .page-intro,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-tabs a {
    flex: 1;
    justify-content: center;
  }

  .price-layout {
    grid-template-columns: 1fr;
  }

  .side-note {
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .header-inner,
  .content,
  .site-footer {
    width: min(100% - 28px, 1240px);
  }

  .brand-subtitle {
    display: none;
  }

  .nav-tabs a {
    padding-inline: 10px;
    font-size: 13px;
  }

  .content {
    padding-block: 38px;
  }

  .catalog-grid {
    gap: 12px;
  }

  .catalog-meta {
    padding: 12px;
  }

  .external-mark {
    display: none;
  }

  .search-panel {
    padding: 18px;
  }

  .search-form,
  .result-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .result-price {
    padding: 18px 0 0;
    border-top: 1px solid #9fe2d7;
    border-left: 0;
    text-align: left;
  }
}

/* Lista de preços */
.search-form input {
  text-transform: none;
}

.search-form input:disabled,
.search-form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.price-status {
  margin: 18px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.price-results {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.price-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.price-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--teal);
}

.price-card-heading > strong:first-child {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.price-value {
  flex: 0 0 auto;
  font-size: 21px;
}

.price-designation {
  margin: 10px 0 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.price-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.price-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #334155;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.price-field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 620px) {
  .price-card-heading {
    align-items: flex-start;
  }

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

@media (max-width: 420px) {
  .price-card-heading {
    flex-direction: column;
    gap: 6px;
  }

  .price-fields {
    grid-template-columns: 1fr;
  }
}

/* Imagens e documentos dos produtos */
.price-card-body {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
}

.price-media {
  position: relative;
  display: grid;
  width: 148px;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
}

.price-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.price-image-fallback {
  display: none;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.price-media.is-missing .price-image-fallback {
  display: block;
}

.price-card-content {
  min-width: 0;
}

.price-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.price-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--teal);
  border-radius: 10px;
  background: var(--teal);
  color: white;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.price-action:hover {
  background: #115e59;
}

.price-action.secondary {
  background: white;
  color: var(--teal);
}

.price-action.secondary:hover {
  background: var(--teal-light);
}

@media (max-width: 620px) {
  .price-card-body {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 16px;
  }

  .price-media {
    width: 110px;
  }
}

@media (max-width: 420px) {
  .price-card-body {
    grid-template-columns: 1fr;
  }

  .price-media {
    width: 100%;
    max-width: 220px;
    justify-self: center;
  }
}

/* Estados de disponibilidade dos ficheiros */
.price-image[hidden] {
  display: none;
}

.price-action.is-checking,
.price-action.is-unavailable {
  cursor: default;
  pointer-events: none;
}

.price-action.is-checking {
  border-color: var(--line);
  background: #e2e8f0;
  color: #64748b;
}

.price-action.secondary.is-checking {
  background: #f1f5f9;
  color: #64748b;
}

.price-action.is-unavailable,
.price-action.secondary.is-unavailable {
  border-color: #cbd5e1;
  background: transparent;
  color: #94a3b8;
}
