/* Layout + components. Uses tokens from tokens.css. */

.container {
  width: min(100% - 2 * var(--space-3), var(--container));
  margin-inline: auto;
}

.section {
  padding-block: var(--space-7);
}

.section--alt {
  background: var(--color-surface);
}

.section__header {
  max-width: 40rem;
  margin-bottom: var(--space-5);
}

.section__header p {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
}

.section__header--dark p {
  color: var(--color-black);
}

/* Header / navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-divider);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  display: flex;
  align-items: center;
  height: 100%;
}

.logo img {
  height: calc(var(--header-height) - 0.75rem);
  width: auto;
}

.nav__list {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
}

.nav__list a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
}

/* Current page and hover: dark text with a dusty rose underline */
.nav__list a:hover,
.nav__list a[aria-current="page"] {
  color: var(--color-black);
  text-decoration: underline;
  text-decoration-color: var(--color-divider);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.nav__list a[aria-current="page"] {
  font-weight: 600;
}

/* "Kurser" with a dropdown (Våra kurser / Kursschema). Opens on hover and
   when tabbing into it with the keyboard. */
.nav__item--sub {
  position: relative;
}

/* Small arrow after "Kurser" that turns when the menu opens */
.nav__item--sub > a::after {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin-left: 0.45em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
  transition: transform 0.2s;
}

.nav__item--sub:hover > a::after,
.nav__item--sub:focus-within > a::after {
  transform: translateY(0.05em) rotate(225deg);
}

.nav__sub {
  position: absolute;
  top: calc(100% + var(--space-3));
  left: 50%;
  min-width: 12rem;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  box-shadow: 0 10px 30px rgb(60 40 30 / 0.12);
  z-index: 60;
  /* Hidden until hover; fades and slides in */
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -0.4rem);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
}

/* Invisible bridge over the gap, so the menu stays open while the mouse
   moves down to it */
.nav__sub::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--space-3) - 1px) 0 100% 0;
}

.nav__item--sub:hover .nav__sub,
.nav__item--sub:focus-within .nav__sub {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.nav__sub a {
  display: block;
  padding: var(--space-2) var(--space-3);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .nav__sub,
  .nav__item--sub > a::after {
    transition: none;
  }
}

/* "Kurser" is marked as current on both of its pages */
.nav__item--sub:has(.nav__sub [aria-current="page"]) > a {
  color: var(--color-black);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--color-divider);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.nav__toggle {
  display: none;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: 1px solid var(--color-black);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  color: var(--color-black); /* phones otherwise show button text in blue */
  cursor: pointer;
}

@media (max-width: 48rem) {
  .nav__toggle {
    display: block;
  }

  .nav__list {
    display: none;
    position: absolute;
    inset: var(--header-height) 0 auto 0;
    flex-direction: column;
    gap: 0;
    padding-bottom: var(--space-2);
    background: var(--color-bg);
    /* A clear edge, and the page below is dimmed, so it's obvious where the
       menu ends. clip-path keeps the dimming off the header above. */
    border-bottom: 2px solid var(--color-divider);
    box-shadow: 0 0 0 100vmax rgb(30 20 15 / 0.35);
    clip-path: inset(0 0 -100vmax 0);
  }

  .nav__list.is-open {
    display: flex;
  }

  .nav__list a {
    display: block;
    padding: var(--space-3);
  }

  /* Phone menu: the course pages are always shown, indented under "Kurser" */
  .nav__item--sub > a::after {
    display: none;
  }

  .nav__sub {
    position: static;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav__sub::before {
    display: none;
  }

  .nav__sub a {
    padding-left: var(--space-6);
    font-weight: 400;
  }
}

/* Hero */
.hero {
  padding-block: var(--space-7);
}

.hero__content {
  max-width: 44rem;
}

/* Dancing figure beside the intro (decorative). The image comes first in
   the HTML so it sits above the text on phones, small and centred. */
.hero__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-6);
}

.hero__figure {
  grid-column: 2;
  grid-row: 1;
  width: 15rem;
  height: auto;
}

@media (max-width: 48rem) {
  .hero__inner {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .hero__figure {
    grid-column: 1;
    width: 7rem;
  }
}

.hero__lead {
  margin-top: var(--space-3);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}

.hero__actions,
.section__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* Buttons: rounded, black like the logo */
.btn {
  display: inline-block;
  padding: var(--space-3) var(--space-5);
  border-radius: 999px;
  border: 1px solid var(--color-button);
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn--primary {
  background: var(--color-button);
  color: var(--color-on-button);
}

.btn--primary:hover {
  background: var(--color-button-hover);
  border-color: var(--color-button-hover);
  color: var(--color-on-button);
}

.btn--ghost {
  background: transparent;
  color: var(--color-button);
}

.btn--ghost:hover {
  background: var(--color-button);
  color: var(--color-on-button);
}

/* Cards / grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-4);
}

.card {
  padding: var(--space-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card p {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
}

.card ul {
  margin-top: var(--space-2);
  padding-left: 1.25rem;
  color: var(--color-text-muted);
}

.card li + li {
  margin-top: var(--space-1);
}

/* Course overview (Kurser page): one course per row, text on the left and
   an optional picture (.course__image) on the right */
.courses {
  display: grid;
  gap: var(--space-4);
}

/* Each course is a <details>: the heading is the clickable summary */
.course__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  cursor: pointer;
  list-style: none;
}

.course__summary::-webkit-details-marker {
  display: none;
}

.course__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

/* Seat status badge: many / few / full */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.75em;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: currentColor;
}

.status--many { background: #e3efe1; color: #2f6b3a; }
.status--few  { background: #f7ead0; color: #7a5200; }
.status--full { background: #f6dede; color: #9b2c2c; }
.status--closed { background: #e8e3de; color: #57504a; }

/* Plus sign that turns into a minus when the course is open */
.course__summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--color-button);
  transition: transform 0.2s;
}

.course[open] .course__summary::after {
  content: "−";
}

.course__summary:hover h3 {
  text-decoration: underline;
  text-decoration-color: var(--color-divider);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

/* Christmas camps: a still snowflake picture in the corner when opened */
.course--winter[open] {
  background-image: url("../assets/images/snoflingor.svg");
  background-repeat: no-repeat;
  background-position: right var(--space-5) bottom var(--space-5);
  background-size: 9rem;
}

@media (max-width: 48rem) {
  .course--winter[open] {
    background-position: right var(--space-3) bottom var(--space-3);
    background-size: 5rem;
  }
}

.course__content {
  display: grid;
  gap: var(--space-5);
  align-items: start;
  margin-top: var(--space-3);
}

.course__content:has(.course__image) {
  grid-template-columns: 1fr minmax(12rem, 22rem);
}

.course__body {
  max-width: 44rem;
}

.course__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}

@media (max-width: 48rem) {
  .course__content:has(.course__image) {
    grid-template-columns: 1fr;
  }
}

.course__facts {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.course__facts div {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: var(--space-2);
}

.course__facts dt {
  font-weight: 600;
}

.course__facts dd {
  margin: 0;
}

.section__header a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Values (About page): plain text columns with a thin line on top,
   so they don't read as buttons */
.value {
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.value p {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
}

/* Placeholder block for content still to come */
.placeholder {
  display: grid;
  place-items: center;
  min-height: 12rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text-muted);
}

/* About page: company intro (logo + text) */
.about {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: var(--space-6);
  align-items: center;
}

.about__logo .placeholder,
.about__logo img {
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  object-fit: contain;
}

.about__text p {
  margin-top: var(--space-3);
  max-width: 40rem;
}

/* About page: founders side by side */
.founders {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.founder__photo {
  width: 100%;
  max-width: 18rem;
  aspect-ratio: 4 / 5;
  min-height: 0;
  height: auto;
  object-fit: cover;
  object-position: 50% 40%;
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
}

.founder__photo.placeholder {
  background: var(--color-surface);
  border-color: var(--color-divider);
}

.founder__role {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

@media (max-width: 48rem) {
  .about,
  .founders {
    grid-template-columns: 1fr;
  }

  .about__logo {
    max-width: 10rem;
  }
}

/* Contact form */
.form {
  display: grid;
  gap: var(--space-3);
  max-width: 32rem;
}

.form label {
  display: grid;
  gap: var(--space-1);
  font-weight: 500;
}

.form input,
.form select,
.form textarea {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font: inherit;
}

.form .btn {
  justify-self: start;
}

.form--wide {
  max-width: 52rem; /* wide enough for the longest label on one line */
}

/* Two fields side by side (stacks on small screens) */
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

/* A group of fields for one person (e.g. Vårdnadshavare 1) */
.form__group {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.form__group legend {
  padding: 0;
  margin-bottom: var(--space-1);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
}

/* A question with Yes/No buttons (e.g. photo consent): the question looks like a normal label */
.form__choice {
  gap: var(--space-2);
}

.form__choice legend {
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
}

.form__options {
  display: flex;
  gap: var(--space-5);
}

/* If a label still wraps, keep the two inputs in a row level with each other */
.form__row label {
  grid-template-rows: 1fr auto;
  align-items: end;
}

.form__optional {
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Long text pages (e.g. integritetspolicy.html) */
.prose {
  max-width: 44rem;
}

.prose h2 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

.prose p,
.prose ul {
  margin-bottom: var(--space-3);
}

.prose ul {
  padding-left: var(--space-4);
}

.prose li + li {
  margin-top: var(--space-1);
}

.prose__lead {
  margin-top: var(--space-2);
  font-size: var(--text-lg);
}

/* Links inside running text: the text color, underlined, so they stay
   readable whatever --color-primary is */
.prose a,
.form__note a,
.form__check a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Spam trap (honeypot): moved off-screen so people never see or tab to it */
.form__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__note {
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* Message after sending (or failing to send) a form */
.form-status {
  max-width: 44rem;
  padding: var(--space-3) var(--space-4);
  font-weight: 500;
  border-radius: var(--radius);
  border-left: 4px solid;
}

.form-status--success {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-secondary);
}

.form-status--error {
  background: #fdecec;
  color: #7f1d1d;
  border-color: var(--color-danger);
}

.form-status:focus {
  outline: none;
}

.form label.form__check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-weight: 400;
}

.form__check input {
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.2rem;
  padding: 0;
  flex-shrink: 0;
}

@media (max-width: 36rem) {
  .form__row {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.site-footer {
  padding-block: var(--space-5);
  background: var(--color-secondary);
  color: var(--color-on-secondary);
  font-size: var(--text-sm);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
}

.site-footer a {
  color: inherit;
}

.site-footer .container {
  align-items: center;
}

.footer__links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.social {
  display: flex;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
}

.social a {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  transition: background-color 0.15s;
}

.social a:hover {
  background: rgb(255 255 255 / 0.12);
}

.social svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Start page: hand-picked Instagram posts inside the black footer.
   The posts are shown at half size with zoom (Instagram draws them at 280px). */
.site-footer .footer-insta {
  display: block;
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid rgb(255 255 255 / 0.2);
  text-align: center;
}

.footer-insta h2 {
  color: inherit;
  margin-bottom: var(--space-2);
}

.footer-insta p {
  margin-bottom: var(--space-4);
}

.footer-insta a:not(.btn) {
  text-decoration: underline;
}

.insta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  align-items: flex-start;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius);
}

.insta .instagram-media {
  width: 280px !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  zoom: 0.5;
}

.insta blockquote.instagram-media {
  background: var(--color-surface);
  color: var(--color-black);
  padding: var(--space-4);
}

/* Phones: only the latest Instagram post (the last one in the list), with less spacing */
@media (max-width: 48rem) {
  .insta > :not(:last-child) {
    display: none !important;
  }

  .insta {
    padding: var(--space-3);
    margin-bottom: var(--space-3);
  }

  .footer-insta p {
    margin-bottom: var(--space-3);
  }

  /* The thin line under the Instagram part is hard to see on small screens */
  .site-footer .footer-insta {
    border-bottom: 1px solid rgb(255 255 255 / 0.4);
  }
}
