:root {
  --sand: #f0ead8;
  --sand-light: #faf7ee;
  --sand-deep: #e4dcc4;
  --ink: #2c2418;
  --ink-soft: #5c5141;
  --petrol: #3e5e61;
  --petrol-dark: #294649;
  --petrol-light: #dfe9e7;
  --accent: #b92559;
  --olive: #575d45;
  --white: #fff;
  --danger: #9f2034;
  --success: #2e6547;
  --border: rgba(44, 36, 24, 0.2);
  --shadow: 0 18px 48px rgba(44, 36, 24, 0.1);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 30px;
  --content: 1180px;
  --font-body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--sand-light); font: 400 18px/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }
a { color: var(--petrol-dark); text-underline-offset: 0.2em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--accent); }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 500; line-height: 1.05; text-wrap: balance; }
h1 { font-size: clamp(2.7rem, 7vw, 5.5rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(2.25rem, 4vw, 3.7rem); letter-spacing: -0.025em; }
h3 { font-size: 1.65rem; }
p { margin-block: 0 1em; }
.container { width: min(calc(100% - 40px), var(--content)); margin-inline: auto; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 12px 18px; color: var(--white); background: var(--ink); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 4px; }

.site-header { position: relative; z-index: 10; min-height: 86px; background: rgba(240, 234, 216, 0.96); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; min-height: 86px; align-items: center; justify-content: space-between; gap: 28px; }
.brand { min-height: 48px; display: inline-flex; align-items: center; gap: 8px; color: var(--petrol-dark); text-decoration: none; }
.brand:hover { color: var(--petrol-dark); }
.brand-name { font-family: var(--font-display); font-size: 2.6rem; font-style: italic; font-weight: 600; line-height: 1; }
.brand-subtitle { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.main-nav { display: flex; align-items: center; justify-content: flex-end; gap: clamp(12px, 2.4vw, 30px); }
.main-nav a, .nav-button { min-height: 48px; display: inline-flex; align-items: center; color: var(--ink); font-size: 0.88rem; font-weight: 700; letter-spacing: 0.055em; text-decoration: none; text-transform: uppercase; }
.main-nav a[aria-current="page"] { color: var(--petrol-dark); box-shadow: inset 0 -3px var(--petrol); }
.main-nav form { margin: 0; }
.nav-button { padding: 0; color: var(--ink); background: none; border: 0; cursor: pointer; }
.main-nav a:hover, .nav-button:hover { color: var(--accent); }

.messages { padding-top: 18px; }
.message { margin: 0; padding: 14px 18px; background: var(--petrol-light); border-left: 5px solid var(--petrol); border-radius: var(--radius-sm); }
.message.error { background: #f8e4e7; border-color: var(--danger); }
.message.success { background: #e1eee5; border-color: var(--success); }

.eyebrow { margin: 0 0 12px; color: var(--olive); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; }
.hero { overflow: hidden; color: var(--ink); background: var(--sand); border-bottom: 1px solid var(--border); }
.hero-inner { position: relative; padding-block: clamp(74px, 10vw, 136px); }
.hero-inner::after { content: ""; position: absolute; width: min(36vw, 440px); aspect-ratio: 1; right: -8%; top: 12%; border: 1px solid rgba(62, 94, 97, 0.25); border-radius: 50%; box-shadow: 0 0 0 48px rgba(62, 94, 97, 0.04), 0 0 0 96px rgba(62, 94, 97, 0.025); pointer-events: none; }
.hero h1 { position: relative; z-index: 1; max-width: 820px; }
.hero-copy { position: relative; z-index: 1; max-width: 700px; margin: 28px 0 34px; color: var(--ink-soft); font-size: clamp(1.05rem, 2vw, 1.3rem); }
.hero-search { position: relative; z-index: 1; display: flex; width: min(100%, 760px); padding: 8px; background: var(--white); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow); }
.hero-search input { min-width: 0; flex: 1; min-height: 54px; padding: 8px 20px; color: var(--ink); background: transparent; border: 0; }
.hero-search input:focus { outline: 0; }
.hero-search:focus-within { outline: 4px solid var(--accent); outline-offset: 4px; }

.button { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; gap: 8px; padding: 10px 22px; font-weight: 750; line-height: 1.25; text-align: center; text-decoration: none; border: 2px solid transparent; border-radius: 999px; cursor: pointer; }
.button-primary { color: var(--white); background: var(--petrol-dark); }
.button-primary:hover { color: var(--white); background: var(--accent); }
.button-accent { color: var(--white); background: var(--accent); }
.button-accent:hover { color: var(--white); background: var(--petrol-dark); }
.button-secondary { color: var(--petrol-dark); background: transparent; border-color: var(--petrol); }
.button-secondary:hover { color: var(--white); background: var(--petrol); }
.button-quiet { color: var(--ink); background: var(--sand); border-color: var(--border); }
.button-quiet:hover { color: var(--ink); background: var(--sand-deep); }
.button-full { width: 100%; }
.text-link { min-height: 48px; display: inline-flex; align-items: center; font-weight: 750; }

.section { padding-block: clamp(64px, 8vw, 108px); }
.section-compact { padding-top: 48px; }
.section-tinted { background: var(--sand); border-block: 1px solid var(--border); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 36px; }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.theme-card { min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; padding: 24px; color: var(--ink); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.theme-card:hover { color: var(--ink); border-color: var(--petrol); box-shadow: 0 14px 32px rgba(44, 36, 24, 0.08); transform: translateY(-3px); }
.theme-mark { color: var(--petrol); font-family: var(--font-display); font-size: 1.5rem; }
.theme-card strong { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.05; }
.theme-card > span:last-child:not(.theme-mark) { margin-top: 10px; color: var(--ink-soft); font-size: 0.88rem; }

.material-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.material-card { overflow: hidden; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); transition: transform 180ms ease, box-shadow 180ms ease; }
.material-card:hover { box-shadow: var(--shadow); transform: translateY(-4px); }
.card-cover, .detail-cover { position: relative; display: block; overflow: hidden; color: var(--white); background: var(--petrol); aspect-ratio: 16 / 9; }
.card-cover::before, .detail-fallback::before { content: ""; position: absolute; width: 54%; aspect-ratio: 1; right: -12%; bottom: -40%; border: 1px solid rgba(255, 255, 255, 0.48); border-radius: 50%; box-shadow: 0 0 0 28px rgba(255, 255, 255, 0.08); }
.card-cover img, .detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-type { position: absolute; left: 18px; bottom: 16px; padding: 5px 10px; color: var(--white); background: rgba(44, 36, 24, 0.76); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; border-radius: 999px; }
.type-audio { background: #826044; }
.type-pdf { background: #9d3d50; }
.type-imagem { background: #65764f; }
.type-livro { background: #725b79; }
.type-link { background: #506779; }
.card-body { padding: 22px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; color: var(--olive); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.card-body h3 { font-size: 1.65rem; }
.card-body h3 a { min-height: 48px; display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.card-body h3 a:hover { color: var(--petrol); text-decoration: underline; }
.card-body p { margin: 13px 0 0; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.55; }

.page-header { padding-block: clamp(60px, 8vw, 98px); background: var(--sand); border-bottom: 1px solid var(--border); }
.page-header h1 { max-width: 900px; font-size: clamp(2.7rem, 6vw, 4.8rem); }
.page-header p:last-child { max-width: 660px; margin: 22px 0 0; color: var(--ink-soft); }
.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 16px; align-items: end; padding: 24px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(44, 36, 24, 0.05); }
.field { display: grid; gap: 7px; }
.field label { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.04em; }
.field input, .field select, .stack-form input { width: 100%; min-height: 52px; padding: 10px 14px; color: var(--ink); background: var(--sand-light); border: 2px solid #b7ad96; border-radius: var(--radius-sm); }
.field input:focus, .field select:focus, .stack-form input:focus { border-color: var(--petrol); outline: 4px solid rgba(185, 37, 89, 0.24); outline-offset: 1px; }
.filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; margin: 44px 0 24px; }
.results-heading h2 { font-size: 2.2rem; }
.results-heading p { color: var(--ink-soft); }
.empty-state { padding: clamp(36px, 7vw, 72px); text-align: center; background: var(--sand); border: 1px dashed var(--olive); border-radius: var(--radius); }
.empty-state h2, .empty-state h3 { margin-bottom: 14px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 48px; }

.detail-header { padding-block: clamp(52px, 7vw, 92px); background: var(--sand); border-bottom: 1px solid var(--border); }
.detail-header-inner > div { max-width: 900px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; font-size: 0.9rem; }
.detail-header h1 { max-width: 880px; font-size: clamp(2.8rem, 6vw, 5rem); }
.detail-summary { max-width: 790px; margin: 24px 0 12px; color: var(--ink-soft); font-size: 1.2rem; }
.detail-source { font-weight: 700; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(260px, 0.8fr); gap: clamp(30px, 5vw, 70px); padding-block: clamp(48px, 7vw, 88px); align-items: start; }
.embed-shell { overflow: hidden; background: var(--ink); aspect-ratio: 16 / 9; border-radius: var(--radius); box-shadow: var(--shadow); }
.embed-shell iframe { width: 100%; height: 100%; border: 0; }
.detail-cover { border-radius: var(--radius); box-shadow: var(--shadow); }
.detail-fallback { display: grid; place-items: center; }
.detail-fallback span { position: relative; z-index: 1; font-family: var(--font-display); font-size: clamp(2rem, 5vw, 4rem); }
.origin-note { margin-top: 32px; padding: 28px; background: var(--sand); border-radius: var(--radius); }
.origin-note h2 { margin-bottom: 12px; font-size: 2.1rem; }
.origin-note p { color: var(--ink-soft); }
.detail-aside { padding: 26px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.detail-aside h2 { font-size: 2rem; }
.detail-aside h3 { margin: 28px 0 12px; font-size: 1.35rem; }
.detail-aside dl { margin: 18px 0 0; }
.detail-aside dl div { padding-block: 13px; border-bottom: 1px solid var(--border); }
.detail-aside dt { color: var(--olive); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.detail-aside dd { margin: 3px 0 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list a { padding: 6px 11px; color: var(--petrol-dark); background: var(--petrol-light); font-size: 0.82rem; font-weight: 700; text-decoration: none; border-radius: 999px; }

.site-footer { padding-block: 38px; color: #e9e4d8; background: var(--ink); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; }
.footer-inner p { margin: 0; font-size: 0.86rem; }

.public-body { min-height: 100vh; background: var(--sand); }
.public-shell { min-height: 100vh; display: grid; place-content: center; padding: 36px 20px; }
.auth-card { width: min(100%, 520px); padding: clamp(30px, 6vw, 54px); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.brand-public { margin-bottom: 48px; }
.auth-card h1 { font-size: clamp(2.5rem, 7vw, 4.1rem); }
.auth-intro { margin: 18px 0 28px; color: var(--ink-soft); }
.stack-form { display: grid; gap: 18px; }
.stack-form p { display: grid; gap: 7px; margin: 0; }
.stack-form p label { font-size: 0.82rem; font-weight: 800; }
.stack-form .helptext { color: var(--ink-soft); font-size: 0.78rem; }
.stack-form ul { margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: 0.78rem; }
.errorlist, .form-errors { margin: 0 0 18px; padding: 13px 16px; color: #741426; background: #fbe7ea; border-left: 5px solid var(--danger); border-radius: 8px; }
.auth-secondary, .support-link { margin: 22px 0 0; text-align: center; }
.support-link { padding-top: 20px; border-top: 1px solid var(--border); }
.public-note { margin: 20px 0 0; color: var(--ink-soft); font-size: 0.82rem; text-align: center; }

@media (max-width: 980px) {
  .header-inner { padding-block: 16px; align-items: flex-start; }
  .main-nav { flex-wrap: wrap; }
  .theme-grid { grid-template-columns: repeat(2, 1fr); }
  .material-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .filter-search { grid-column: 1 / -1; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-aside { max-width: none; }
}

@media (max-width: 680px) {
  body { font-size: 17px; }
  .container { width: min(calc(100% - 28px), var(--content)); }
  .header-inner { display: block; }
  .main-nav { margin-top: 14px; justify-content: flex-start; gap: 4px 18px; }
  .main-nav a, .nav-button { min-height: 44px; font-size: 0.76rem; }
  .hero-inner::after { display: none; }
  .hero-search { display: grid; padding: 8px; border-radius: var(--radius); }
  .hero-search .button { margin-top: 6px; }
  .section-heading, .results-heading, .footer-inner { display: block; }
  .section-heading .text-link { margin-top: 12px; }
  .theme-grid, .material-grid, .filters { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .filter-actions { grid-column: auto; display: grid; }
  .pagination { flex-wrap: wrap; }
  .detail-layout { width: 100%; }
  .detail-aside, .origin-note { border-radius: 0; }
  .embed-shell, .detail-cover { border-radius: 0; }
  .detail-content, .detail-aside { width: 100%; }
  .public-shell { place-content: start center; padding-inline: 0; }
  .auth-card { border-inline: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
}

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

@media (forced-colors: active) {
  .button, .material-card, .theme-card, .filters, .auth-card { border: 2px solid ButtonText; }
}
