:root {
  --accent: #0066cc;
  --fg-color: #222;
  --bg-color: #f5f5f5;
  --card-bg: #fff;
  --borders: #ddd;
  --btn-fg: #222;
  --btn-bg: #f4e4cb;
  --rounded-corner: 8px;
  --pagewidth: 50rem;
  --grid-gap: 2rem;
  --pagegridwidth: calc(var(--pagewidth) + (6 * var(--grid-gap)));
  --narrowwidth: 60%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg-color: #eee;
    --bg-color: #1a1a1a;
    --card-bg: #2a2a2a;
    --borders: #444;
    --btn-fg: #eee;
    --btn-bg: #293a56;
  }
}

@media only screen and (max-width: 600px) {
  :root {
    --narrowwidth: 100%;
    --grid-gap: 1rem;
  }
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-size: 16px;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

body {
  color: var(--fg-color);
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  margin: 2rem 0 1rem;
  font-weight: 600;
  line-height: 1.3;
}

h2:first-child { margin: 1rem 0; }

.narrow { max-width: var(--narrowwidth); margin: 1rem auto; }

/* FORM */
form {
  gap: 1rem;
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
}

form span { font-size: smaller; }

@media only screen and (max-width: 600px) {
  form { margin: 0; }
}

label {
  margin: 1rem 0 0;
  font-weight: 600;
}

textarea,
input[type=text],
input[type=email],
input[type=submit] {
  outline: none;
  box-shadow: none;
  border: 1px solid var(--borders);
}

textarea,
input[type=text],
input[type=email] {
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--fg-color);
}

textarea:focus,
input[type=text]:focus,
input[type=email]:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; }

input[type=submit] { margin-top: 2em; }

.form-container {
  width: 100%;
}

.form-container *:not(.btn) {
  text-align: left !important;
}

/* LINKS */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

section { margin: 0; }

.icon-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 6px;
  transition: all 100ms ease;
  margin: 1rem 0 2rem 0;


  &.centered {
    justify-content: center;
  }

  &:hover {
    text-decoration: underline;
  }

  span {
    font-size: var(--defaultsize);
  }
  svg {
    width: 24px;
    height: 24px;
  }
}

/* ENTRIES */
.entry {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 4px;
  background-color: var(--card-bg);
  color: var(--fg-color);
  border: 1px solid var(--borders);
}

.entry:focus {
  border-color: var(--accent);
}

select.entry {
  appearance: none;
  cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* BOXED LIST */
.boxed-list {
  background-color: var(--card-bg);
  border-radius: 8px;
  margin: 8px 0;
  border: 1px solid var(--borders);
}

.boxed-list .row {
  padding: 12px;
  display: flex;
  flex-direction: row;
  font-weight: normal;
  border-bottom: 1px solid var(--borders);
}

.boxed-list .row:last-child { border: none; }

.boxed-list .row label {
  font-size: smaller;
  margin: 0;
}

.boxed-list .row input { align-self: end; }

/* SWITCHES */
.switch-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-row {
  margin: 0;
  display: flex;
  gap: 12px;
  cursor: pointer;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.switch-row.disabled { opacity: 0.5; }

.switch-label { width: calc(100% - 56px); }

.switch-label-subtitle {
  display: block;
  opacity: 0.6;
}

.switch-visuals {
  position: relative;
  width: 40px;
  height: 24px;
  background-color: var(--btn-bg);
  border-radius: 12px;
}

.switch-visuals::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background-color: #fff;
  border-radius: 50%;
}

.switch-checkbox:checked + .switch-row .switch-visuals {
  background-color: var(--accent);
}

.switch-checkbox:checked + .switch-row .switch-visuals::after {
  transform: translateX(16px);
}

/* BUTTONS */
.btn {
  font-weight: 600;
  color: var(--btn-fg);
  background-color: var(--btn-bg);
  display: inline-block;
  font-size: 100%;
  white-space: nowrap;
  padding: 0.5rem 1.5rem;
  margin: 0.3rem;
  max-width: 20rem;
  text-align: center;
  text-decoration: none;
  border-radius: 4px;
  min-width: 4rem;
  border: none;
  cursor: pointer;
}

.btn:hover {
  opacity: 0.9;
  text-decoration: none;
}

.btn.standalone {
  display: block;
  padding: 0.5rem 2rem;
  margin: 1rem auto;
  max-width: 18ch;
}

.btn.disabled { opacity: 0.5; }

.btn.suggested {
  background-color: var(--accent);
  color: #fff;
}

.btn.donate {
  background-color: #333;
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .btn.donate {
    background-color: #666;
  }
}

button.btn {
  appearance: none;
}

.btn.receipt-submit {
  max-width: none;
  width: fit-content;
}

/* LAYOUT */
.container {
  margin: 2rem 0;
  padding: 0;
  display: grid;
  flex-grow: 1;
  gap: 0 var(--grid-gap);
  grid-template-columns:
    [full-start] minmax(0, 1fr)
    [main-start] repeat(5, minmax(1rem, calc(var(--pagewidth)/5)))
    [main-end] minmax(0, 1fr)
    [full-end];
}

.container * { grid-column: main; }
.full { grid-column: full; text-align: center; }

@media only screen and (max-width: 700px) {
  .left-text { grid-column: main; }
  .right-img { grid-column: main; order: -1; }
  .right-img img { max-width: 100%; }
}

/* COMPONENTS */
.small-print {
  font-size: 0.9em;
  text-align: center;
  max-width: 26em;
  margin: 1rem auto;
}

.message {
  font-size: smaller;
  border-radius: 4px;
  padding: 0.5em 1.5em;
  margin: 1em auto;
  text-align: center;
  max-width: 90%;
  background-color: #e8f0fe;
  color: #1a4b8c;
}

.message.hidden {
  display: none;
  visibility: hidden;
}

.message.inline {
  padding: 0;
  margin: 0 auto;
  background-color: transparent !important;
  color: var(--accent);
}

.message.inline.warning { color: #b86600; }
.message.inline.error { color: #c00; }
.message.warning { background-color: #fff3cd; color: #664d03; }
.message.error { background-color: #f8d7da; color: #842029; }

@media (prefers-color-scheme: dark) {
  .message { background-color: #1e3a5f; color: #a8c7f0; }
  .message.warning { background-color: #4a3c00; color: #ffd24d; }
  .message.error { background-color: #4a1c1c; color: #f5a5a5; }
  .message.inline.warning { color: #ffd24d; }
}

/* HERO */
.hero {
  flex-shrink: 0;
  color: #222;
  background: #f4e4cb;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.hero .title {
  font-weight: 500;
  font-size: 1.2rem;
}

.hero a { color: inherit; }

.hero .btn {
  color: #222;
  background-color: transparent;
  border: 1px solid #222;
}

.hero .btn:hover { background-color: rgba(0,0,0,0.05); }

.hero .btn.suggested {
  color: #fff;
  background-color: var(--accent);
  border-color: var(--accent);
}

.hero.compact {
  min-height: 10vh;
}

.hero.compact div {
  width: 100%;
  max-width: var(--pagegridwidth);
}

.hero.compact div > p,
.hero.compact div > h1 {
  text-align: start;
  margin: 0 0 1rem 0;
  padding: 0 var(--grid-gap);
}

.hero section.header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: var(--pagegridwidth);
  margin: 1rem auto;
  padding: 0 var(--grid-gap);
}

@media only screen and (max-width: 700px) {
  .hero section.header { flex-direction: column; }
  .hero section.header .nav { justify-content: center; }
}

#logo {
  font-weight: 700;
  font-size: 1.2rem;
}

#logo a {
  text-decoration: none;
  color: #222;
}

section.header ul.nav {
  min-height: 50px;
  margin: 0 0 0 -2em;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
  max-width: var(--pagewidth);
}

section.header li {
  list-style: none;
  margin-bottom: 1rem;
}

ul.nav a {
  display: inline-block;
  padding: 0.3rem 1rem;
  text-decoration: none;
  font-weight: 500;
  color: #222;
  border-radius: 4px;
  margin: 0 0.1rem;
}

ul.nav a:hover { background-color: rgba(0,0,0,0.05); }
ul.nav a.active { background-color: rgba(0,0,0,0.1); }
ul.nav p { display: inline-block; padding: 0.3rem 1rem; margin: 0; }

@media (prefers-color-scheme: dark) {
  .hero { color: #eee; background: #293a56; }
  .hero .btn { color: #eee; border-color: #eee; }
  .hero .btn:hover { background-color: rgba(255,255,255,0.1); }
  ul.nav a { color: #eee; }
  ul.nav a:hover { background-color: rgba(255,255,255,0.1); }
  ul.nav a.active { background-color: rgba(255,255,255,0.2); }
  #logo a { color: #eee; }
}

/* ONE-TIME DONATION */
#one-time .cards {
  grid-template-columns: 1fr;
  min-height: 280px;
}

#one-time .cards .card {
  justify-self: center;
  max-width: 480px;
  margin: 0;
}

#one-time .cards.two-column { grid-template-columns: repeat(2, 1fr); }

#one-time .entry {
  padding: 12px;
  border-radius: 4px;
  font-size: 16px;
}

#one-time #suggestion {
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  display: none;
}

#one-time #suggestion.visible { display: flex; }
#one-time #suggestion.fade-in { opacity: 1; }
#one-time #suggestion .btn { text-align: center; }
#one-time #suggestion img { height: 96px; width: 96px; }

@media only screen and (max-width: 950px) {
  #one-time .cards { grid-template-columns: 1fr; }
  #one-time .cards .card { width: 100%; }
  #one-time .cards.two-column { grid-template-columns: 1fr; }
}

/* SUPPORTERS */
#supporters {
  text-align: center;
  background: var(--card-bg);
}

#sponsors,
#friends-of-gnome {
  display: flex;
  gap: 2rem;
  margin: 3rem 0;
  flex-wrap: wrap;
}

#sponsors { justify-content: center; }
#sponsors a { display: block; max-height: 40px; }
#sponsors a svg { height: 30px; }

#friends-of-gnome { justify-content: space-between; }

.friend-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex-basis: 100px;
}

.friend-member img {
  width: 60px;
  height: 60px;
  border-radius: 30px;
}

.friend-member .member-name {
  font-size: 0.9rem;
  text-align: center;
  max-width: 120px;
  word-wrap: break-word;
}

/* ACTIVATION FORM */
#avatar-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

#avatar-preview.hidden { display: none; }
#avatar-preview img { height: 60px; width: 60px; }

#avatar-preview span {
  margin: 0;
  opacity: 0.6;
  font-weight: 600;
  font-size: smaller;
}

/* SUCCESS PAGE */
#success {
  text-align: center;
  justify-self: center;
  margin-top: 3em;
  max-width: 800px;
}

#success h1 { margin-top: 0; }
#success .btn { margin-top: 2rem; }

#success .avatar > img {
  height: 128px;
  width: 128px;
  border-radius: 50%;
  margin: 0 auto;
}

/* SHARE WIDGET */
#share-widget #links-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 1em;
  justify-content: center;
  margin: 2em auto;
  max-width: 320px;
}

#share-widget .sharelink {
  opacity: 0.5;
  flex-basis: 20%;
  align-self: flex-start;
  height: 40px;
  width: 40px;
}

#share-widget .sharelink:hover { opacity: 0.7; }

@media only screen and (max-width: 480px) {
  #share-widget .sharelink { flex-basis: 30%; }
}

@media (prefers-color-scheme: dark) {
  #share-widget .sharelink { filter: invert(1); }
}

/* CARDS */
.container .cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 0.5rem 0 3rem;
}

.card {
  grid-column: auto;
  text-decoration: none;
  background-color: var(--card-bg);
  color: var(--fg-color);
  padding: 1.5em;
  border-radius: 8px;
  gap: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border: 1px solid var(--borders);
}

.card.flat {
  background-color: transparent;
  border: none;
}

.card * { text-align: center; }
.card h2, .card h4 { margin: 0; font-size: 1.1rem; }
.card p { margin: 0; }

.card ul {
  padding: 0 0 0 1rem;
  font-size: smaller;
}

.card ul li { text-align: left; }

.card img {
  height: 160px;
  width: 160px;
  align-self: center;
  justify-self: center;
  opacity: 0.7;
}

.card .btn {
  width: calc(100% - 2em);
  margin-top: auto;
  align-self: center;
}

.card .btn-group {
  margin-top: auto;
  align-self: center;
}

.card .btn-group .btn {
  width: calc(100% - 2em);
  margin-top: 6px;
}

@media only screen and (max-width: 1024px) {
  .container .cards { grid-template-columns: 1fr; }
  .card { justify-self: center; width: 480px; }
}

@media only screen and (max-width: 480px) {
  .card { width: 100%; }
}

.colored-row {
  background-color: var(--card-bg);
  padding: 2rem 0;
}

.colored-row .container { margin-top: 0; }

/* FOOTER */
.container:has(+ footer) { margin-bottom: 4rem; }

footer {
  background-color: #333;
  padding: 2rem 0 4rem;
  color: #fff;
  text-align: center;
  flex-shrink: 0;
}

footer a {
  text-decoration: none;
  font-weight: 600;
  color: #fff;
  display: block;
  margin: auto;
}

footer .copy { font-size: 70%; }

ul.bottomlinks {
  column-width: 12rem;
  column-gap: 12px;
  line-height: 1.8rem;
  max-width: var(--pagegridwidth);
  margin: 0 auto 4rem;
}

ul.bottomlinks li {
  display: block;
  list-style: none;
  text-align: left;
  white-space: nowrap;
}

ul.bottomlinks li > a {
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: transparent;
}

ul.bottomlinks li > a:hover { text-decoration-color: #fff; }

ul.bottomlinks li > a.btn {
  margin: 0;
  margin-top: 1em;
  padding: 0.4em 3em;
}

@media only screen and (max-width: 600px) {
  ul.bottomlinks {
    font-size: 80%;
    column-count: 2;
    column-width: auto;
  }
}

a.social { width: 32px; height: 32px; margin: 0; }

.socials {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: baseline;
  margin: 48px 6px 0 0;
  gap: 12px;
}

.social { fill: rgba(255,255,255,0.6); }
.social:hover { fill: rgba(255,255,255,1); }
