/* Variables & Fonts */

@font-face {
  font-family: "Maple Mono";
  src: url("/MapleMono-Regular.ttf.woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --font: "Maple Mono", monospace;
  --radius: 5px;
  
  --bg: #171216;
  --bg-light: #5a3d56;
  --text: #e2bbd8;
  --text-light: #ffdcf6;
  --accent: #ffb0f3;
  --accent-text: var(--bg);
  --border: #884682;
  --link: #ffbb89;
}

/* Global Resets & Base */

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

* {
  scrollbar-color: var(--accent) var(--bg-light);
  scrollbar-width: thin;
}

html {
  font-family: var(--font);
  scroll-beavior: smooth;
  text-size-adjust: none;
}

body {
  min-height: 100dvh;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-columns: 1fr min(47rem, 90%) 1fr;
  grid-template-rows: auto 1fr auto;
  gap: .625rem;
  -webkit-font-smoothing: antialiased;
}

body > * { grid-column: 2; }
body > footer { color: var(--text-light); font-size: .875rem; }

::selection {
  color: var(--bg);
  background: var(--accent);
}

/* =========================================
   3. Typography
   ========================================= */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.1;
  text-wrap: balance;
  margin: .5em 0;
  font-weight: bold;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: .75rem; }

h1::before, h2::before, h3::before, h4::before, h5::before, h6::before {
  color: var(--accent);
  content: '# ';
}

p, li, figcaption { text-wrap: pretty; }
p { margin: 1rem 0; overflow-wrap: break-word; }

sup, sub { vertical-align: baseline; position: relative; font-size: .75em; }
sup { top: -0.4em; }
sub { top: 0.3em; }

/* =========================================
   4. Links & Interactive
   ========================================= */
a {
  color: var(--link);
  text-decoration: none;
  border-radius: .125rem;
}

a:hover, a:focus-visible {
  background: linear-gradient(45deg, lightblue, lightpink);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent; /* fallback */
  font-weight: bold;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

mark {
  background: var(--accent);
  color: var(--bg);
  padding: 0 .25em;
  border-radius: var(--radius);
}

/* =========================================
   5. Lists
   ========================================= */
ul, ol { 
  margin: .25rem 0; 
  padding-left: 2.5rem; 
}
ul { list-style: square; }
ol { list-style: decimal; }
li { margin-bottom: .125rem; }

ul li::marker { content: '» '; color: var(--accent); }
ul li:hover::marker { content: '# '; font-weight: 700; color: var(--link); }
ol li::marker { color: var(--accent); }

/* =========================================
   6. Media & Figures
   ========================================= */
img, video, picture, canvas, svg {
  max-width: 100%;
  display: block;
}

img, video {
  max-width: 90%;
  height: auto;
  opacity: 0.8;
  padding: .125rem;
  border: 2px dashed var(--accent);
  border-radius: 15px;
}

figure { overflow-x: auto; }
figcaption {
  font-size: .875rem;
  color: var(--text-light);
  margin: 0 0 1rem 1rem;
}

/* =========================================
   7. Layout Containers
   ========================================= */
aside, details, pre, progress {
  background: var(--bg-light);
  border-radius: var(--radius);
}

aside {
  width: 35%;
  padding: 0 10px;
  margin-inline-start: 10px;
  float: right;
}
*[dir="rtl"] aside { float: left; }

details { padding: .5rem; }
summary {
  cursor: pointer;
  font-weight: bold;
  word-break: break-all;
}

blockquote {
  margin: 0 0 0 1.25rem;
  padding: .5rem 0 0 .5rem;
  border-inline-start: .375rem solid var(--accent);
  color: var(--text-light);
  font-style: italic;
}

hr {
  border: 1px dashed var(--accent);
  margin: .5rem 0;
}

/* =========================================
   8. Tables
   ========================================= */
table {
  border-collapse: collapse;
  margin: 1.5rem 0;
  display: block;
  overflow-x: auto;
}

td, th {
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-align: start;
}

th {
  background: var(--bg-light);
  font-weight: bold;
}

tr:nth-child(even) { background: var(--bg-light); }

/* =========================================
   9. Forms & Inputs
   ========================================= */
input, button, textarea, select {
  font: inherit;
  appearance: none;
  border-radius: var(--radius);
  max-width: 100%;
}

textarea, select, input:not([type="checkbox"]):not([type="radio"]) {
  color: var(--text);
  background: var(--bg);
  border: 1px dashed var(--border);
  padding: .25rem;
}

textarea {
  min-height: 10em;
  max-width: 43.5rem;
  width: 100%;
  resize: both;
}

label { display: block; margin-bottom: .3rem; }

fieldset {
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
}
fieldset > legend { color: var(--accent); }

/* Checkboxes & Radios */
input[type="checkbox"], input[type="radio"] {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}
input[type="radio"] { border-radius: 100%; }
input[type="checkbox"]:checked, input[type="radio"]:checked {
  background: var(--accent);
}

/* =========================================
   10. Buttons
   ========================================= */
button, .button, input[type="submit"], input[type="reset"], input[type="button"] {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}

button:hover:not(:disabled), .button:hover:not([aria-disabled="true"]) {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

:disabled, [aria-disabled="true"] {
  cursor: not-allowed;
  background: var(--bg-light);
  border-color: var(--bg-light);
  color: var(--text-light);
}

/* =========================================
   11. Code & Pre
   ========================================= */
code, pre, kbd, samp { font-family: var(--font); }

pre {
  border: 1px solid var(--accent);
  max-height: 30rem;
  padding: .625rem;
  overflow: auto;
}

p code, li code {
  padding: 0 .125rem;
  border-radius: 3px;
  color: var(--bg);
  background: var(--text);
}

/* =========================================
   12. Navigation & Specific Components
   ========================================= */
#nav-bar {
    padding: 0.625rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
    align-items: center;
}

.icon {
  width: 1.3rem;
  height: 1.3rem;
  fill: currentColor;
  cursor: pointer;
  transition: color 0.3s;
}
.icon:hover { color: var(--accent); }

.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  display: inline-flex;
}

/* =========================================
   13. Utility Classes
   ========================================= */
.center { text-align: center; }
.center img { margin: 1rem auto; }
.accent-data { color: var(--accent); }
.float-right { margin-inline-start: auto; }
.float-left { margin-inline-end: auto; }

.no-style {
  all: unset;
  background: none !important;
  border: none !important;
}

/* =========================================
   14. Media Queries
   ========================================= */
@media (max-width: 720px) {

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1rem; }
  h4 { font-size: .875rem; }

  aside {
    width: 100%;
    float: none;
    margin: 1rem 0;
  }

  dialog {
    max-width: 100%;
    margin: auto 1em;
  }
}