/* ========================================
   Q2001B · Ensayo de presentación
   Editorial scientific notebook aesthetic
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght,SOFT@9..144,300..700,0..100&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #f7f3ea;
  --bg-card: #fdfaf3;
  --ink: #1a1815;
  --ink-soft: #4a463f;
  --ink-faint: #8a847a;
  --rule: #d9d0bf;
  --rule-soft: #e6decd;
  --accent: #0d6e7a;
  --accent-deep: #075660;
  --accent-soft: #d3e6e7;
  --ochre: #b8732e;
  --ochre-soft: #f0d9b8;
  --warn: #a13d2a;
  --good: #3f7a3f;
  --shadow-paper: 0 1px 0 rgba(26,24,21,0.04), 0 4px 24px -8px rgba(26,24,21,0.08);
  --shadow-paper-lift: 0 1px 0 rgba(26,24,21,0.06), 0 12px 40px -12px rgba(26,24,21,0.18);
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

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

html, body { font-size: 16px; overflow-x: hidden; max-width: 100%; }

body {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(26,24,21,0.045) 1px, transparent 0);
  background-size: 24px 24px;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper grain overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  z-index: 1;
}

main, header, footer { position: relative; z-index: 2; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ===== Typography ===== */

.display {
  font-family: var(--serif);
  font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.section-num {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

h1 { font-family: var(--serif); font-weight: 400; font-variation-settings: "opsz" 144; }
h2 { font-family: var(--serif); font-weight: 500; font-variation-settings: "opsz" 48; letter-spacing: -0.01em; }
h3 { font-family: var(--sans); font-weight: 500; font-size: 1rem; letter-spacing: 0.01em; }

/* ===== Header ===== */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--rule);
  background: rgba(247, 243, 234, 0.85);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}

.site-header .brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.brand-mark {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
}

.brand-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  letter-spacing: -0.005em;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  flex-wrap: wrap;
  justify-content: flex-end;
}
.user-pill .user-name { white-space: nowrap; }

.user-pill .matricula {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 0.2rem 0.5rem;
  border-radius: 2px;
}

button.ghost, .btn-ghost {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
button.ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ===== Buttons ===== */

button.primary, .btn-primary {
  background: var(--accent);
  color: #fdfaf3;
  border: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.92rem;
  padding: 0.85rem 1.6rem;
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
button.primary:hover, .btn-primary:hover { background: var(--accent-deep); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { background: var(--rule); cursor: not-allowed; color: var(--ink-faint); }

/* ===== Forms ===== */

.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

input[type="text"], input[type="password"], textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 1.05rem;
  color: var(--ink);
  padding: 0.6rem 0;
  transition: border-color 0.2s;
  outline: none;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
  border-bottom-color: var(--accent);
}

textarea {
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.85rem 1rem;
  resize: vertical;
  min-height: 160px;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg-card);
}

/* ===== Cards ===== */

.paper {
  background: var(--bg-card);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  box-shadow: var(--shadow-paper);
  padding: 2rem;
}

/* ===== Tabs ===== */

.tabs {
  display: flex;
  gap: 2rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

.tab {
  background: transparent;
  border: none;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 400;
  font-variation-settings: "opsz" 36;
  color: var(--ink-faint);
  padding: 0.8rem 0;
  cursor: pointer;
  position: relative;
  letter-spacing: -0.005em;
  transition: color 0.2s;
}
.tab .tab-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  margin-right: 0.5rem;
  letter-spacing: 0.1em;
  vertical-align: super;
}
.tab.active { color: var(--ink); }
.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}
.tab:hover:not(.active) { color: var(--ink-soft); }

/* ===== Animations ===== */

@keyframes blink-dot {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

.processing-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink-dot 1.4s infinite both;
}
.processing-dots span:nth-child(2) { animation-delay: 0.2s; }
.processing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.shimmer {
  background: linear-gradient(90deg, transparent, rgba(13,110,122,0.12), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

.fade-in { animation: fade-in-up 0.5s ease forwards; }

/* ===== Utility ===== */

.hairline { height: 1px; background: var(--rule); border: none; margin: 2rem 0; }
.muted { color: var(--ink-faint); }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }
.center { text-align: center; }

/* ===== Mobile ===== */

@media (max-width: 720px) {
  .site-header {
    padding: 0.85rem 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .site-header .brand { justify-content: flex-start; }
  .user-pill { justify-content: flex-start; font-size: 0.8rem; }
  .paper { padding: 1.25rem; }
  .tabs { gap: 1.25rem; }
  .tab { font-size: 1.15rem; }
  .brand-title { font-size: 0.95rem; }
  .floating-print { bottom: 1rem; right: 1rem; padding: 0.7rem 1rem; font-size: 0.8rem; }
}

/* ===== Print ===== */

@media print {
  body { background: white; }
  body::before, .site-header, .tabs, .no-print, .floating-print { display: none !important; }
  .paper { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  main { padding: 0 !important; }
  .criterio-card { page-break-inside: avoid; }
}
