/* ===========================================================
   Sovereign — Hugo theme for Ubica-Tech
   Mono + serif manifesto. Ink default; paper variant via [data-theme].
   =========================================================== */

:root {
  --ink:    #0a0d12;
  --ink-2:  #11151c;
  --ink-3:  #1a212b;
  --paper:  #f1ede4;
  --paper-2:#e6e1d6;
  --fg:     #e8e4dc;
  --fg-dim: #8b8f97;
  --fg-mute:#5b6068;
  --accent: #e0a458;

  --bg:     var(--ink);
  --bg-2:   var(--ink-2);
  --line:   rgba(232, 228, 220, 0.10);
  --line-2: rgba(232, 228, 220, 0.18);

  --mono: "IBM Plex Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
  --serif:"IBM Plex Serif", "Iowan Old Style", Georgia, serif;
}

:root[data-theme="paper"] {
  --bg:     var(--paper);
  --bg-2:   var(--paper-2);
  --fg:     #15181d;
  --fg-dim: #4c5159;
  --fg-mute:#7b818a;
  --line:   rgba(10, 13, 18, 0.10);
  --line-2: rgba(10, 13, 18, 0.18);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; }

.mono { font-family: var(--mono); letter-spacing: 0.01em; }
.small { font-size: 11px; }
.dim { color: var(--fg-dim); }

/* ---------- Stage ---------- */
.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 24px 32px;
  gap: 24px;
}

/* ---------- Background ---------- */
.bg-iso {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  color: var(--fg);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}
:root[data-theme="paper"] .bg-iso { opacity: 0.09; }

.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, transparent 0%, transparent 55%, rgba(0,0,0,0.45) 100%);
}
:root[data-theme="paper"] .vignette {
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, transparent 0%, transparent 55%, rgba(0,0,0,0.06) 100%);
}

/* ---------- Status bar ---------- */
.status {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 12px;
}
.status-l { display: flex; align-items: center; gap: 10px; }
.status-home { text-decoration: none; }
.status-home:hover { color: var(--accent); }
.status-c { justify-self: center; }
.status-r { justify-self: end; display: flex; gap: 8px; align-items: center; }
.status .sep { color: var(--fg-mute); }
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.pulse {
  color: var(--accent);
  animation: pulse 2.2s ease-in-out infinite;
  margin-right: 4px;
}
@keyframes pulse { 0%, 100% { opacity: 0.4 } 50% { opacity: 1 } }

/* ---------- Center stage ---------- */
.center {
  position: relative; z-index: 2;
  align-self: center; justify-self: center;
  width: 100%;
  max-width: 1080px;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

.tick {
  position: absolute;
  font-family: var(--mono);
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
  opacity: 0.55;
}
.tick--tl { top: 8px; left: 8px; }
.tick--tr { top: 8px; right: 8px; }
.tick--bl { bottom: 8px; left: 8px; }
.tick--br { bottom: 8px; right: 8px; }

/* ---------- Hero (cube + wordmark) ---------- */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 32px;
  width: 100%;
}
.cube {
  position: relative;
  width: 144px; height: 168px;
  display: grid; place-items: center;
  animation: float 7s ease-in-out infinite;
}
.cube img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  filter: invert(1) brightness(1.05);
  transition: transform 600ms cubic-bezier(.2,.7,.2,1), filter 600ms ease;
}
:root[data-theme="paper"] .cube img {
  filter: none;
}
.cube:hover img { transform: rotate(-3deg) scale(1.04); }
.cube-halo {
  position: absolute; inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in oklab, var(--accent) 22%, transparent), transparent 60%);
  filter: blur(8px);
  opacity: 0.55;
  pointer-events: none;
}
.cube-baseline {
  position: absolute; bottom: -2px; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line-2), transparent);
}
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }

.hero-wordmark { display: flex; flex-direction: column; gap: 6px; }
.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
  display: inline-flex; align-items: baseline; gap: 0;
}
.wordmark-dim { color: var(--accent); padding: 0 0.05em; }
.wordmark-cursor {
  display: inline-block;
  width: 0.5ch; height: 0.9em;
  background: var(--accent);
  margin-left: 0.2em;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0 } }
.rule {
  height: 1px;
  background: linear-gradient(to right, var(--accent) 0 64px, var(--line-2) 64px 100%);
  margin-top: 12px;
  width: 100%;
}

/* ---------- Quote / manifesto ---------- */
.quote {
  position: relative;
  width: 100%;
  padding: 28px 36px 24px 36px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 18px;
  row-gap: 10px;
}
.quote-mark {
  font-family: var(--serif);
  font-size: 72px;
  line-height: 0.7;
  color: var(--accent);
  align-self: start;
}
.quote-body {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.35;
  color: var(--fg);
  text-wrap: pretty;
  letter-spacing: 0.005em;
}
.caret {
  display: inline-block;
  width: 0.45ch;
  margin-left: 0.15ch;
  color: var(--accent);
  transform: translateY(-0.06em);
}
.caret--done { animation: blink 1.05s steps(1) infinite; }
.quote-attrib {
  grid-column: 2;
  font-size: 12px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Nav row ---------- */
.nav {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  color: var(--fg);
  text-decoration: none;
  border-right: 1px solid var(--line);
  transition: background 200ms ease, color 200ms ease;
}
.nav-item:last-child { border-right: none; }
.nav-item:hover { background: color-mix(in oklab, var(--accent) 8%, transparent); }
.nav-idx { color: var(--fg-mute); font-size: 11px; letter-spacing: 0.08em; }
.nav-label { font-family: var(--mono); font-weight: 500; font-size: 17px; }
.nav-note {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--fg-mute);
  margin-top: -2px;
  opacity: 0.85;
}
.nav-arrow {
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 200ms, transform 200ms, color 200ms;
  color: var(--accent);
}
.nav-item:hover .nav-arrow { opacity: 1; transform: translateX(0); }
.nav-item:hover .nav-label { color: var(--accent); }

/* ---------- Socials ---------- */
.socials {
  display: flex;
  gap: 22px;
  font-size: 13px;
  align-items: center;
  color: var(--fg-dim);
  margin-top: -6px;
}
.social {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 6px 4px;
  border-bottom: 1px solid transparent;
  transition: color 180ms, border-color 180ms;
}
.social:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 32px;
  z-index: 10;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--fg-dim);
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 180ms, border-color 180ms, background 180ms;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle-icon { font-size: 14px; }

/* ---------- Footer ---------- */
.foot {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  font-size: 11px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.foot-l { display: flex; gap: 8px; align-items: center; }
.foot-l .sep { color: var(--fg-mute); }
.foot-c { justify-self: center; }
.foot-r { justify-self: end; }

.lang {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
}
.lang-btn {
  background: transparent; border: none; color: var(--fg-dim);
  font-family: inherit; font-size: inherit;
  padding: 4px 6px; cursor: pointer;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: color 150ms;
}
.lang-btn:hover { color: var(--fg); }
.lang-btn--on { color: var(--accent); }
.lang-sep { color: var(--fg-mute); }

/* ============================================================
   Inner pages (single.html / list.html / 404.html)
   ============================================================ */

.page {
  width: 100%;
  max-width: 720px;
  align-self: start;
  margin: 0 auto;
}

.page-header { margin-bottom: 36px; }
.page-back {
  display: inline-block;
  text-decoration: none;
  font-size: 12px;
  margin-bottom: 18px;
  transition: color 180ms;
}
.page-back:hover { color: var(--accent); }

.page-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  margin: 0 0 6px 0;
}
.page-desc {
  font-size: 14px;
  margin: 0;
}

/* ---------- Content typography ---------- */
.page-content {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--fg);
}
.page-content h1, .page-content h2, .page-content h3,
.page-content h4, .page-content h5, .page-content h6 {
  font-family: var(--mono);
  font-weight: 600;
  margin: 2em 0 0.6em;
  line-height: 1.2;
}
.page-content h2 { font-size: 1.4em; }
.page-content h3 { font-size: 1.15em; }
.page-content p { margin: 0 0 1.2em; text-wrap: pretty; }
.page-content a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 180ms;
}
.page-content a:hover { color: var(--fg); }

.page-content ul, .page-content ol {
  padding-left: 1.4em;
  margin: 0 0 1.2em;
}
.page-content li { margin-bottom: 0.4em; }
.page-content blockquote {
  border-left: 2px solid var(--accent);
  margin: 1.6em 0;
  padding: 0.4em 0 0.4em 1.4em;
  color: var(--fg-dim);
  font-style: italic;
}
.page-content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-2);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}
.page-content pre {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 18px 22px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 1.6em 0;
}
.page-content pre code {
  background: transparent;
  padding: 0;
}
.page-content img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}
.page-content hr {
  border: none;
  height: 1px;
  background: var(--line-2);
  margin: 2.4em 0;
}

/* ---------- Page nav (bottom of single pages) ---------- */
.page-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.page-nav-link {
  font-size: 13px;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 180ms, border-color 180ms;
}
.page-nav-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.page-nav-link--active {
  color: var(--accent);
}

/* ---------- List items ---------- */
.list { display: flex; flex-direction: column; gap: 0; }
.list-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 18px;
  padding: 18px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background 180ms;
}
.list-item:first-child { border-top: 1px solid var(--line); }
.list-item:hover { color: var(--accent); }
.list-date { font-size: 12px; align-self: center; }
.list-title { font-family: var(--mono); font-weight: 500; font-size: 16px; }
.list-desc {
  grid-column: 2;
  font-size: 12px;
  margin-top: -4px;
}

/* ---------- 404 ---------- */
.page--404 { text-align: center; align-self: center; }
.err-code {
  font-size: clamp(64px, 12vw, 120px);
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  opacity: 0.35;
}
.err-home {
  display: inline-block;
  margin-top: 28px;
  text-decoration: none;
  padding: 10px 24px;
  border: 1px solid var(--line-2);
  transition: color 180ms, border-color 180ms;
}
.err-home:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .stage { padding: 16px; }
  .status, .foot { grid-template-columns: 1fr; gap: 6px; }
  .status-r, .foot-r, .status-c, .foot-c { justify-self: start; }
  .center { padding: 32px 16px; }
  .hero { grid-template-columns: 1fr; text-align: left; gap: 18px; }
  .cube { width: 110px; height: 128px; }
  .nav { grid-template-columns: 1fr; }
  .nav-item { border-right: none; border-bottom: 1px solid var(--line); }
  .theme-toggle { bottom: 16px; right: 16px; }
}
