/* ==========================================================
   CampusConnect Oma päivä
   1. Colors and fonts
   2. Base
   3. Header and navigation (phone: bottom tab bar)
   4. Page content
   5. Cards, pills and buttons
   6. Wide screens (sideways phone, tablet, laptop): sidebar
   ========================================================== */

/* 1. Colors and fonts */
:root {
  color-scheme: light;

  --color-background: #f3ecd8;
  --color-surface: #fbf7ec;
  --color-primary: #c9683b;
  --color-primary-deep: #a9542c;
  --color-primary-dark: #8c4a2d;
  --color-secondary: #3e6b53;
  --color-text: #1f2a22;
  --color-text-muted: #6b6a5e;
  --color-border: #d9cfb4;

  --font-heading: "Instrument Serif", Georgia, serif;
  --font-body: "Manrope", Helvetica, Arial, sans-serif;

  --radius: 16px;
  --sidebar-width: 220px;
}

/* 2. Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 400;
  line-height: 1.2;
}

h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
}

h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 1rem;
  font-weight: 700;
}

p {
  margin: 0;
}

a {
  color: var(--color-primary-dark);
}

img {
  max-width: 100%;
  height: auto;
}

:focus-visible {
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--color-surface);
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

/* 3. Header and navigation (phone: bottom tab bar) */
.app-header {
  padding: 1rem 1.25rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
}

.tabs {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  z-index: 5;
  transform: translateX(-50%);
}

.tabs ul {
  display: flex;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--color-primary-deep);
  border-radius: 999px;
  box-shadow: 0 6px 20px rgb(31 42 34 / 0.2);
}

.tabs a {
  display: block;
  min-width: 7rem;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  color: var(--color-surface);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.tabs a[aria-current] {
  background: var(--color-surface);
  color: var(--color-text);
}

/* 4. Page content */
main {
  max-width: 40rem;
  padding: 1.5rem 1.25rem 7rem;
}

.eyebrow,
.meta {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.app-footer {
  max-width: 40rem;
  padding: 0 1.25rem 7rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-weight: 600;
  text-decoration: none;
}

.hero {
  display: block;
  width: 100%;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
}

.list-spaced {
  margin-top: 1.5rem;
}

.link-list {
  margin: 0;
  padding-left: 1.25rem;
}

.link-list li + li {
  margin-top: 0.5rem;
}

.actions {
  margin-top: 2rem;
}

.big {
  font-size: 1.125rem;
  font-weight: 700;
}

ol {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

/* 5. Cards, pills and buttons */
.card-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

section.card {
  margin-top: 1rem;
}

.card-clickable {
  padding-right: 2.5rem;
}

/* A card heading that looks like h3 even when it is h2 */
.card-title,
.label {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
}

.label {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 400;
}

.card-link {
  color: inherit;
  text-decoration: none;
}

/* Makes the whole card clickable, not just the title */
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.card-clickable:hover {
  border-color: var(--color-primary);
}

.chevron {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 1.5rem;
}

.tag {
  margin-left: 0.5rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.75rem;
}

.pill {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.15rem 0.6rem;
  background: var(--color-border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.pill-green {
  background: var(--color-secondary);
  color: var(--color-surface);
}

.button {
  position: relative;
  z-index: 1;
  justify-self: start;
  margin-top: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--color-primary-deep);
  border-radius: 999px;
  color: var(--color-surface);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--color-primary-dark);
}

.button-secondary {
  background: none;
  border: 2px solid var(--color-primary-dark);
  color: var(--color-primary-dark);
}

.button-secondary:hover {
  background: var(--color-surface);
}

/* 6. Wide screens (sideways phone, tablet, laptop): sidebar */
@media (min-width: 640px) {
  .app-header {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    padding: 1.5rem 1rem;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
  }

  .tabs {
    position: static;
    margin-top: 2rem;
    transform: none;
  }

  .tabs ul {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0;
    background: none;
    box-shadow: none;
  }

  .tabs a {
    padding: 0.6rem 1rem;
    color: var(--color-text);
    text-align: left;
  }

  .tabs a:hover {
    background: var(--color-background);
  }

  .tabs a[aria-current] {
    background: var(--color-primary-deep);
    color: var(--color-surface);
  }

  main,
  .app-footer {
    margin-left: var(--sidebar-width);
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  main {
    padding-top: 2.5rem;
    padding-bottom: 2rem;
  }

  .app-footer {
    padding-bottom: 2rem;
  }
}

@media (min-width: 640px) and (max-height: 500px) {
  :root {
    --sidebar-width: 170px;
  }

  main {
    padding-top: 1.5rem;
  }

  .hero {
    height: 120px;
    object-fit: cover;
  }
}
