@import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,400;0,700;1,400&family=Ubuntu+Mono&display=swap');

:root {
  --font-family: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-family-monospace: "Ubuntu Mono", Consolas, Menlo, monospace;
  --syntax-tab-size: 2;
}

:root,
[data-theme="dark"] {
  --color-gray-20: #bac2de; 
  --color-gray-50: #6c7086; 
  --color-gray-90: #cdd6f4; 

  --background-color:       #1e1e2e; 
  --text-color:             #cdd6f4; 
  --text-color-link:        #89b4fa; 
  --text-color-link-active: #cba6f7; 
  --text-color-link-visited:#b4befe; 
  --border-color:           #45475a; 
  --header-border:          #313244; 
}

[data-theme="light"] {
  --color-gray-20: #5c5f77; 
  --color-gray-50: #9ca0b0; 
  --color-gray-90: #4c4f69; 

  --background-color:       #eff1f5; 
  --text-color:             #4c4f69; 
  --text-color-link:        #1e66f5; 
  --text-color-link-active: #8839ef; 
  --text-color-link-visited:#7287fd; 
  --border-color:           #bcc0cc; 
  --header-border:          #ccd0da; 
}

/* ── Base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

@view-transition { navigation: auto; }

html, body {
  padding: 0;
  margin: 0 auto;
  font-family: var(--font-family);
  color: var(--text-color);
  background-color: var(--background-color);
  transition: background-color 0.2s ease, color 0.2s ease;
}

html {
  overflow-y: scroll;
  font-size: 16px;
}

body {
  max-width: 40em;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  word-break: break-word;
  overflow-wrap: break-word;
}

@media (min-width: 600px) {
  html { font-size: 20px; }
}

@media (min-width: 900px) {
  html { font-size: 24px; }
}

body.theme-loading { visibility: hidden; }

.visually-hidden:not(:focus):not(:active) {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

img { max-width: 100%; }
img[width][height] { height: auto; }
img[src$=".svg"] { width: 100%; height: auto; max-width: none; }

video, iframe { width: 100%; height: auto; }
iframe {
  aspect-ratio: 16/9;
  min-height: 180px;
}

p:last-child { margin-bottom: 0; }
p  { line-height: 1.82; }
li { line-height: 1.82; }

a[href]         { color: var(--text-color-link); }
a[href]:visited { color: var(--text-color-link-visited); }
a[href]:hover,
a[href]:active  { color: var(--text-color-link-active); }

@media (max-width: 599px) {
  a[href] {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    padding: 0 2px;
  }
  p a[href],
  li a[href] {
    display: inline;
    min-height: unset;
    line-height: inherit;
    padding: 0;
  }
}

[data-theme="light"] a[href] {
  text-decoration: none;
  text-decoration-thickness: 0.12rem;
}

[data-theme="dark"] a[href] {
  text-decoration: none;
  text-decoration-thickness: 0.12rem;
}

main, footer { padding: 1rem; }
main :first-child { margin-top: 0; }

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 0.75em 1em;
  border-bottom: 1px dashed var(--header-border);
}

@media (max-width: 400px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5em;
  }
}

.home-link {
  flex-grow: 1;
  font-size: 1em;
  font-weight: 700;
}
.home-link:link:not(:hover) { text-decoration: none; }

[data-theme="light"] .home-link {
  font-size: 1.15em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav {
  display: flex;
  gap: .5em 1em;
  padding: 0;
  margin: 0;
  list-style: none;
  align-items: center;
  flex-wrap: wrap;
}
.nav-item { display: inline-block; }
.nav-item a[href]:not(:hover) { text-decoration: none; }
.nav a[href][aria-current="page"] { text-decoration: none; }

[data-theme="light"] .nav-item a[href] {
  font-size: 1em;
  text-decoration-thickness: 0.15rem;
  color: #000;
}
[data-theme="light"] .nav-item a[href]:hover { color: #444; }

[data-theme="dark"] .nav-item a[href] {
  font-size: 1em;
  text-decoration-thickness: 0.15rem;
}
[data-theme="dark"] .nav-item a[href]:hover { color: #fab387; }

#skip-link {
  text-decoration: none;
  background: var(--background-color);
  color: var(--text-color);
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-gray-90);
  border-radius: 2px;
}
#skip-link.visually-hidden:focus {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 999;
}

.postlist {
  counter-reset: start-from var(--postlist-index);
  list-style: none;
  padding: 0;
  padding-left: 1.5rem;
}
.postlist-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  counter-increment: start-from -1;
  margin-bottom: 1em;
}
.postlist-item:before {
  display: inline-block;
  pointer-events: none;
  content: "" counter(start-from, decimal-leading-zero) ". ";
  line-height: 100%;
  text-align: right;
  margin-left: -1.5rem;
}
.postlist-date,
.postlist-item:before {
  font-size: 0.8125em;
  color: var(--color-gray-50);
}
.postlist-date { word-spacing: -0.5px; }
.postlist-link {
  font-size: 1.1875em;
  font-weight: 700;
  flex-basis: calc(100% - 1.5rem);
  padding-left: .25em;
  padding-right: .5em;
}

@media (max-width: 400px) {
  .postlist-link { font-size: 1em; }
}

.post-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: capitalize;
  font-style: italic;
}
.postlist-item > .post-tag { align-self: center; }

.post-metadata {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .5em;
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-metadata time { margin-right: 1em; }

.links-nextprev {
  display: flex;
  justify-content: space-between;
  gap: .5em 1em;
  list-style: "";
  border-top: 1px dashed var(--border-color);
  padding: 1em 0;
}
.links-nextprev > * { flex-grow: 1; }
.links-nextprev-next { text-align: right; }

@media (max-width: 480px) {
  .links-nextprev {
    flex-direction: column;
    gap: 0.75em;
  }
  .links-nextprev-next { text-align: left; }
}

table {
  margin: 1em 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table td, table th { padding-right: 1em; }

pre, code { font-family: var(--font-family-monospace); }
pre:not([class*="language-"]) {
  margin: .5em 0;
  line-height: 1.65;
  tab-size: var(--syntax-tab-size);
  hyphens: none;
  direction: ltr;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; 
  max-width: 100%;
}
code { word-break: break-all; }

footer {
  border-top: 1px dashed var(--border-color);
  font-size: 0.85em;
  opacity: 0.7;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

html[data-lang="pt-br"] [data-en] { display: none; }
html[data-lang="en"]    [data-pt] { display: none; }

.lang-toggle {
  position: fixed;
  bottom: 0.9rem;
  right: 1rem;
  bottom: calc(0.9rem + env(safe-area-inset-bottom));
  right: calc(1rem + env(safe-area-inset-right));
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  opacity: 0.15;
  cursor: pointer;
  padding: 2px 4px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  transition: opacity 0.35s ease;
  z-index: 999;
  user-select: none;
  text-transform: lowercase;
}
.lang-toggle:hover { opacity: 0.5; }
