:root {
  --ff: "Inter", sans-serif;
  --h1: bold 1.125rem/1.4em var(--ff);
  --h2: bold 1rem/1.4em var(--ff);
  --p: 1rem/1.4em var(--ff);
  --p2: .875rem/1.4em var(--ff);

  /* px variants are for font-size=16px */
  --space-1: 0.125rem;  /* 2px */
  --space-2: 0.25rem;   /* 4px */
  --space-3: 0.5rem;    /* 8px */
  --space-4: 0.75rem;   /* 12px */
  --space-5: 1rem;      /* 16px */
  --space-6: 1.5rem;    /* 24px */
  --space-7: 2rem;      /* 32px */
  --space-8: 3rem;      /* 48px */
  --space-9: 4rem;      /* 64px */
  --space-10: 6rem;     /* 96px */
}

:root[data-theme="light"] {
  /* hsl (fallback color) */
  --bg-dark: hsl(0 0% 90%);
  --bg: hsl(0 0% 95%);
  --bg-light: hsl(300 50% 100%);
  --text: hsl(330 0% 4%);
  --text-muted: hsl(0 0% 28%);
  --highlight: hsl(300 50% 100%);
  --border: hsl(300 0% 50%);
  --border-muted: hsl(340 0% 62%);
  --primary: hsl(193 100% 15%);
  --secondary: hsl(22 76% 25%);
  --danger: hsl(9 21% 41%);
  --warning: hsl(52 23% 34%);
  --success: hsl(147 19% 36%);
  --info: hsl(217 22% 41%);
  /* oklch */
  --bg-dark: oklch(0.92 0 226);
  --bg: oklch(0.96 0 226);
  --bg-light: oklch(1 0 226);
  --text: oklch(0.15 0 226);
  --text-muted: oklch(0.4 0 226);
  --highlight: oklch(1 0 226);
  --border: oklch(0.6 0 226);
  --border-muted: oklch(0.7 0 226);
  --primary: oklch(0.4 0.1 226);
  --secondary: oklch(0.4 0.1 46);
  --danger: oklch(0.5 0.05 30);
  --warning: oklch(0.5 0.05 100);
  --success: oklch(0.5 0.05 160);
  --info: oklch(0.5 0.05 260);

  --gradient: linear-gradient(0deg, var(--bg) 95%, var(--bg-light));
  --gradient-hover: linear-gradient(0deg, var(--bg), var(--bg-light));
  --border-card: solid 1px var(--bg);
  --shadow: 0px 2px 2px hsla(0, 0%, 0%, 0.07), 0px 4px 4px hsla(0, 0%, 0%, 0.15);

  --dark-filter: invert(100%);
}

:root[data-theme="dark"] {
  /* hsl (fallback color) */
  --bg-dark: hsl(336 0% 1%);
  --bg: hsl(330 0% 4%);
  --bg-light: hsl(0 0% 9%);
  --text: hsl(0 0% 95%);
  --text-muted: hsl(300 0% 69%);
  --highlight: hsl(330 0% 39%);
  --border: hsl(0 0% 28%);
  --border-muted: hsl(300 0% 18%);
  --primary: hsl(197 68% 64%);
  --secondary: hsl(19 69% 69%);
  --danger: hsl(9 26% 64%);
  --warning: hsl(52 19% 57%);
  --success: hsl(146 17% 59%);
  --info: hsl(217 28% 65%);
  /* oklch */
  --bg-dark: oklch(0.1 0 226);
  --bg: oklch(0.15 0 226);
  --bg-light: oklch(0.2 0 226);
  --text: oklch(0.96 0 226);
  --text-muted: oklch(0.76 0 226);
  --highlight: oklch(0.5 0 226);
  --border: oklch(0.4 0 226);
  --border-muted: oklch(0.3 0 226);
  --primary: oklch(0.76 0.1 226);
  --secondary: oklch(0.76 0.1 46);
  --danger: oklch(0.7 0.05 30);
  --warning: oklch(0.7 0.05 100);
  --success: oklch(0.7 0.05 160);
  --info: oklch(0.7 0.05 260);

  --gradient: linear-gradient(0deg, var(--bg) 95%, var(--bg-light));
  --gradient-hover: linear-gradient(0deg, var(--bg), var(--bg-light));
  --highlight: hsl(0 0% 60%);
  --border-card: solid 1px var(--border);
  --shadow: 0px 2px 2px hsla(0, 0%, 0%, 0.07), 0px 4px 4px hsla(0, 0%, 0%, 0.15);
}

* {
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

html, body {
  min-height: 100vh;
  margin: 0;
}

html {
  font-size: 16px;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: var(--bg-dark);
}

main {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1 0 auto;
  margin: 0 max(var(--space-7), 4vw);
  max-width: 1200px;
}

form {
  margin: 0;
}

p {
  color: var(--text);
  font: var(--p);
}

a {
  text-decoration: none;
  color: var(--text);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

input {
  background: var(--bg-light);
  color: var(--text);
  box-shadow: var(--shadow);
  border-radius: 9999px;
  border: var(--border-card);
  border-top: 1px solid var(--highlight);
}

input:focus {
  outline: 2px solid var(--primary);
}

header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 
    minmax(6rem, 1fr)
    2fr
    minmax(20rem, 1fr);
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font: var(--p);
}

.header-left {
  font: var(--h1);
}

.header-middle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.header-middle > * {
  background: var(--bg-light);
  padding: 0.5rem 1rem 0.7rem 1rem;
  box-shadow: var(--shadow);
  border-radius: 9999px;
  border: var(--border-card);
  border-top: 1px solid var(--highlight);
}

.header-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: end;
}

#theme-button {
  background: var(--bg-light);
  aspect-ratio: 1/1;
  padding: 0.5em;
  border-radius: 9999px;
  margin-right: 0.75em;
}

#login-btn {
  color: var(--text);
  background: var(--bg-light);
  padding: 0.5rem 1rem 0.7rem 1rem;
  box-shadow: var(--shadow);
  border-radius: 9999px;
  border: var(--border-card);
  border-top: 1px solid var(--highlight);
}

#signup-btn {
  color: var(--bg);
  background: var(--primary);
  padding: 0.5rem 1rem 0.7rem 1rem;
  box-shadow: var(--shadow);
  border-radius: 9999px;
}

.card {
  background: var(--gradient);
  border: var(--border-card);
  border-top: 1px solid var(--highlight);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card:hover {
  background: var(--gradient-hover);
}

h1 {
  color: var(--text);
}

button {
  background: var(--gradient);
  color: var(--text);
  border-radius: 0.5rem;
  border: var(--border-card);
  border-top: 1px solid var(--highlight);
  box-shadow: var(--shadow);
  cursor: pointer;
}

button:hover {
  background: var(--gradient-hover);
}

#search-form {
  flex: 1;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#search-wrapper {
  width: 50%;
  position: relative;
  display: inline-block;
}

#search-wrapper input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 1rem 0.7rem 1rem;
}

#search-wrapper img {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  pointer-events: none;
  filter: var(--dark-filter);
}

.center-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#error-wrapper > p {
  font-size: 10rem;
  color: var(--text);
}

#signup-form {
  width: 80%;
  max-width: 25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--text);
  font: var(--p);
}

#signup-form > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#signup-form > div > input {
  padding: 0.5rem 1rem 0.5rem 1rem;
}

#signup-form > button {
  width: 50%;
  margin: 0 auto;
  margin-top: 2em;
  padding: 0.5rem 1rem 0.75rem 1rem;
  border-radius: 9999px;
  font: var(--h);
  color: var(--text);
}

#login-form {
  width: 80%;
  max-width: 25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--text);
  font: var(--p);
}

#login-form > div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

#login-form > div > input {
  padding: 0.5rem 1rem 0.5rem 1rem;
}

#login-form > button {
  width: 50%;
  margin: 0 auto;
  margin-top: 2em;
  padding: 0.5rem 1rem 0.75rem 1rem;
  border-radius: 9999px;
  font: var(--h);
  color: var(--text);
}

.error {
  color: var(--danger);
  text-align: center;
}
