/* ==========================================================================
   Noctara — Devlog
   Cuadrícula de entradas (/devlog/) y página de cada post (/devlog/<slug>/).
   Mismo lenguaje que la portada: plata sobre negro, EB Garamond, líneas
   finas que se desvanecen y algo de luz cálida de vela.
   ========================================================================== */

:root {
  --void: #040308;
  --panel: #0a090d;
  --silver: #e8e5e0;
  --silver-dim: #a9a5a0;
  --line: rgba(214, 210, 204, 0.42);
  --line-soft: rgba(214, 210, 204, 0.16);
  --warm: rgba(255, 196, 120, 1);
  --serif: "EB Garamond", "Noto Serif SC", Georgia, serif;
}

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

html { scrollbar-color: #2a282c var(--void); }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 70% 420px at 50% -60px, rgba(255, 170, 90, 0.10), rgba(0, 0, 0, 0) 70%),
    var(--void);
  background-repeat: no-repeat;
  color: var(--silver);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 50;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3%, 2%); }
  40%  { transform: translate(2%, -3%); }
  60%  { transform: translate(-2%, -1%); }
  80%  { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ornament {
  display: block;
  width: min(300px, 80%);
  height: auto;
  margin: 14px auto 0;
  color: var(--silver-dim);
  overflow: visible;
}

.ornament rect { stroke: none; }
.ornament__solid { fill: currentColor; }

/* --------------------------------------------------------------------------
   Barra superior: Inicio · NOCTARA · Devlog
   -------------------------------------------------------------------------- */
.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  height: 84px;
  padding: 0 clamp(16px, 4vw, 56px);
}

/* Línea inferior que se desvanece hacia los lados, con un rombo central */
.topbar::before,
.topbar::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.topbar::before {
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line) 30%, var(--line) 70%, transparent);
}

.topbar::after {
  bottom: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  background: var(--silver-dim);
  transform: rotate(45deg);
}

.topbar__brand {
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--silver);
  transition: text-shadow 0.4s ease;
}

.topbar__brand:hover,
.topbar__brand:focus-visible { text-shadow: 0 0 18px rgba(255, 214, 160, 0.45); outline: none; }

.topbar__nav {
  justify-self: start;
  display: flex;
  gap: clamp(18px, 2.4vw, 32px);
}

.topbar__link {
  font-size: 0.8rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--silver-dim);
  padding: 8px 0;
  transition: color 0.3s ease;
}

.topbar__link:hover,
.topbar__link:focus-visible { color: #ffffff; outline: none; }

/* Selector de idioma (ES / EN / ZH), igual que el de la portada */
.lang {
  position: relative;
  justify-self: end;
  z-index: 10;
}

.lang__toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px 0 15px;
  border: 1px solid var(--line);
  outline: 1px solid var(--line-soft);
  outline-offset: 3px;
  background: rgba(8, 8, 11, 0.7);
  color: #c9c5c0;
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  cursor: pointer;
  transition: color 0.3s ease, box-shadow 0.3s ease, outline-color 0.3s ease;
}

.lang__toggle:hover,
.lang__toggle:focus-visible,
.lang.is-open .lang__toggle {
  color: #ffffff;
  outline-color: var(--line);
  box-shadow: 0 0 16px rgba(255, 244, 228, 0.1);
}

.lang__chevron {
  width: 9px;
  height: 6px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  transition: transform 0.3s ease;
}

.lang.is-open .lang__chevron { transform: rotate(180deg); }

.lang__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: -4px;
  min-width: 150px;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, rgba(14, 14, 18, 0.97), rgba(6, 6, 9, 0.98));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.lang__menu[hidden] { display: none; }

.lang__option {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--silver-dim);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-align: left;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.lang__option span {
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.lang__option:hover,
.lang__option:focus-visible {
  color: #ffffff;
  background: rgba(232, 229, 224, 0.07);
  outline: none;
}

.lang__option[aria-current="true"] { color: var(--silver); }

.lang__option[aria-current="true"]::after {
  content: "";
  align-self: center;
  width: 5px;
  height: 5px;
  margin-left: auto;
  background: var(--silver-dim);
  transform: rotate(45deg);
}

/* --------------------------------------------------------------------------
   Cuadrícula de entradas
   -------------------------------------------------------------------------- */
.devlog {
  flex: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(40px, 7vh, 72px) clamp(16px, 3vw, 40px) 80px;
}

.devlog__heading { text-align: center; margin-bottom: clamp(36px, 6vh, 60px); }

.devlog__title {
  font-weight: 400;
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  text-transform: uppercase;
}

.devlog__lead,
.devlog__empty {
  margin-top: 14px;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--silver-dim);
}

.devlog__empty { text-align: center; }

.grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: clamp(20px, 2.4vw, 28px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line-soft);
  background: linear-gradient(to bottom, rgba(16, 15, 19, 0.92), rgba(8, 8, 11, 0.96));
  text-decoration: none;
  transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

/* Esquinas en escuadra, como el marco del formulario de la portada */
.card::before,
.card::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 9px;
  height: 9px;
  border: 1px solid var(--line);
  pointer-events: none;
  transition: border-color 0.35s ease;
}

.card::before { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.card::after  { bottom: -5px; right: -5px; border-left: 0; border-top: 0; }

.card:hover,
.card:focus-visible {
  border-color: var(--line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 32px rgba(255, 196, 120, 0.06);
  transform: translateY(-3px);
  outline: none;
}

.card:hover::before,
.card:hover::after,
.card:focus-visible::before,
.card:focus-visible::after { border-color: rgba(232, 229, 224, 0.8); }

.card__media {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  background: #070609;
}

/* Velo cálido que aparece al pasar por encima, como si acercaras la vela */
.card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 60%, rgba(255, 180, 100, 0.16), rgba(0, 0, 0, 0) 65%),
              linear-gradient(to top, rgba(4, 3, 8, 0.55), rgba(4, 3, 8, 0) 45%);
  opacity: 0.55;
  transition: opacity 0.5s ease;
}

.card:hover .card__media::after,
.card:focus-visible .card__media::after { opacity: 1; }

.card__cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) brightness(0.88);
  transition: transform 0.8s ease, filter 0.5s ease;
}

.card:hover .card__cover,
.card:focus-visible .card__cover { transform: scale(1.04); filter: saturate(1) brightness(1); }

/* Portada por defecto para los posts sin imagen */
.card__cover--empty,
.post__cover--empty {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 55%, rgba(255, 170, 90, 0.14), rgba(0, 0, 0, 0) 55%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 14px),
    #08070b;
}

.card__cover--empty span {
  font-size: 1.15rem;
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  text-transform: uppercase;
  color: rgba(169, 165, 160, 0.45);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px 22px;
}

.card__title {
  font-weight: 500;
  font-size: 1.28rem;
  line-height: 1.25;
  color: var(--silver);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__date {
  font-style: italic;
  font-size: 1rem;
  color: var(--silver-dim);
}

/* --------------------------------------------------------------------------
   Página de un post
   -------------------------------------------------------------------------- */
.post {
  flex: 1;
  width: min(820px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vh, 48px) 16px 72px;
}

.post__back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--silver-dim);
  transition: color 0.3s ease;
}

.post__back::before {
  content: "";
  width: 6px;
  height: 6px;
  border-left: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
}

.post__back:hover,
.post__back:focus-visible { color: #ffffff; outline: none; }

.post__header {
  text-align: center;
  margin: clamp(28px, 5vh, 44px) 0 clamp(28px, 4vh, 40px);
}

.post__date {
  display: block;
  margin-bottom: 14px;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--silver-dim);
}

.post__title {
  font-weight: 400;
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-wrap: balance;
}

.post__cover {
  position: relative;
  margin: 0 0 clamp(32px, 5vh, 48px);
  padding: 5px;
  border: 1px solid var(--line-soft);
}

.post__cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: cover;
  border: 1px solid var(--line);
}

/* Texto del post */
.prose {
  font-size: 1.22rem;
  line-height: 1.7;
  color: #dcd8d2;
}

.prose > * + * { margin-top: 1.1em; }

.prose h2,
.prose h3,
.prose h4 {
  font-weight: 500;
  line-height: 1.25;
  color: var(--silver);
}

.prose h2 {
  margin-top: 2em;
  font-size: 1.15rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.prose h3 { margin-top: 1.6em; font-size: 1.35rem; }
.prose h4 { margin-top: 1.4em; font-size: 1.15rem; font-style: italic; }

.prose a {
  color: var(--silver);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.3s ease, color 0.3s ease;
}

.prose a:hover { color: #ffffff; text-decoration-color: rgba(255, 214, 160, 0.8); }

.prose strong { font-weight: 500; color: #ffffff; }

.prose ul,
.prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose ul { list-style: none; }

.prose ul li { position: relative; }

.prose ul li::before {
  content: "";
  position: absolute;
  left: -1.1em;
  top: 0.72em;
  width: 5px;
  height: 5px;
  background: var(--silver-dim);
  transform: rotate(45deg);
}

.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 4px 0 4px 24px;
  border-left: 1px solid var(--line);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--silver);
}

.prose code {
  padding: 1px 6px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.04);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85em;
}

.prose pre {
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  background: #08070b;
  line-height: 1.5;
}

.prose pre code { padding: 0; border: 0; background: none; font-size: 0.82em; }

.prose img,
.prose iframe,
.prose video { display: block; max-width: 100%; height: auto; }

.prose iframe { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line-soft); }

.prose figure { margin: 2em 0; }

.prose figure img {
  width: 100%;
  padding: 4px;
  border: 1px solid var(--line-soft);
}

.prose figcaption {
  margin-top: 10px;
  text-align: center;
  font-style: italic;
  font-size: 1rem;
  color: var(--silver-dim);
}

.prose hr {
  height: 1px;
  margin: 2.4em auto;
  border: 0;
  width: 60%;
  background: linear-gradient(to right, transparent, var(--line), transparent);
}

/* Anterior / Siguiente */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line-soft);
}

.pager__link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  border: 1px solid var(--line-soft);
  text-decoration: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.pager__link--newer { text-align: right; }

.pager__link:hover,
.pager__link:focus-visible {
  border-color: var(--line);
  background: rgba(232, 229, 224, 0.03);
  outline: none;
}

.pager__label {
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--silver-dim);
}

.pager__title { font-size: 1.15rem; color: var(--silver); }

/* --------------------------------------------------------------------------
   Pie
   -------------------------------------------------------------------------- */
.footer {
  position: relative;
  padding: 28px 16px 32px;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(169, 165, 160, 0.7);
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line-soft) 30%, var(--line-soft) 70%, transparent);
}

@media (max-width: 640px) {
  /* La marca va arriba; enlaces e idioma, en la fila de abajo */
  .topbar {
    height: auto;
    grid-template-columns: 1fr auto;
    grid-template-areas: "brand brand" "nav lang";
    row-gap: 10px;
    padding-top: 16px;
    padding-bottom: 14px;
  }
  .topbar__brand { grid-area: brand; justify-self: center; }
  .topbar__nav   { grid-area: nav; }
  .lang          { grid-area: lang; }
  .lang__toggle  { height: 32px; }
  .topbar__link  { font-size: 0.72rem; letter-spacing: 0.18em; }
  .prose { font-size: 1.12rem; }
  .pager { grid-template-columns: 1fr; }
  .pager__link--newer { text-align: left; }
}

/* Chino: la cursiva deforma los caracteres, se usa letra recta */
:lang(zh) { font-style: normal !important; }
