:root {
  color-scheme: dark;

  /* PALETA EAD PUCV (MADERA, PIZARRA, SOL Y TERRACOTA) */
  --bg: #121415;             /* Grafito profundo / Sombras */
  --surface: #1a1d20;        /* Madera tratada / Muro */
  --surface-warm: #24211d;   /* Marco de madera cálida */
  --border: #38332c;         /* Ensamble de madera */

  --text: #f0eae1;           /* Blanco tiza / Papel */
  --muted: #a69f93;          /* Tiza desgastada */

  --amber: #e88d39;          /* Luz solar en madera */
  --cyan: #5fa8b8;           /* Luz filtrada */
  --terracotta: #c85a42;     /* Sello EAD */
  --sand: #d8c39d;           /* Papel kraft */

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 28px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
a[href] {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 5px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 400;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h2 {
  font-size: clamp(28px, 3vw, 36px);
}

h3 {
  font-size: 20px;
}

.container {
  width: min(1152px, calc(100% - 48px));
  margin-inline: auto;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.cyan {
  color: var(--cyan);
}

.violet {
  color: var(--amber);
}

.eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 20;
  padding: 12px 16px;
  background: var(--amber);
  color: var(--bg);
}

.skip-link:focus {
  top: 12px;
}

/* HEADER Y NAVEGACIÓN EAD */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 20, 21, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 300ms ease;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 280ms var(--ease), text-shadow 280ms ease;
}

.brand:hover {
  color: var(--amber);
  text-shadow: 0 0 16px rgba(232, 141, 57, 0.35);
}

nav {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 13px;
}

nav a {
  position: relative;
  padding-block: 6px;
  color: var(--muted);
  font-weight: 500;
  transition: color 240ms var(--ease);
}

nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 300ms var(--ease);
}

nav a[href="#asignatura"]:hover { color: var(--sand); }
nav a[href="#asignatura"]::after { background: var(--sand); }

nav a[href="#tareas"]:hover { color: var(--cyan); }
nav a[href="#tareas"]::after { background: var(--cyan); }

nav a[href="#proyecto"]:hover { color: var(--amber); }
nav a[href="#proyecto"]::after { background: var(--amber); }

nav a[href="#contacto"]:hover { color: var(--terracotta); }
nav a[href="#contacto"]::after { background: var(--terracotta); }

nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

nav span {
  color: var(--border);
  opacity: 0.5;
}

/* BANNER / HERO */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--bg);
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: 
    radial-gradient(
      circle at 30% 50%, 
      transparent 20%, 
      rgba(18, 20, 21, 0.85) 85%
    ),
    linear-gradient(
      0deg, 
      var(--bg) 0%, 
      transparent 25%
    );
}

.hero-inner {
  width: min(1152px, calc(100% - 48px));
  margin-inline: auto;
  padding-block: 100px 80px;
}

.hero-content {
  max-width: 620px;
}

.hero h1 {
  font-size: clamp(38px, 4.5vw, 58px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
}

.hero-content > p {
  margin-top: 18px;
  color: var(--muted);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 28px;
}

/* BOTONES Y ENLACES */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--amber);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 500;
  transition: transform 220ms var(--ease), background-color 220ms ease, box-shadow 220ms ease;
}

.button-project {
  border-color: var(--border);
  background: var(--surface-warm);
  color: var(--amber);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--amber);
  font-size: inherit;
}

/* ASIGNATURA */

.subject {
  padding-block: 80px;
}

.university {
  margin-top: 6px;
  font-size: 14px;
}

.subject h2 {
  margin-top: 20px;
  font-size: clamp(34px, 4vw, 48px);
}

.intro {
  max-width: 680px;
  margin-top: 32px;
  font-size: 17px;
  line-height: 1.8;
}

.subject-button {
  margin-top: 32px;
}

/* TAREAS DE TALLER */

.section {
  position: relative;
  padding-top: 80px;
  padding-bottom: 80px;
}

.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

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

.scroll-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scroll-controls button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  color: var(--muted);
  transition: color 180ms ease, border-color 180ms ease;
}

.scroll-controls button:hover:not(:disabled) {
  color: var(--amber);
  border-color: var(--amber);
}

.task-list {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 8px 2px 32px;
  scrollbar-color: var(--amber) var(--surface);
}

.task-card {
  flex: 0 0 380px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  scroll-snap-align: start;
  transition: transform 280ms var(--ease), border-color 280ms ease, box-shadow 280ms ease;
}

.preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #141719;
  color: var(--muted);
}

.preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(240, 234, 225, 0.04) 1px, transparent 0);
  background-size: 12px 12px;
  pointer-events: none;
  z-index: 1;
}

.preview img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 650ms var(--ease);
}

.task-preview {
  height: 220px;
  border-bottom: 1px solid var(--border);
}

.task-info {
  flex: 1;
  padding: 24px;
  background: var(--surface-warm);
}

.task-open {
  width: 100%;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  color: var(--amber);
}

.task-card.is-hidden {
  display: none !important;
}

/* PROYECTO FINAL */

.project-card {
  margin-top: 32px;
  overflow: hidden;
  border: 1px solid var(--amber);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  transition: transform 280ms var(--ease), border-color 280ms ease;
}

.project-preview {
  height: 320px;
  border-bottom: 1px solid var(--border);
  background: #141719;
}

.project-info {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 36px;
  background: var(--surface-warm);
}

/* FILTROS */

.tasks-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.6;
}

#task-search {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

#task-search:focus {
  border-color: var(--amber);
}

.tag-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  transition: color 200ms ease, border-color 200ms ease;
}

.tag-btn.active {
  background: rgba(232, 141, 57, 0.15);
  color: var(--amber);
  border-color: var(--amber);
}

/* CONTACTO Y FOOTER */

.footer {
  padding-block: 72px 56px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px;
  margin-top: 40px;
}

.contact-grid > div:not(:last-child) {
  border-right: 1px dashed var(--border);
  padding-right: 20px;
}

.contact-role {
  margin-top: 12px;
  color: var(--amber);
  font-weight: 500;
}

.contact-university {
  margin-top: 6px;
  color: var(--muted);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

/* MODAL / LÁMINA */

dialog {
  width: min(840px, calc(100% - 32px));
  max-height: calc(100vh - 64px);
  margin: 32px auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.7);
}

dialog::backdrop {
  background: rgba(18, 20, 21, 0.88);
  backdrop-filter: blur(8px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-warm);
}

.close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.modal-body {
  padding: 32px 36px 36px;
}

.modal-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.detail-preview {
  height: 380px;
  border: 1px solid var(--border);
  background: #141719;
}

.sandbox-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  min-height: 360px;
}

.sandbox-canvas-wrapper {
  background: #0d0f12;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.code-textarea {
  width: 100%;
  min-height: 320px;
  padding: 16px;
  background: #0d0f12;
  border: 1px solid var(--border);
  color: var(--cyan);
  font-family: monospace;
  font-size: 13px;
}

/* CURSOR Y TRAGALUZ */

.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--amber);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  opacity: 0;
  transition: width 220ms var(--ease), height 220ms var(--ease);
}

.custom-cursor.is-active { opacity: 1; }

.custom-cursor.is-hovering {
  width: 44px;
  height: 44px;
  background: rgba(232, 141, 57, 0.85);
  border-color: transparent;
}

.skylight-beam {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  opacity: 0.65;
  mix-blend-mode: screen;
  background: radial-gradient(
    circle at var(--beam-x, 70%) var(--beam-y, 30%),
    rgba(232, 141, 57, 0.18) 0%,
    rgba(216, 195, 157, 0.08) 35%,
    transparent 70%
  );
  filter: blur(30px);
}

/* HOVER Y ANIMACIONES */

@media (hover: hover) and (pointer: fine) {
  .task-card:hover {
    border-color: var(--amber);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 16px rgba(232, 141, 57, 0.18);
  }
}

.reveal.is-pending {
  opacity: 0;
  transform: translateY(22px);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

@media (max-width: 768px) {
  .sandbox-container { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-grid > div:not(:last-child) { border-right: none; border-bottom: 1px dashed var(--border); }
}
