/** 
 * CSS DIRECTORY
 *     1. GLOBAL 
 *     2. MAIN
 *     3. FOOTER
 */

/* ========== GLOBAL ========== */

:root {
  /* colors */
  --bg: oklch(100% 0 0);
  --border: oklch(85% 0 0);
  --txt: oklch(5% 0 0);
  --txt-muted: oklch(30% 0 0);
  --txt-footer: oklch(55% 0 0);
  --link: oklch(42.9% .30 264);
  --link-visited: oklch(37.8% 0.17 302);
  --link-active: oklch(62.8% 0.26 29);

  /* typography */
  --ff: sans-serif;
  --ff-h1: bold 2rem/1.5em var(--ff);
  --ff-h2: bold 1.5rem/1.5em var(--ff);
  --ff-h3: bold 1rem/1.5em var(--ff);
  --ff-p: 1rem/1.5em var(--ff);
  --ff-footer: .875rem/1em var(--ff);

  /* hover basis */
  --hover-color: black;
  --hover-amount: 10%;
  --hover-color-link: white;
  --hover-amount-link: 35%;

  /* hover elements */
  --bg-hover: color-mix(in srgb, var(--bg), var(--hover-color) var(--hover-amount));
  --link-hover: color-mix(in srgb, var(--link), var(--hover-color-link) var(--hover-amount-link));
  --link-visited-hover: color-mix(in srgb, var(--link-visited), var(--hover-color-link) var(--hover-amount-link));

  /* proportions */
  --box-size: 2.5rem;
}

/* Dark theme */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(20% 0 0);
  --border: oklch(45% 0 0);
  --txt: oklch(95% 0 0);
  --txt-muted: oklch(70% 0 0);
  --link: oklch(73.9% .14 282);
  --link-visited: oklch(80.1% .10 308);
  --link-active: oklch(79.8% 0.12 20);

  --hover-color: white;
  --hover-amount: 15%;
}

/* --- Reset --- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
  font: inherit;
  /* outline: 1px solid red; */
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg);
  font: var(--ff-p);
  color: var(--txt-muted)
}

/* Media */
img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--txt);
}

h1,
h2 {
  text-transform: capitalize;
}

h1 {
  font: var(--ff-h1);
}

h2 {
  font: var(--ff-h2)
}

h3,
h4,
h5,
h6 {
  font: var(--ff-h3);
}

/* Links */
a {
  color: var(--link);
}

a:visited {
  color: var(--link-visited);
}

a:focus-visible {
  border-radius: 1px;
  outline: 2px solid var(--txt);
}

a:active {
  color: var(--link-active);
}

a:hover {
  color: var(--link-hover);
}

a:visited:hover {
  color: var(--link-visited-hover);
}

a:active:hover {
  color: var(--link-active);
}

/* --- Theme Switch Button --- */

#theme-switch {
  position: fixed;
  top: .25rem;
  right: .25rem;

  display: flex;
  justify-content: center;
  align-items: center;

  transition: background-color .15s ease;

  border: 1px solid var(--border);
  border-radius: 50%;
  width: var(--box-size);
  height: var(--box-size);
  padding: .6rem;

  background-color: var(--bg);
  cursor: pointer;

  color: var(--txt);
}

#theme-switch .icon {
  width: var(--box-size);
  height: var(--box-size);
}

#theme-switch:hover {
  transition: background-color .15s ease;
  background-color: var(--bg-hover);
}

/* Icon visibility state */
.icon.dark-theme {
  display: block;
}

.icon.light-theme {
  display: none;
}

[data-theme="dark"] .icon.dark-theme {
  display: none;
}

[data-theme="dark"] .icon.light-theme {
  display: block;
}

/* ========== MAIN ========== */

main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1em auto;
  width: 65%;
  max-width: 75ch;
  padding: .5em 1.75em;
}

/* ========== FOOTER ========== */

footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 1rem;
  font: var(--ff-footer);
  color: var(--txt-footer);
}

footer ul {
  display: flex;
  gap: 1rem;
  list-style: none;
}

footer small,
footer a {
  font-size: 0.875rem;
}

footer a,
footer a:visited,
footer a:active {
  text-decoration: none;
  color: var(--txt-footer);
}

footer a:hover,
footer a:visited:hover,
footer a:active:hover {
  text-decoration: underline;
  color: var(--txt);
}