/* ─────────────────────────────────────────
   devs.to — stylesheet
   nord · markdown aesthetic · minimal
───────────────────────────────────────── */

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

/* ── Nord palette ── */
:root {
  --nord0:  #2E3440; /* darkest */
  --nord1:  #3B4252;
  --nord3:  #4C566A; /* comments, muted */
  --nord4:  #D8DEE9; /* subtle symbols */
  --nord5:  #E5E9F0;
  --nord6:  #ECEFF4; /* surface, code bg */
  --nord7:  #8FBCBB; /* h4, links, teal */
  --nord8:  #88C0D0; /* h3, cyan */
  --nord9:  #81A1C1; /* h2, blue-grey */
  --nord10: #5E81AC; /* h1, deep blue */

  --bg:     #f8f9fb; /* slightly warmer than pure white */
  --text:   #3B4252;
  --symbol: #c8d0de; /* markdown symbols — lighter than text, more subtle */

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Menlo', monospace;

  --max-w: 680px;
}

/* ── Base ── */

html {
  font-size: 16.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ── */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding: 3rem 0 5rem;
}

/* ── Markdown headings ── */

h1, h2, h3, h4 {
  position: relative;
  font-weight: 600;
  line-height: 1.3;
}

h1::before, h2::before, h3::before, h4::before {
  font-family: var(--font-mono);
  color: var(--symbol);
  font-weight: 400;
  font-size: 0.7em;
  position: absolute;
  right: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  line-height: 1;
}

h1 {
  font-size: 1.75rem;
  color: var(--nord10);
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

h1::before { content: "#"; }

h2 {
  font-size: 1.1rem;
  color: var(--nord9);
  margin-top: 2.75rem;
  margin-bottom: 0.75rem;
  letter-spacing: 0.01em;
}

h2::before { content: "##"; }

h3 {
  font-size: 0.95rem;
  color: var(--nord8);
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

h3::before { content: "###"; }

h4 {
  font-size: 0.82rem;
  color: var(--nord7);
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

h4::before { content: "####"; }

/* ── Floating avatar ── */

@keyframes avatar-wiggle {
  0%   { transform: rotate(0deg) scale(1); }
  15%  { transform: rotate(-6deg) scale(1.06); }
  30%  { transform: rotate(5deg) scale(1.08); }
  45%  { transform: rotate(-3deg) scale(1.06); }
  60%  { transform: rotate(2deg) scale(1.05); }
  75%  { transform: rotate(-1deg) scale(1.04); }
  100% { transform: rotate(0deg) scale(1.04); }
}

.float-avatar {
  position: fixed;
  top: -60px;
  right: -60px;
  z-index: 100;
  width: clamp(200px, 30vw, 400px);
  height: clamp(200px, 30vw, 400px);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(46, 52, 64, 0.18);
  cursor: pointer;
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              height 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              top 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              right 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
}

.float-avatar:hover {
  width: clamp(260px, 40vw, 520px);
  height: clamp(260px, 40vw, 520px);
  top: -80px;
  right: -80px;
  box-shadow: 0 10px 32px rgba(46, 52, 64, 0.25);
  animation: avatar-wiggle 0.5s ease forwards;
}

.float-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.float-avatar:hover img {
  opacity: 1;
}

/* ── Blockquote (> tagline) ── */

blockquote {
  position: relative;
  margin: 0.25rem 0 0;
}

blockquote::before {
  font-family: var(--font-mono);
  content: ">";
  color: var(--symbol);
  font-size: 0.7em;
  position: absolute;
  right: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
}

blockquote p {
  font-size: 0.88rem;
  color: var(--nord3);
  font-style: italic;
  display: inline;
  background: var(--nord6);
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
}

/* ── Paragraphs ── */

p {
  font-size: 0.9rem;
  color: var(--nord3);
  line-height: 1.75;
  margin: 0.5rem 0;
}

/* ── Lists ── */

ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}

ul li {
  font-size: 0.9rem;
  color: var(--nord3);
  line-height: 1.75;
  position: relative;
  padding-left: 1.25rem;
}

ul li::before {
  font-family: var(--font-mono);
  content: "*";
  color: var(--symbol);
  font-size: 0.85em;
  position: absolute;
  left: 0;
  top: 0.1em;
}

ul li ul {
  margin: 0;
  padding-left: 1rem;
}

ol {
  list-style: none;
  counter-reset: li;
  padding: 0;
  margin: 0.5rem 0;
}

ol li {
  font-size: 0.9rem;
  color: var(--nord3);
  line-height: 1.75;
  counter-increment: li;
  padding-left: 1.5rem;
  position: relative;
}

ol li::before {
  font-family: var(--font-mono);
  content: counter(li) ".";
  color: var(--symbol);
  font-size: 0.8em;
  position: absolute;
  left: 0;
  top: 0.15em;
}

/* ── Inline code ── */

code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--nord6);
  color: var(--nord0);
  padding: 0.05em 0.15em;
  border-radius: 2px;
}

code::before { content: "`"; color: var(--symbol); }
code::after  { content: "`"; color: var(--symbol); }

/* ── Em / strong symbols ── */

em::before, em::after {
  font-family: var(--font-mono);
  content: "*";
  color: var(--symbol);
  font-size: 0.75em;
  font-style: normal;
}

strong::before, strong::after {
  font-family: var(--font-mono);
  content: "**";
  color: var(--symbol);
  font-size: 0.75em;
}

/* ── Links ── */

a {
  color: var(--nord7);
  text-decoration: none;
  font-weight: 400;
}

a::before {
  font-family: var(--font-mono);
  content: "[";
  color: var(--symbol);
  font-size: 0.75em;
}

a::after {
  font-family: var(--font-mono);
  content: "](" attr(href) ")";
  color: var(--symbol);
  font-size: 0.75em;
  word-break: break-all;
}

/* ── Skip link markdown rendering for footer links ── */

.footer-links a::before, .footer-links a::after,
.footer-copy::before, .footer-copy::after {
  content: none;
}

/* ── Section divider ── */

hr {
  border: none;
  border-top: 1px solid var(--nord5);
  margin: 2.5rem 0;
}

/* ── Footer ── */

footer {
  padding: 2rem 0;
}

footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--symbol);
  font-family: var(--font-mono);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  font-size: 0.75rem;
  color: var(--symbol);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--nord3);
}

.name-break { display: none; }
.name-sep { display: inline; }

/* ── Responsive ── */

@media (max-width: 540px) {
  :root {
    --max-w: 100%;
  }

  html {
    font-size: 14px;
  }

  .name-break { display: inline; }
  .name-sep { display: none; }

  /* on small screens symbols can't float left, hide them */
  h1::before, h2::before, h3::before, h4::before,
  blockquote::before {
    display: none;
  }

  footer .container {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-end;
  }
}
