/* ===========================
   UVigo Term Portal - base.css
   =========================== */

/* ---------- Variables ---------- */
:root{
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-serif: "New Baskerville", Georgia, "Times New Roman", serif;

  /* Paleta oficial UVigo */
  --brand: #073349;
  --brand-dark: #000000;
  --accent: #82959D;
  --accent-2: #82959D;
  --accent-warm: #989898;

  /*--bg: #F3F3F3;*/
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F3F3F3;

  --text: #000000;
  --muted: #989898;

  /* Borde suave, usando la paleta oficial */
  --border: rgba(130,149,157,.28);

  --max: 1120px;
  --radius: 0px;
  --radius-sm: 0px;

  --shadow: 0 10px 25px rgba(0,0,0,.08);
  --shadow-sm: 0 6px 14px rgba(0,0,0,.07);

  --speed: 160ms;

  --masthead-h: 116px;
  --logo-h: 36px;

  --mast-bg: #073349;
  --mast-fg: #FFFFFF;
  --mast-fg-muted: rgba(243,243,243,.84);
  --mast-border: rgba(130,149,157,.35);
}

/* ---------- Reset ---------- */
*{ box-sizing: border-box; }
html, body{ height: 100%; }

html{
  font-synthesis: none;
}

body{
  margin: 0;
  font-family: var(--font);
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/*body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: .28;
  background:
    radial-gradient(700px 420px at 85% 10%, rgba(0,178,227,.16), rgba(0,178,227,0) 62%),
    radial-gradient(620px 380px at 15% 85%, rgba(7,51,73,.10), rgba(7,51,73,0) 62%);
}*/
body::before{
  display: none;
}

/*:focus-visible{
  outline: 3px solid rgba(0,178,227,.35);
  outline-offset: 2px;
  border-radius: 0;
}*/
:focus-visible{
  outline: 3px solid rgba(130, 149, 157, .42);
  outline-offset: 2px;
  border-radius: 0;
}
/*Esto esta añadido a posteriori de los nuevos colores en caso de volver a atras se puede eliminar*/
.input:focus, select:focus{
  border-color: rgba(130, 149, 157, .65);
}
@media (prefers-reduced-motion: no-preference){
  *{ scroll-behavior: smooth; }
}

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

/* ---------- Layout ---------- */
.container{
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}
main{ padding: 46px 0 76px; flex: 1; }
.site-footer{ margin-top: auto;}

/* ---------- Header base ---------- */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
/*.site-header::before{
  content:"";
  display:block;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}*/
.site-header::before{
  content:"";
  display:block;
  height: 3px;
  background: linear-gradient(90deg, #073349, #82959D);
}
.nav{ display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav a{
  position: relative;
  padding: 8px 10px;
  border-radius: 0;
  color: var(--muted);
  font-weight: 300;
  text-decoration: none;
  transition: background var(--speed) ease, color var(--speed) ease;
}
/*.nav a:hover{ background: var(--surface-2); color: var(--brand); text-decoration: none; }*/
.nav a:hover{
  background: rgba(130,149,157,.12);
  color: var(--brand);
  text-decoration: none;
}

.nav a[aria-current="page"]{
  color: var(--brand);
  background: rgba(130,149,157,.16);
}
/*.nav a[aria-current="page"]{ color: var(--brand); background: rgba(0,178,227,.10); }*/
.nav a[aria-current="page"]::after{
  content:""; position:absolute;
  left: 10px; right: 10px; bottom: 4px;
  height: 2px; border-radius: 0;
  background: var(--accent); opacity: .9;
}

/* ---------- Tipografía ---------- */
.hero{ padding: 22px 0 8px; }
.hero h1{
  margin: 0;
  font-size: clamp(22px, 2.6vw, 36px);
  line-height: 1.15;
  letter-spacing: 0;
  font-weight: 300;
  color: var(--brand);
}
.hero p{
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 300;
  max-width: 75ch;
}
.section{ padding: 10px 0 26px; }
.muted{ color: var(--muted); font-weight: 300; }
.row{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.badge{
  display:inline-flex; align-items:center;
  height: 18px; padding: 0 8px;
  border-radius: 0; border: 1px solid var(--border);
  background: rgba(0,178,227,.08); color: var(--brand);
  font-weight: 700; font-size: 11px;
}

/* ---------- Inputs / botones ---------- */
.input, select{
  width: 100%;
  padding: 11px 12px;
  border-radius: 0;
  border: 1px solid var(--border);
  background: #fff;
  font: inherit;
  outline: none;
}
.input:focus, select:focus{
  border-color: rgba(0,178,227,.65);
  box-shadow: 0 0 0 4px rgba(0,178,227,.18);
}
/*
.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--speed) ease, transform var(--speed) ease;
}*/
/*.btn.primary{ background: var(--brand); border-color: var(--brand); color: #fff; }*/
.btn{
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--speed) ease, transform var(--speed) ease;
}

.btn.primary{
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn:hover{ filter: brightness(.98); }
.btn-sm{ padding: 5px 12px; font-size: 12px; border-radius: 0; }
@media (prefers-reduced-motion: no-preference){
  .btn:hover{ transform: translateY(-1px); }
}

/* ---------- Cards ---------- */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 18px;
}
.card h2{
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--brand);
}
.empty{
  padding: 14px; border-radius: 0;
  border: 1px dashed rgba(7,51,73,.20);
  background: rgba(255,255,255,.55);
  color: var(--muted);
  font-weight: 400;
}

/* ---------- HOME ---------- */
.home-hero{ min-height: clamp(360px, 60vh, 560px); display: grid; place-items: center; padding: 28px 0; }
.search-wrap{ width: 100%; max-width: 920px; }
.home-hero h1{
  margin: 0;
  font-size: clamp(26px, 3vw, 44px);
  letter-spacing: 0;
  line-height: 1.1;
  font-weight: 300;
  color: var(--brand);
}
.home-hero p{
  margin: 10px 0 18px;
  color: var(--muted);
  font-weight: 300;
  max-width: 75ch;
}

.search-row{ display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-row select{ flex: 0 0 220px; max-width: 220px; }
.search-row input{ flex: 1 1 320px; }
.search-row button{ flex: 0 0 auto; white-space: nowrap; }

.feedback{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 400;
  padding: 12px 0 0;
}

.stats{ display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 14px 0 6px; border-top: 1px solid var(--border); }
@media (min-width: 680px){ .stats{ grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1040px){ .stats{ grid-template-columns: repeat(8, 1fr); } }
.stat{ text-align: center; padding: 8px 6px; }
.stat .num{ 
  font-weight: 700;
  font-size: 22px;
  color: #82959D 
}
.stat .label{
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- Recientes HOME ---------- */
.recent-list{ list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 0; overflow: hidden; background: var(--surface); }
.recent-row{ padding: 16px; border-bottom: 1px solid var(--border); position: relative; display: flex; justify-content: space-between; gap: 16px; }
.recent-row:last-child{ border-bottom: none; }
.recent-row::before{ content:""; position:absolute; left:0; top:0; bottom:0; width: 0; background: var(--accent); transition: width var(--speed) ease; }
.recent-row:hover::before{ width: 4px; }
.recent-row .left{ min-width: 0; }
.recent-row .title{ font-weight: 300; letter-spacing: 0; }
.recent-row .title a{ color: var(--brand); text-decoration: none; }
.recent-row .title a:hover{ text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.recent-row .meta{
  margin-top: 6px;
  color: var(--muted);
  font-weight: 300;
  font-size: 13px;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}
.recent-row .right{
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
  white-space: nowrap;
}
.recent-date{ opacity: .9; }

/* ---------- HOME tiles ---------- */
.quicklinks{ display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 860px){ .quicklinks{ grid-template-columns: repeat(3, 1fr); } }
.tile{
  position: relative; border-radius: 0; padding: 18px;
  min-height: 170px; display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden; color: #fff; text-decoration: none;
  border: 1px solid rgba(255,255,255,.14); box-shadow: var(--shadow-sm);
}
.tile:hover, .tile:focus{ text-decoration: none; }
.tile::before{ content:""; position:absolute; inset:-40px -40px auto auto; width: 180px; height: 180px; background: radial-gradient(circle at center, rgba(255,255,255,.22), rgba(255,255,255,0) 60%); transform: rotate(15deg); pointer-events:none; }
.tile .title{
  position: relative;
  font-weight: 300;
  font-size: 18px;
  letter-spacing: 0;
  margin-bottom: 6px;
  color: #fff;
}
.tile .link{
  position: relative;
  font-weight: 300;
  opacity: .92;
  font-size: 13px;
  color: rgba(255,255,255,.95);
}
.tile .link::after{ content: " →"; display: inline-block; transition: transform var(--speed) ease; }
@media (prefers-reduced-motion: no-preference){
  .tile{ transition: transform var(--speed) ease, filter var(--speed) ease; }
  .tile:hover{ transform: translateY(-2px); filter: brightness(.99); }
  .tile:hover .link::after{ transform: translateX(3px); }
}
.tile.alpha{ background: #073349; }
.tile.topic{ background: #82959D; }
.tile.resources{ background: #989898; }

/* ---------- Term list ---------- */
.term-list{ list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 0; overflow: hidden; background: var(--surface); }

.term-item{
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  position: relative;
  display: grid;
  grid-template-columns: 180px 1fr 1fr auto;
  align-items: center;
  gap: 0 16px;
  transition: background var(--speed) ease;
}
.term-item:last-child{ border-bottom: none; }
.term-item::before{ content:""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width var(--speed) ease; border-radius: 0; }
.term-item:hover{ background: rgba(0,178,227,.025); }
.term-item:hover::before{ width: 3px; }

.term-item-main{ min-width: 0; }
.term-title{
  margin: 0;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.3;
}
.term-title a{ color: var(--brand); text-decoration: none; }
.term-title a:hover{ text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

.term-langs{ display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.term-lang-pill{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tlang{
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--accent);
  flex-shrink: 0;
}

.term-meta-row{
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 300;
  min-width: 0;
}
.term-meta-item{ display: flex; gap: 4px; align-items: baseline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-meta-label{ opacity: .7; flex-shrink: 0; }
.term-org{ font-size: 12px; font-weight: 300; color: var(--muted); }

.term-item-side{ flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end; }
.term-ficha-link{
  font-size: 12px;
  font-weight: 300;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 0;
  border: 1px solid rgba(0,178,227,.25);
  background: rgba(0,178,227,.05);
  transition: background var(--speed) ease, border-color var(--speed) ease;
}
.term-ficha-link:hover{ background: rgba(0,178,227,.12); border-color: rgba(0,178,227,.45); text-decoration: none; }

@media (max-width: 860px){
  .term-item{ grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 6px 12px; }
  .term-item-main{ grid-column: 1; grid-row: 1; }
  .term-item-side{ grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .term-langs{ grid-column: 1; grid-row: 2; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .term-meta-row{ display: none; }
}
@media (max-width: 560px){
  .term-item{ grid-template-columns: 1fr; grid-template-rows: auto; padding: 12px 16px; }
  .term-item-main{ grid-column: 1; grid-row: 1; }
  .term-langs{ grid-column: 1; grid-row: 2; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .term-item-side{ grid-column: 1; grid-row: 3; justify-content: flex-start; margin-top: 4px; }
}

.term-sub{
  margin-top: 6px;
  color: var(--muted);
  font-weight: 300;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.term-meta{ margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.term-meta a{ font-weight: 700; color: var(--accent); text-decoration: none; }
.term-meta a:hover{ text-decoration: underline; }

/* ---------- Ficha ---------- */
.term-grid{ display: grid; gap: 14px; }
@media (min-width: 860px){ .term-grid{ grid-template-columns: 1.2fr .8fr; align-items: start; } }
.lang-cards{ display: grid; gap: 12px; }
@media (min-width: 860px){ .lang-cards{ grid-template-columns: repeat(3, 1fr); } }
.lang-card{ border: 1px solid var(--border); border-radius: 0; background: var(--surface); padding: 14px; }
.lang-card .lang{
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.lang-card .value{
  margin-top: 8px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0;
  color: var(--brand);
}
.meta-card{ border: 1px solid var(--border); border-radius: 0; background: var(--surface); padding: 16px; }
.meta-line{ color: var(--muted); font-weight: 300; font-size: 13px; margin-top: 8px; }
.meta-line strong{ color: var(--brand); font-weight: 700; }
.term-nav{ display:flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.tag{
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(0,178,227,.08);
  color: var(--brand);
  font-weight: 700;
  font-size: 11px;
}
.tag.warm{ background: rgba(255,81,0,.10); border-color: rgba(255,81,0,.20); }
.tag.green{ background: rgba(0,177,137,.12); border-color: rgba(0,177,137,.22); }
.pill{
  display:inline-flex;
  align-items:center;
  height: 22px;
  padding: 0 10px;
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(0,178,227,.10);
  color: var(--brand);
  font-weight: 700;
  font-size: 12px;
}

.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ==========================
   MASTHEAD
   ========================== */

.site-header.is-masthead{
  position: sticky; top: 0; z-index: 60;
  background: var(--mast-bg); border-bottom: none; backdrop-filter: none;
}
.site-header.is-masthead::before{ display:none; }

.header-top{ border-bottom: 1px solid var(--mast-border); }
.header-top-inner{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 10px 0;
}
.top-logo-slot{
  min-width: max-content;
}
.top-nav{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}
.top-nav a{
  white-space: nowrap;
}
.top-nav a:hover{ opacity: 1; background: rgba(255,255,255,.06); }
.top-nav a[aria-current="page"]{ background: rgba(0,0,0,.20); opacity: 1; }
.top-actions{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: max-content;
  white-space: nowrap;
}
.lang-switch{
  display: flex;
  align-items: center;
  gap: 8px;
  border-right: 1px solid var(--mast-border);
  padding-right: 12px;
  flex-wrap: nowrap;
}
.lang-switch a{
  white-space: nowrap;
}
.lang-switch a:hover{ opacity: 1; text-decoration: underline; }

/* ---------- Franja logo/buscador: altura flexible ---------- */
.header-main{
  height: auto;
  min-height: 72px;
  padding: 10px 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.header-main-inner{
  display: grid;
  grid-template-columns: auto 1fr auto; /* logo | buscador | hamburger */
  align-items: center;
  gap: 16px;
  width: 100%;
}
.header-main-inner.no-search{ grid-template-columns: auto 1fr auto; }

/* Marca de texto (sin logo) */
.mast-brand{
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  color: var(--mast-fg);
  text-decoration: none;
}
.mast-brand .brand-line{ font-weight: 700; letter-spacing: .2px; font-size: 22px; }
.mast-brand .brand-sub{ color: var(--mast-fg-muted); font-weight: 400; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

/* ---------- Logo header ---------- */
.mast-brand-logo{
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  height: 72px;
  width: fit-content;
  flex-shrink: 0;
  text-decoration: none;
}

.mast-logo-wrap{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  height: 100%;
  padding-top: 12px;
}

.mast-logo-img{
  display: block;
  height: var(--logo-h);
  width: auto;
  max-width: 260px;
  object-fit: contain;
  flex-shrink: 0;
  transform: translateX(-18px);
}

.mast-logo-sub{
  font-family: var(--font-serif);
  font-size: 10px;
  font-weight: 400;
  color: var(--mast-fg-muted);
  letter-spacing: 0.4px;
  white-space: nowrap;
}

/* ---------- Buscador en el masthead ---------- */
.mast-search{
  width: 100%;
  max-width: 720px;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.header-search{ display:flex; gap: 10px; align-items: center; flex-wrap: nowrap; width: 100%; }

.header-search select{
  flex: 0 0 190px;
  max-width: 190px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 0;
  height: 38px;
  color: var(--brand);
}

.header-search .input{
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 0;
  height: 38px;
}

.btn-search{
  flex-shrink: 0;
  height: 38px;
  padding: 0 18px;
  font-size: 13px;
  border-radius: 0;
  white-space: nowrap;
  border: none;
  background: var(--accent-warm);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: filter var(--speed) ease;
}
.btn-search:hover{ filter: brightness(.94); }

.advanced-link{
  justify-self: center;
  color: var(--mast-fg-muted);
  font-weight: 400;
  font-size: 12px;
  text-decoration: none;
  text-align: center;
  display: block;
  margin-top: 2px;
}
.advanced-link:hover{ color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.mast-mark{ display:flex; justify-content: flex-end; align-items:center; gap: 12px; color: var(--mast-fg); }

/* Masthead color overrides */
.site-header.is-masthead, .site-header.is-masthead a{ color: var(--mast-fg) !important; }
.site-header.is-masthead .top-nav a,
.site-header.is-masthead .lang-switch a,
.site-header.is-masthead .top-actions a{ color: var(--mast-fg) !important; }
.site-header.is-masthead .top-nav a:hover,
.site-header.is-masthead .lang-switch a:hover,
.site-header.is-masthead .top-actions a:hover{ color: #fff !important; }
.site-header.is-masthead .nav a{ color: var(--mast-fg); }
.site-header.is-masthead .nav a:hover{ background: rgba(255,255,255,.08); color: #fff; }
.site-header.is-masthead .nav a[aria-current="page"]{ background: rgba(255,255,255,.12); color: #fff; }
.site-header.is-masthead .nav a[aria-current="page"]::after{ display: none !important; }
.site-header.is-masthead .filter-dd{ flex: 0 0 190px; max-width: 190px; }
.site-header.is-masthead .dd-btn{ padding: 7px 10px; font-size: 13px; border-radius: 0; height: 38px; }
.site-header.is-masthead .dd-main{ color: var(--brand); }
.site-header.is-masthead .dd-menu, .site-header.is-masthead .dd-submenu{ z-index: 120; }

body.has-masthead{ padding-top: var(--masthead-h); }
body.has-masthead .site-header.is-masthead{ position: fixed; left: 0; right: 0; top: 0; transform: translateY(0); transition: transform 220ms ease; will-change: transform; z-index: 80; }
body.has-masthead.masthead-hidden{ padding-top: var(--masthead-h); }
body.has-masthead .site-header.is-masthead.is-hidden{ transform: translateY(-110%); }

/* ==========================
   HAMBURGER BUTTON
   (oculto en desktop, visible en móvil vía media query)
   ========================== */

.ham-btn{
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 0;
  color: var(--mast-fg);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  transition: background var(--speed) ease;
}
.ham-btn:hover{ background: rgba(255,255,255,.10); }

.ham-icon{
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 22px;
}
.ham-icon span{
  display: block;
  height: 2px;
  border-radius: 0;
  background: currentColor;
  transition: transform 240ms ease, opacity 240ms ease;
}

/* Estado abierto: las 3 líneas forman una X */
.ham-btn[aria-expanded="true"] .ham-icon span:nth-child(1){
  transform: translateY(7px) rotate(45deg);
}
.ham-btn[aria-expanded="true"] .ham-icon span:nth-child(2){
  opacity: 0;
}
.ham-btn[aria-expanded="true"] .ham-icon span:nth-child(3){
  transform: translateY(-7px) rotate(-45deg);
}

/* ==========================
   MOBILE DRAWER
   ========================== */

.mobile-drawer{
  display: none;           /* activado en móvil vía media query */
  overflow: hidden;
  background: var(--brand-dark);
  border-top: 1px solid rgba(255,255,255,.10);
  max-height: 0;
  transition: max-height 320ms ease;
}
.mobile-drawer.is-open{ max-height: 520px; }

.mobile-drawer-inner{ padding: 10px 0 18px; }

.mobile-nav-links{ list-style: none; margin: 0; padding: 0; }
.mobile-nav-links a{
  display: block;
  padding: 13px 20px;
  color: var(--mast-fg);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: background var(--speed) ease;
}
.mobile-nav-links a:hover,
.mobile-nav-links a[aria-current="page"]{ background: rgba(255,255,255,.08); text-decoration: none; }

.mobile-drawer-sep{ height: 1px; background: rgba(255,255,255,.12); margin: 8px 20px; }

.mobile-drawer-row{
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  flex-wrap: wrap;
}

.mobile-lang{ display: flex; gap: 8px; align-items: center; }
.mobile-lang a{
  color: var(--mast-fg);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  opacity: .85;
  padding: 5px 10px;
  border-radius: 0;
  border: 1px solid rgba(255,255,255,.22);
  transition: background var(--speed) ease, opacity var(--speed) ease;
}
.mobile-lang a:hover{ opacity: 1; background: rgba(255,255,255,.08); }

.mobile-login-btn{
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.22);
  color: var(--mast-fg);
  font-weight: 700;
  font-family: inherit;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 0;
  cursor: pointer;
  transition: background var(--speed) ease;
}
.mobile-login-btn:hover{ background: rgba(255,255,255,.16); }

/* ==========================
   DROPDOWN
   ========================== */

.filter-dd{ position: relative; flex: 0 0 190px; max-width: 190px; }
.dd-btn{ width: 100%; padding: 8px 10px; border-radius: 0; border: 1px solid var(--border); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 38px; }
.dd-label{ display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.dd-main{
  font-weight: 700;
  font-size: 13px;
  color: var(--brand);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.dd-sub{ font-weight: 400; font-size: 11px; color: var(--muted); }
.dd-caret{ font-weight: 700; color: var(--muted); opacity: .85; }
.dd-menu{ position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px; z-index: 80; background: #fff; border: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow-sm); padding: 6px; }
.dd-item{
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px;
  border-radius: 0;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dd-item:hover{ background: rgba(0,178,227,.08); }
.dd-item[aria-checked="true"]{ background: rgba(0,178,227,.12); }
.dd-sep{ height: 1px; background: var(--border); margin: 6px 0; }
.dd-parent{ position: relative; }
.dd-arrow{ color: var(--muted); }
.dd-submenu{ position: absolute; top: 0; left: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow-sm); padding: 6px; }
@media (max-width: 560px){ .dd-submenu{ left: 0; top: calc(100% + 6px); width: 100%; } }
@media (max-width: 860px){ .filter-dd{ flex: 1 1 220px; max-width: none; } .dd-main{ max-width: none; } }

/* ==========================
   RESPONSIVE MASTHEAD
   ========================== */

/* Tablet: un poco menos de espacio para el dropdown */
@media (max-width: 1100px){
  .header-search select,
  .site-header.is-masthead .filter-dd{
    flex: 0 0 160px;
    max-width: 160px;
  }
}

/* Móvil (<= 860px): ocultar buscador, mostrar hamburguesa */
@media (max-width: 860px){
  /* Ocultar buscador del header */
  .mast-search{ display: none !important; }

  /* Ocultar nav y acciones de la top-bar (van al drawer) */
  .header-top .top-nav,
  .header-top .top-actions{ display: none !important; }

  /* Layout: logo a la izquierda, hamburguesa a la derecha */
  .header-main-inner,
  .header-main-inner.no-search{
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  /* Mostrar hamburguesa y drawer */
  .ham-btn{ display: flex; }
  .mobile-drawer{ display: block; }

  /* Ajustar altura del masthead */
  :root{ --masthead-h: 100px; }
  .header-main{ min-height: 58px; padding: 8px 0; }
}

/* Móvil pequeño (<= 480px): ocultar también la top-bar completa */
@media (max-width: 480px){
  :root{ --masthead-h: 88px; --logo-h: 30px; }
  .header-top{ display: none; }
  .header-main{ min-height: 52px; padding: 6px 0; }
}

/* ==========================
   HOME recientes en grid
   ========================== */

#recent .recent-list{ list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; border: none; border-radius: 0; background: transparent; grid-template-columns: 1fr; }
@media (min-width: 560px){ #recent .recent-list{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 760px){ #recent .recent-list{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 980px){ #recent .recent-list{ grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1220px){ #recent .recent-list{ grid-template-columns: repeat(5, minmax(0, 1fr)); } }
#recent .recent-row{ border: 1px solid var(--border); border-radius: 0; background: var(--surface); padding: 14px 14px 12px; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; min-height: 104px; }
#recent .recent-row::before{ content:""; position:absolute; left:0; top:0; bottom:0; width: 0; background: var(--accent); transition: width var(--speed) ease; }
#recent .recent-row:hover::before{ width: 4px; }
#recent .recent-row .title{ font-weight: 300; letter-spacing: 0; font-size: 15px; line-height: 1.2; }
#recent .recent-row .meta{ margin-top: 0; color: var(--muted); font-weight: 300; font-size: 12px; }
#recent .recent-row .right{ margin-top: auto; display: flex; gap: 8px; align-items: center; justify-content: flex-end; color: var(--muted); font-weight: 400; font-size: 12px; white-space: nowrap; }
#recent .recent-date{ opacity: .9; font-variant-numeric: tabular-nums; }

.page-home .adv-link-wrap .advanced-link{ color: var(--brand) !important; font-weight: 300; }
.page-home .adv-link-wrap .advanced-link:hover{ color: var(--brand-dark) !important; }

.page-home{ padding-top: var(--masthead-h, 116px); }
.page-home .site-header.is-masthead{ position: fixed; left: 0; right: 0; top: 0; transform: translateY(0); transition: transform 220ms ease; will-change: transform; }
.page-home.masthead-hidden{ padding-top: var(--masthead-h, 116px); }
.page-home .site-header.is-masthead.is-hidden{ transform: translateY(-110%); }

/* ==========================
   ÍNDICE ALFABÉTICO
   ========================== */

.alpha-layout{ display: grid; grid-template-columns: 280px 1fr; gap: 22px; align-items: start; }
@media (max-width: 1024px){ .alpha-layout{ grid-template-columns: 240px 1fr; gap: 16px; } }
@media (max-width: 760px){ .alpha-layout{ grid-template-columns: 1fr; } }
.alpha-results-col{ display: grid; gap: 14px; min-width: 0; }
.alpha-rail{ position: sticky; top: calc(var(--masthead-h, 116px) + 16px); }
@media (max-width: 760px){ .alpha-rail{ position: static; } }
.alpha-rail .rail-block{ display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; }
.rail-section{ padding: 14px 16px; }
.rail-section-label{ font-size: 10px; font-weight: 300; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); margin-bottom: 10px; }
.rail-divider{ height: 1px; background: var(--border); }
.alpha-column{ display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
@media (max-width: 560px){ .alpha-column{ grid-template-columns: repeat(5, 1fr); } }
.alphabet button{ width: 100%; padding: 5px 2px; border-radius: 0; border: 1px solid var(--border); background: var(--surface-2); font-family: var(--font); font-weight: 700; font-size: 11px; color: var(--brand); cursor: pointer; transition: background var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease; line-height: 1.5; text-align: center; }
.alphabet button:hover{ background: rgba(0,178,227,.10); border-color: rgba(0,178,227,.40); }
.alphabet button[aria-pressed="true"]{ background: var(--brand); color: #fff; border-color: var(--brand); }
.alpha-state-bar{ display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 0; overflow: hidden; padding: 10px 16px; gap: 16px; }
.alpha-state-item{ display: flex; align-items: center; gap: 8px; font-size: 13px; }
.alpha-state-key{ color: var(--muted); font-weight: 400; }
.alpha-state-val{ color: var(--brand); font-weight: 700; }
.alpha-state-sep{ width: 1px; height: 16px; background: var(--border); }
.rail-clear-btn{ width: 100%; padding: 11px; background: transparent; border: none; border-top: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; font-family: var(--font); transition: background var(--speed) ease, color var(--speed) ease; }
.rail-clear-btn:hover{ background: rgba(7,51,73,.04); color: var(--brand); }
.alpha-topbar{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.alpha-topbar h2{ margin: 0; font-size: 17px; font-weight: 700; color: var(--brand); letter-spacing: 0; }
.alpha-count{ font-size: 13px; font-weight: 400; color: var(--muted); }
.page-alpha main{ padding-bottom: 120px; }
.page-alpha{ padding-top: var(--masthead-h, 116px); transition: padding-top 220ms ease; }
.page-alpha .site-header.is-masthead{ position: fixed; left: 0; right: 0; top: 0; transform: translateY(0); transition: transform 220ms ease; will-change: transform; }
.page-alpha.masthead-hidden{ padding-top: 0; }
.page-alpha .site-header.is-masthead.is-hidden{ transform: translateY(-110%); }

/* ==========================
   ÍNDICE TEMÁTICO
   ========================== */

.topic-layout{ display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px){ .topic-layout{ grid-template-columns: 1fr; } }
.topic-rail{ position: sticky; top: calc(var(--masthead-h, 116px) + 16px); }
@media (max-width: 980px){ .topic-rail{ position: static; } }
.topic-tools{ display: grid; gap: 12px; }
.topic-title{ margin: 0; font-weight: 700; color: var(--brand); letter-spacing: 0; }
.topic-sub{ color: var(--muted); font-weight: 300; font-size: 13px; margin-top: -4px; }
.topic-list{ list-style: none; margin: 0; padding: 6px; border: 1px solid var(--border); border-radius: 0; background: rgba(255,255,255,.75); max-height: calc(100vh - 230px); overflow: auto; }
.topic-item{ display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border-radius: 0; color: var(--brand); font-weight: 700; border: 1px solid transparent; transition: background var(--speed) ease, border-color var(--speed) ease; text-decoration: none; }
.topic-item:hover{ background: rgba(0,178,227,.08); border-color: rgba(0,178,227,.22); text-decoration: none; }
.topic-item[aria-current="true"]{ background: rgba(0,178,227,.12); border-color: rgba(0,178,227,.28); }
.topic-count{ display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 20px; padding: 0 8px; border-radius: 0; border: 1px solid var(--border); background: #fff; color: var(--muted); font-size: 12px; font-weight: 700; }
.topic-panel{ display: grid; gap: 12px; }
.topic-header{ display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topic-actions{ display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topic-crumb{ display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 0; border: 1px solid var(--border); background: rgba(0,178,227,.08); color: var(--brand); font-weight: 700; font-size: 13px; }
.topic-index-tools{ margin-bottom: 12px; }
.topic-index-head{ display:flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topic-index-sub{ margin-top: 6px; color: var(--muted); font-weight: 300; font-size: 13px; }
.topic-index-actions{ display:flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.topic-index{ display:grid; grid-template-columns: 1fr; gap: 16px; margin: 14px 0 18px; }
@media (min-width: 860px){ .topic-index{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.topic-col{ padding: 10px 0; }
.topic-group-title{ margin: 0 0 10px; font-size: 16px; font-weight: 700; letter-spacing: 0; color: var(--brand); padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.topic-links{ list-style: none; margin: 0; padding: 0; display:grid; gap: 8px; }
.topic-links a{ display:flex; align-items:center; justify-content: space-between; gap: 10px; padding: 10px; border-radius: 0; border: 1px solid transparent; color: var(--brand); font-weight: 700; text-decoration: none; background: rgba(255,255,255,.6); }
.topic-links a:hover{ background: rgba(0,178,227,.08); border-color: rgba(0,178,227,.22); }
.topic-pill{ display:inline-flex; align-items:center; justify-content:center; min-width: 34px; height: 20px; padding: 0 8px; border-radius: 0; border: 1px solid var(--border); background: #fff; color: var(--muted); font-weight: 700; font-size: 12px; }
.topic-results{ margin-top: 8px; }
.topic-index-ugr{ display:grid; grid-template-columns: 1fr; gap: 22px; margin: 14px 0 18px; }
@media (min-width: 860px){ .topic-index-ugr{ grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.topic-links-plain{ list-style: none; margin: 0; padding: 0; display:grid; gap: 8px; }
.topic-links-plain a{ display:flex; align-items:center; justify-content: space-between; gap: 10px; padding: 10px 0; color: var(--accent); font-weight: 300; text-decoration: none; border-bottom: 1px solid rgba(7,51,73,.08); }
.topic-links-plain a:hover{ color: var(--brand); text-decoration: underline; text-underline-offset: 3px; border-bottom-color: rgba(0,178,227,.35); }
.page-topic main{ padding-bottom: 110px; }
.topic-terms{ margin-top: 10px; margin-bottom: 14px; }
.topic-link[aria-expanded="true"]{ color: var(--brand); }
.topic-links-plain li{ padding: 0; }
.page-topic .topic-links-plain{ list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.page-topic .topic-links-plain li{ margin: 0; padding: 0; }
.page-topic a.topic-link{ display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; color: var(--accent); font-weight: 700; text-decoration: none; border-bottom: 1px solid rgba(7,51,73,.08); }
.page-topic a.topic-link:hover{ color: var(--brand); text-decoration: underline; text-underline-offset: 3px; border-bottom-color: rgba(0,178,227,.35); }
.page-topic a.topic-link::after{ content: "▾"; font-weight: 700; color: rgba(71,84,103,.9); transform: rotate(-90deg); transition: transform var(--speed) ease; }
.page-topic a.topic-link[aria-expanded="true"]::after{ transform: rotate(0deg); }
.page-topic .topic-terms{ margin: 8px 0 12px; padding: 12px 12px 12px 14px; border: 1px solid var(--border); border-radius: 0; background: rgba(255,255,255,.8); position: relative; }
.page-topic .topic-terms::before{ content:""; position:absolute; left:0; top:0; bottom:0; width:4px; border-radius: 0; background: var(--accent); opacity: .9; }
.page-topic .topic-terms .alpha-topbar{ margin: 0 0 10px !important; padding: 0; }
.page-topic .topic-terms .alpha-topbar .muted{ font-size: 12px; font-weight: 700; letter-spacing: .2px; text-transform: uppercase; }
.page-topic .topic-terms .term-list{ border: none; border-radius: 0; background: transparent; }
.page-topic .topic-terms .term-item{ padding: 10px 0; border-bottom: 1px solid rgba(7,51,73,.08); }
.page-topic .topic-terms .term-item:last-child{ border-bottom: none; }
.page-topic .topic-terms .term-title{ font-size: 14px; margin: 0; }
.page-topic .topic-terms .term-title a{ color: var(--brand); font-weight: 700; text-decoration: none; }
.page-topic .topic-terms .term-title a:hover{ text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.page-topic .topic-terms .term-sub{ margin-top: 4px; font-size: 12px; color: var(--muted); font-weight: 300; }
.page-topic .topic-terms .term-meta{ margin-top: 6px; font-size: 12px; }
.page-topic .topic-terms .term-meta a{ color: var(--accent); font-weight: 700; text-decoration: none; }
.page-topic .topic-terms .term-meta a:hover{ text-decoration: underline; text-underline-offset: 3px; }
.page-topic .topic-index-ugr{ display: grid; grid-template-columns: 1fr; gap: 28px; margin: 14px 0 18px; }
@media (min-width: 860px){ .page-topic .topic-index-ugr{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 38px; } }
.page-topic .topic-group-title{ margin: 0 0 14px; font-size: 18px; font-weight: 700; letter-spacing: 0; color: var(--brand); padding-bottom: 12px; border-bottom: 1px solid rgba(7,51,73,.12); }
.page-topic .topic-tree{ list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.page-topic .topic-leaf-link, .page-topic .topic-node summary{ color: var(--accent); font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.25; }
.page-topic .topic-leaf-link:hover, .page-topic .topic-node summary:hover{ color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.page-topic .topic-node summary{ list-style: none; }
.page-topic .topic-node summary::-webkit-details-marker{ display:none; }
.page-topic .topic-node summary::before{ content: "▸"; display: inline-block; width: 16px; color: rgba(71,84,103,.9); transform: translateY(-1px); margin-right: 6px; }
.page-topic .topic-node details[open] > summary::before{ content: "▾"; }
.page-topic .topic-node ul.topic-tree{ margin-top: 10px; padding-left: 26px; gap: 8px; }
.page-topic .topic-node ul.topic-tree .topic-leaf-link{ font-weight: 400; font-size: 13px; }
.page-topic .topic-node summary{ font-size: 14px; }
.page-topic > main .topic-leaf-link{ font-size: 14px; }

/* ==========================
   RECURSOS
   ========================== */

.resource-layout{ display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px){ .resource-layout{ grid-template-columns: 1fr; } }
.resource-rail{ position: sticky; top: calc(var(--masthead-h, 116px) + 16px); }
@media (max-width: 980px){ .resource-rail{ position: static; } }
.resource-tools{ display: grid; gap: 12px; }
.resource-title{ margin: 0; font-weight: 700; color: var(--brand); letter-spacing: 0; }
.resource-sub{ color: var(--muted); font-weight: 300; font-size: 13px; margin-top: -4px; }
.filters{ display: grid; gap: 12px; }
.filter-row{ display: grid; gap: 8px; }
.filter-label{ color: var(--muted); font-weight: 700; font-size: 13px; }
.chips{ display: flex; flex-wrap: wrap; gap: 8px; }
.chip{ display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 0; border: 1px solid var(--border); background: rgba(255,255,255,.8); color: var(--brand); font-weight: 700; font-size: 13px; cursor: pointer; user-select: none; transition: background var(--speed) ease, border-color var(--speed) ease; }
.chip:hover{ background: rgba(0,178,227,.08); border-color: rgba(0,178,227,.25); }
.chip[aria-pressed="true"]{ background: rgba(0,178,227,.14); border-color: rgba(0,178,227,.35); }
.resource-panel{ display: grid; gap: 12px; }
.resource-header{ display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.resource-list{ list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 0; overflow: hidden; background: var(--surface); }
.resource-item{ padding: 16px; border-bottom: 1px solid var(--border); position: relative; }
.resource-item:last-child{ border-bottom: none; }
.resource-item::before{ content:""; position:absolute; left:0; top:0; bottom:0; width: 0; background: var(--accent); transition: width var(--speed) ease; }
.resource-item:hover::before{ width: 4px; }
.resource-item h3{ margin: 0; font-weight: 700; letter-spacing: 0; }
.resource-item h3 a{ color: var(--brand); text-decoration: none; }
.resource-item h3 a:hover{ text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.resource-item .desc{ margin-top: 8px; color: var(--muted); font-weight: 300; font-size: 13px; }
.resource-item .meta{ margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.res-tools{ margin-bottom: 12px; }
.res-tools-head{ display:flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.res-tools-sub{ margin-top: 6px; color: var(--muted); font-weight: 300; font-size: 13px; }
.res-tools-actions{ display:flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.res-field{ min-width: 220px; }
.res-field:first-child{ min-width: min(420px, 100%); }
.res-check{ display:flex; align-items:center; gap: 8px; color: var(--muted); font-weight: 400; user-select: none; }
.res-jump{ display:flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.res-jump a{ display:inline-flex; align-items:center; height: 28px; padding: 0 10px; border-radius: 0; border: 1px solid var(--border); background: rgba(255,255,255,.75); color: var(--brand); font-weight: 700; font-size: 13px; text-decoration: none; }
.res-jump a:hover{ background: rgba(0,178,227,.10); text-decoration: none; }
.res-directory{ display:grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 980px){ .res-directory{ grid-template-columns: 1fr 1fr; } }
.res-group{ padding: 0; }
.res-group-title{ margin: 0 0 8px; font-size: 16px; font-weight: 700; letter-spacing: 0; color: var(--brand); padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.res-links{ list-style: none; margin: 0; padding: 0; }
.res-link{ padding: 12px 0; border-bottom: 1px solid rgba(7,51,73,.08); }
.res-link:last-child{ border-bottom: none; }
.res-link a{ font-weight: 700; color: var(--accent); text-decoration: none; }
.res-link a:hover{ color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.res-desc{ margin-top: 6px; color: var(--muted); font-weight: 300; font-size: 13px; }
.res-meta{ margin-top: 8px; display:flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ==========================
   BÚSQUEDA AVANZADA
   ========================== */

.adv-card{ padding: 18px; }
.adv-grid{ display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 860px){ .adv-grid{ grid-template-columns: 1fr 1fr 1fr; align-items: end; } }
.adv-field label{ display:block; margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.adv-span-2{ grid-column: span 1; }
.adv-span-3{ grid-column: span 1; }
@media (min-width: 860px){ .adv-span-2{ grid-column: span 2; } .adv-span-3{ grid-column: span 3; } }
.adv-actions{ display:flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 4px; }
.adv-check{ display:flex; gap: 10px; align-items: center; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }
.page-adv main{ padding-bottom: 140px; }
@media (min-width: 860px){
  .page-adv .adv-grid{ grid-template-columns: repeat(3, 1fr); }
  .page-adv .adv-grid .adv-field:nth-child(7){ grid-column: 2; grid-row: 3; }
  .page-adv .adv-grid .adv-field:nth-child(9){ grid-column: 3; grid-row: 3; }
  .page-adv .adv-grid .adv-actions{ grid-column: 1 / -1; grid-row: 4; }
}

/* ==========================
   FICHA DE TÉRMINO
   ========================== */

.page-term main{ padding-top: 64px; padding-bottom: 140px; }
.page-term.has-masthead{ padding-top: calc(var(--masthead-h) + 22px); }
.page-term .hero{ padding-top: 32px; }

/* ==========================
   FOOTER
   ========================== */

/*.site-footer{ border-top: none; background: var(--brand); color: rgba(255,255,255,.92); padding: 34px 0 16px; }
.footer-inner{ display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 980px){ .footer-inner{ grid-template-columns: 1fr; } }
.footer-brand{ display:flex; align-items:flex-start; justify-content: space-between; gap: 18px; }
.footer-brand .uvigo-wordmark{ font-family: var(--font-serif); font-weight: 700; letter-spacing: .2px; font-size: 28px; line-height: 1.1; color: #fff; }
.footer-logos{ display: flex; gap: 16px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.footer-logo{ width: 54px; height: 34px; border-radius: 0; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); display:flex; align-items:center; justify-content:center; font-weight: 700; color: rgba(255,255,255,.85); font-size: 12px; }
.footer-cols{ display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
@media (max-width: 980px){ .footer-cols{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px){ .footer-cols{ grid-template-columns: 1fr; } }
.footer-col{ display: grid; gap: 10px; }
.footer-item{ display: grid; gap: 4px; font-size: 14px; }
.footer-item .label{ font-weight: 700; text-transform: uppercase; letter-spacing: .4px; font-size: 12px; color: rgba(255,255,255,.92); display:flex; align-items:center; gap: 10px; }
.footer-item .label::before{ content: "›"; font-weight: 700; opacity: .9; }
.footer-item a{ color: rgba(255,255,255,.86); text-decoration: none; font-weight: 700; }
.footer-item a:hover{ color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer-item .sub{ color: rgba(255,255,255,.78); font-weight: 400; }
.footer-social{ display:flex; gap: 9px; align-items:center; flex-wrap: wrap; justify-content: flex-end; margin-top: 14px; }
.footer-social a{ width: 34px; height: 34px; border-radius: 0; border: 1px solid rgba(255,255,255,.22); display:flex; align-items:center; justify-content:center; color: rgba(255,255,255,.9); text-decoration:none; font-weight: 700; background: rgba(255,255,255,.06); transition: transform var(--speed) ease, background var(--speed) ease; }
.footer-social a:hover{ background: rgba(255,255,255,.10); transform: translateY(-1px); }
.footer-bottom{ margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14); display:flex; align-items:center; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: rgba(255,255,255,.75); font-weight: 400; font-size: 13px; }
.footer-legal{ display:flex; gap: 12px; flex-wrap: wrap; }
.footer-legal a{ color: rgba(255,255,255,.75); text-decoration: none; }
.footer-legal a:hover{ color: #fff; text-decoration: underline; text-underline-offset: 3px; }*/

/* ==========================
   FOOTER
   ========================== */

.site-footer{
  border-top: none;
  background: var(--brand);
  color: rgba(255,255,255,.92);
  padding: 28px 0 16px;
  margin-top: auto;
}

/* Fila superior */
.footer-top-row{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 10px;
}

.footer-brand{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.footer-brand .uvigo-wordmark{
  font-family: var(--font-serif);
  font-weight: 300;
  letter-spacing: .2px;
  font-size: 28px;
  line-height: 1.1;
  color: #fff;
}

.footer-brand .uvigo-wordmark span{
  font-weight: 400;
}

.footer-rule{
  height: 1px;
  background: rgba(255,255,255,.14);
  margin: 0 0 18px;
}

/* Columnas */
.footer-cols{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px;
  align-items: stretch;
}

.footer-col{
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* La columna social empuja redes abajo */
.footer-col--social .footer-social{
  margin-top: auto;
}

/* Item base */
.footer-item{
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-size: 14px;
}

/* Cabecera con icono SVG + label */
.footer-item--head{
  gap: 4px;
}

.footer-item-head{
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #fff;
}

.footer-icon svg{
  display: block;
  width: 16px;
  height: 16px;
}

/* Label: quitamos la flecha vieja */
.footer-item .label{
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-size: 12px;
  color: rgba(255,255,255,.92);
  margin: 0;
}

.footer-item .label::before{
  content: none !important;
}

/* Texto alineado bajo la cabecera */
.footer-item .sub{
  color: rgba(255,255,255,.78);
  font-weight: 400;
  margin-left: 24px;
  line-height: 1.3;
}

.footer-item > a{
  color: rgba(255,255,255,.86);
  text-decoration: none;
  font-weight: 400;
  margin-left: 24px;
  line-height: 1.3;
  word-break: break-word;
}

.footer-item > a:hover{
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Enlaces con flecha */
.footer-item--arrow{
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.footer-item--arrow::before{
  content: "›";
  color: rgba(255,255,255,.9);
  font-size: 18px;
  line-height: 1;
  transform: translateY(-1px);
  flex-shrink: 0;
}

.footer-item--arrow a{
  margin-left: 0;
  font-weight: 300;
}

/* Campus do Mar con símbolo especial */
.footer-item--star{
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.footer-item--star::before{
  content: "✦";
  color: rgba(255,255,255,.92);
  font-size: 11px;
  line-height: 1;
  transform: translateY(4px);
  flex-shrink: 0;
}

.footer-item--star a{
  margin-left: 0;
  font-weight: 300;
}

/* Redes */
.footer-social{
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-start;
  padding-top: 6px;
}

.footer-social-link{
  width: 30px;
  height: 30px;
  border-radius: 0;
  /*border: 1px solid rgba(255,255,255,.22);*/
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.9);
  text-decoration: none;
  /*background: rgba(255,255,255,.06);*/
  transition: transform var(--speed) ease, background var(--speed) ease, border-color var(--speed) ease;
  flex-shrink: 0;
}

.footer-social-link svg{
  width: 15px;
  height: 15px;
  display: block;
}

.footer-social-link:hover{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.34);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Barra legal */
.footer-bottom{
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: rgba(255,255,255,.75);
  font-weight: 400;
  font-size: 13px;
}

.footer-legal{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-legal a{
  color: rgba(255,255,255,.75);
  text-decoration: none;
}

.footer-legal a:hover{
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Responsive */
@media (max-width: 980px){
  .footer-cols{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 26px;
  }
}

@media (max-width: 560px){
  .footer-cols{
    grid-template-columns: 1fr;
  }

  .footer-social{
    flex-wrap: wrap;
  }

  .footer-bottom{
    flex-direction: column;
    align-items: flex-start;
  }
}


/* Fila superior */
.footer-top-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 10px;
}

.footer-brand{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.footer-brand .uvigo-wordmark{
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: .2px;
  font-size: 28px;
  line-height: 1.1;
  color: #fff;
}

.footer-brand .uvigo-wordmark span{
  font-weight: 400;
}

/* Logos superiores derecha */
.footer-badges{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  flex-wrap: nowrap;
  margin-left: auto;
  /*min-width: 0;*/
}

.footer-badge{
  display: block;
  width: auto;
  /*height: 26px;
  max-width: 110px;*/
  object-fit: contain;
  flex-shrink: 0;
  opacity: 1;
}

.footer-badges a {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Ajustes finos por logo si uno viene raro */
.footer-badges a:nth-child(1) .footer-badge {
  height: 43px;
  max-width: 180px;
}

.footer-badges a:nth-child(2) .footer-badge {
  height: 68px;
  max-width: 160px;
}

.footer-badges a:nth-child(3) .footer-badge {
  height: 98px;
  max-width: 190px;
}

.footer-badges a:nth-child(4) .footer-badge{
  height: 43px;
  max-width: 180px;
}

.footer-badge-athena .footer-badge {
  height: 55px;
  max-width: 200px;
}

/* Responsive */
@media (max-width: 980px){
  .footer-top-row{
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .footer-badges{
    justify-content: flex-start;
    margin-left: 0;
  }
}

@media (max-width: 560px){
  .footer-badges{
    gap: 10px;
    flex-wrap: wrap;
  }

  .footer-badge{
    height: 20px;
    max-width: 84px;
  }

  .footer-badge:nth-child(1){
    height: 19px;
    max-width: 92px;
  }

  .footer-badge:nth-child(2){
    height: 18px;
    max-width: 82px;
  }

  .footer-badge:nth-child(3){
    height: 21px;
    max-width: 72px;
  }
}


/* ==========================
   POPUP LOGIN
   ========================== */

.login-overlay{ position: fixed; inset: 0; z-index: 200; background: rgba(7,51,73,.45); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: overlayIn var(--speed) ease; }
.login-overlay[hidden]{ display: none !important; }
@keyframes overlayIn{ from{ opacity:0; } to{ opacity:1; } }

.login-popup{ background: var(--surface); border-radius: 0; border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(7,51,73,.22); padding: 28px 28px 24px; width: 100%; max-width: 380px; position: relative; animation: popupIn 200ms ease; }
@keyframes popupIn{ from{ opacity:0; transform: translateY(10px) scale(.98); } to{ opacity:1; transform: translateY(0) scale(1); } }

.login-popup h2{ margin: 0 0 4px; font-size: 20px; font-weight: 700; color: var(--brand); letter-spacing: 0; }
.login-popup-close{ position: absolute; top: 14px; right: 14px; background: transparent; border: none; font-size: 16px; color: var(--muted); cursor: pointer; width: 30px; height: 30px; border-radius: 0; display: flex; align-items: center; justify-content: center; transition: background var(--speed) ease, color var(--speed) ease; font-family: inherit; }
.login-popup-close:hover{ background: var(--surface-2); color: var(--brand); }
.login-field{ display: grid; gap: 5px; margin-bottom: 12px; }
.login-field label{ font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.login-error{ margin-bottom: 12px; padding: 10px 12px; border-radius: 0; background: rgba(255,81,0,.08); border: 1px solid rgba(255,81,0,.22); color: #7a2500; font-size: 13px; font-weight: 400; }
.login-error[hidden]{ display: none; }
.login-popup.is-error{ animation: shake 320ms ease; }
@keyframes shake{ 0%,100%{ transform: translateX(0); } 20%{ transform: translateX(-6px); } 40%{ transform: translateX(6px); } 60%{ transform: translateX(-4px); } 80%{ transform: translateX(4px); } }

.page-home{
  background: #FFFFFF;
}

.home-hero{
  min-height: clamp(360px, 60vh, 560px);
  display: grid;
  place-items: center;
  padding: 34px 0 28px;
  background: #FFFFFF;
}

.page-home .home-hero .card{
  position: relative;
  background: #FFFFFF;
  border: 1px solid rgba(130,149,157,.30);
  box-shadow: 0 14px 32px rgba(0,0,0,.06);
  padding: 22px 18px 18px;
}

.page-home .home-hero .card::before{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, #073349, #82959D);
}

.page-home .home-hero .card h2{
  margin: 0 0 14px;
}

.page-home .search-row{
  gap: 12px;
  align-items: stretch;
}

.page-home .search-row .filter-dd{
  flex: 0 0 190px;
  max-width: 190px;
}

.page-home .search-row .input{
  min-height: 48px;
}

.page-home .search-row .btn.primary{
  min-height: 48px;
  padding: 0 20px;
}

.page-home .adv-link-wrap{
  margin-top: 12px;
}

.page-home .home-hero p{
  color: rgba(0,0,0,.58);
  max-width: 62ch;
}

/* ==========================
   ÍNDICE TEMÁTICO · ACORDEÓN POR ORGANISMO
   ========================== */

.topic-org-accordion{
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.topic-org-block{
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.topic-org-summary{
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  background: linear-gradient(90deg, rgba(7,51,73,.03), rgba(130,149,157,.08));
  transition: background var(--speed) ease;
}

.topic-org-summary::-webkit-details-marker{
  display: none;
}

.topic-org-summary:hover{
  background: linear-gradient(90deg, rgba(7,51,73,.05), rgba(130,149,157,.12));
}

.topic-org-block[open] .topic-org-summary{
  border-bottom: 1px solid var(--border);
}

.topic-org-heading{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.topic-org-name{
  font-size: 18px;
  font-weight: 300;
  line-height: 1.2;
  color: var(--brand);
}

.topic-org-count{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(130,149,157,.34);
  background: rgba(130,149,157,.10);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.topic-org-caret{
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform var(--speed) ease;
  flex-shrink: 0;
  margin-top: -2px;
}

.topic-org-block[open] .topic-org-caret{
  transform: rotate(225deg);
  margin-top: 2px;
}

.topic-org-panel{
  padding: 10px 18px 16px;
  background: var(--surface);
}

.topic-links-plain--inside{
  gap: 0;
}

.topic-links-plain--inside li{
  margin: 0;
  padding: 0;
}

.topic-links-plain--inside a{
  padding: 12px 0;
  border-bottom: 1px solid rgba(130,149,157,.20);
}

.topic-links-plain--inside li:last-child a{
  border-bottom: none;
}

@media (max-width: 640px){
  .topic-org-summary{
    padding: 14px 14px;
  }

  .topic-org-name{
    font-size: 16px;
  }

  .topic-org-panel{
    padding: 8px 14px 14px;
  }
}

@media (min-width: 860px){
  .topic-org-accordion{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.top-login-btn{
  background: transparent;
  border: none;
  color: var(--mast-fg);
  font-weight: 300;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  opacity: .92;
  padding: 0;
}

.top-login-btn:hover{
  opacity: 1;
}

.mobile-drawer-brand{
  padding: 14px 20px 10px;
  display: flex;
  align-items: center;
}

.mobile-uvigo-logo-link{
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.mobile-uvigo-logo{
  display: block;
  height: 24px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
