/* hipko.openmat.fi. The look follows Ruori's (ruori.ai/demo): its tokens, header, hero, card
   and buttons. Light scheme only, on purpose. */

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-600-normal.woff2') format('woff2');
}

:root {
  --turquoise: #038b94;
  --deep-turquoise: #114b59;
  --deep-turquoise-active: #35626f;
  --orange: #e86717;
  --nippon-red: #bc002d;
  --light-antique-blue: #8c9fae;
  --desert-sand: #b38061;
  --light-sand: #f5efdd;
  --sand: #ffdcb6;

  --brand: var(--deep-turquoise);
  --brand-hover: var(--deep-turquoise-active);
  --highlight: var(--turquoise);
  --link: #027a82;
  --accent: var(--orange);
  --alert: var(--nippon-red);
  --ink: #212121;
  --ink-soft: #5f686d;
  --line: #c8cdd0;
  --line-light: #ecedee;
  --pale: #edf6f7;
  --pale-soft: #f4fafa;
  --grey-soft: #f7f7f8;
  --white: #ffffff;
  --surface: var(--white);
  --surface-pale: var(--pale);

  /* who a class is for: the stripe down the left of its card */
  --aud-aikuiset: var(--light-antique-blue);
  --aud-lapset: var(--orange);
  --aud-perhe: var(--turquoise);
  --aud-pienet: var(--desert-sand);

  --radius: 2px;
  --sans: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0; background: var(--white); color: var(--ink); font: 400 18px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-text-size-adjust: 100%;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0; }
p, ul, fieldset { margin: 0; padding: 0; }
ul { list-style: none; }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--deep-turquoise); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, .chip input:focus-visible + span {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

/* ---- header and hero ---- */
.site-header { background: var(--deep-turquoise); color: var(--white); padding-inline: 1.5rem; }
.bar { padding-block: 0.9rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; flex-wrap: wrap; }
.wordmark .name { font-size: 1.35rem; font-weight: 600; letter-spacing: -0.005em; }
.kicker { padding: 0.1rem 0.75rem; border: 1px solid var(--white); border-radius: 999px; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.hero { background: linear-gradient(to right, var(--brand) 0%, var(--highlight) 100%); color: var(--white); padding-inline: 1.5rem; }
.hero-inner { padding-block: 1.1rem 3.2rem; }
.hero-title { font-size: 1.6rem; letter-spacing: -0.01em; margin-bottom: 0.1rem; }
.hero-lead { font-size: 1rem; color: #e4eefa; }
.hero-lead a { color: var(--white); }

/* ---- main: light sand, deepening to sand at the edges; everything on it sits in a card ---- */
main { flex: 1; background-color: var(--light-sand); box-shadow: inset 0 0 10vw var(--sand); border-top: 10px solid var(--pale-soft); padding: 0 1.5rem 2.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 6px rgb(17 75 89 / 0.08); }
.panel { margin-top: -2.5rem; }
.results { margin-top: 1rem; padding: 1rem 1.25rem 1.25rem; }

/* ---- filters ---- */
.panel > summary { cursor: pointer; font-weight: 600; padding: 0.7rem 1.25rem; color: var(--brand); }
.filters { padding: 0.25rem 1.25rem 1.1rem; }
.label, legend { display: block; padding: 0; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); margin-bottom: 0.3rem; }
input[type="search"], input[type="number"] {
  font: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--ink-soft); border-radius: var(--radius); padding: 0.4rem 0.6rem; width: 100%; max-width: 26rem;
}
input[type="number"] { width: 6.5em; }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 0.9rem 1.75rem; margin-top: 0.9rem; }
.group { border: 0; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: block; padding: 0.15rem 0.65rem; border: 1px solid var(--brand); border-radius: var(--radius); background: var(--white); color: var(--brand); font-size: 0.9375rem; font-weight: 600; user-select: none; }
.chip:hover span { background: var(--pale); }
.chip input:checked + span { background: var(--brand); color: var(--white); }
.chip:hover input:checked + span { background: var(--brand-hover); }
.age { display: flex; align-items: center; gap: 0.5rem; }
.teachers { max-height: 9.5rem; overflow: auto; margin-top: 0.5rem; padding: 3px; }
.toggle { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9375rem; cursor: pointer; align-self: end; }
.toggle input { margin-top: 0.35rem; accent-color: var(--brand); }
.more { margin-top: 0.9rem; border-top: 1px solid var(--line-light); padding-top: 0.6rem; }
.more > summary { cursor: pointer; font-weight: 600; color: var(--link); }
.topic > summary { cursor: pointer; }

/* ---- week bar ---- */
button { font: 600 1rem var(--sans); cursor: pointer; }
.week button:not(.link-button) { appearance: none; border: 1px solid var(--brand); border-radius: var(--radius); background: var(--white); color: var(--brand); font-size: 1.25rem; line-height: 1; padding: 0.3rem 0.8rem; }
.week button:not(.link-button):hover { background: var(--pale); }
.link-button { color: var(--link); padding: 0.2rem 0; border: 0; border-bottom: 3px solid transparent; background: none; }
.link-button:hover { color: var(--deep-turquoise); border-bottom-color: var(--line); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1.5rem; }
.week { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.week h2 { font-size: 1.25rem; min-width: 15em; text-align: center; font-variant-numeric: tabular-nums; }
.summary { display: flex; gap: 1rem; align-items: center; color: var(--ink-soft); font-size: 1rem; }
.banner, .flag { background: #fbeaea; color: var(--alert); border-radius: var(--radius); }
.banner { margin-top: 0.75rem; padding: 0.5rem 0.75rem; }
.empty { margin: 1.5rem 0 0.5rem; color: var(--ink-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; margin-top: 0.6rem; font-size: 0.8125rem; color: var(--ink-soft); }
.legend li { border-left: 4px solid var(--aud-aikuiset); padding-left: 0.4rem; line-height: 1.2; }

/* ---- the week: seven columns side by side ---- */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.75rem; align-items: start; }
.day { min-width: 0; }
.day h2 { font-size: 1rem; padding: 0.35rem 0.4rem; border-top: 3px solid var(--highlight); background: var(--white); position: sticky; top: 0; z-index: 1; }
.day .date { font-weight: 400; color: var(--ink-soft); }
.day.is-today h2 { border-top-color: var(--accent); }
.today { margin-left: 0.4rem; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.03em; background: var(--nippon-red); color: var(--white); padding: 0 0.35rem; border-radius: var(--radius); vertical-align: 2px; white-space: nowrap; }
.day ul { display: grid; gap: 0.4rem; margin-top: 0.4rem; }
.none { margin-top: 0.4rem; padding: 0.4rem; font-size: 0.875rem; color: var(--ink-soft); }

/* Weekdays: white cards. Saturday and Sunday: the pale surface. */
.session { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--aud-aikuiset); border-radius: var(--radius); padding: 0.35rem 0.5rem 0.45rem; font-size: 0.875rem; line-height: 1.35; overflow-wrap: anywhere; }
.day.is-weekend h2, .day.is-weekend .session { background: var(--surface-pale); }
.aud-lapset-nuoret { border-left-color: var(--aud-lapset) !important; }
.aud-perhe { border-left-color: var(--aud-perhe) !important; }
.aud-taapero, .aud-tiikeri { border-left-color: var(--aud-pienet) !important; }
.session.room-use { border-left-style: dashed; }
.session.closed > :not(.flag) { opacity: 0.5; }
.session.closed h3 { text-decoration: line-through; }
.time { font-weight: 600; font-variant-numeric: tabular-nums; }
.time .note { font-weight: 400; color: var(--ink-soft); }
.session h3 { font-size: 0.9375rem; line-height: 1.25; }
.where, .meta { color: var(--ink-soft); }
.where strong { color: var(--ink); font-weight: 600; }
.badges { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.25rem; }
.badges span { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--brand); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 0.3rem; background: var(--white); }
.topic { margin-top: 0.35rem; border-top: 1px solid var(--line-light); padding-top: 0.3rem; }
.topic-label { color: var(--ink-soft); }
.topic p { margin-top: 0.2rem; color: var(--ink-soft); }
.flag { margin-top: 0.35rem; padding: 0.15rem 0.4rem; font-weight: 600; }

/* ---- footer: the same sand, without the top band ---- */
.site-footer { background-color: var(--light-sand); box-shadow: inset 0 0 10vw var(--sand); color: #50585c; font-size: 1rem; padding-inline: 1.5rem; }
.site-footer a { color: var(--ink); }
.footer-inner { padding-block: 1.5rem 2.5rem; max-width: 75rem; }
.footer-inner .fine { margin-top: 0.4rem; font-size: 0.9375rem; }

/* Wide: the filters are always open, their fold line gone. */
@media (min-width: 64rem) {
  .panel > summary { display: none; }
  .filters { padding-top: 1rem; }
}
/* Narrow: seven columns do not fit, so one day shows at a time. The bar that names the day and
   steps through days and weeks stays at the top of the screen while its classes scroll. */
@media (max-width: 63.99rem) {
  .days { grid-template-columns: 1fr; }
  .results { padding-top: 0; }
  .toolbar { position: sticky; top: 0; z-index: 2; background: var(--white); margin-inline: -0.75rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); }
  .week { flex-wrap: nowrap; width: 100%; gap: 0.35rem; }
  .week h2 { white-space: nowrap; }
  .week button:not(.link-button) { padding: 0.35rem 0.7rem; }
  #this-week { position: absolute; right: 0.75rem; bottom: 0.45rem; }
  .summary { width: 100%; min-height: 1.6rem; padding-right: 4.5rem; font-size: 0.9375rem; white-space: nowrap; gap: 0.75rem; }
  .summary .link-button, #this-week { font-size: 0.9375rem; }
  .day.is-weekend .none { background: none; }
  /* The main filters keep their height down instead of their width: each group is one row of
     chips that scrolls sideways, so three groups take three lines and every chip is one tap. */
  #groups-main { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; margin-top: 0.7rem; }
  #groups-main .chips {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    padding: 3px 2rem 3px 3px; margin: -3px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 2rem), transparent);
  }
  #groups-main .chips::-webkit-scrollbar { display: none; }
  #groups-main .chip { flex: none; }
  #groups-main .chip span { white-space: nowrap; padding-block: 0.3rem; }
  .panel > summary { padding-block: 0.5rem; }
  .filters { padding-bottom: 0.8rem; }
  .session { font-size: 0.9375rem; padding: 0.5rem 0.65rem; }
  .session h3 { font-size: 1rem; }
  .week h2 { min-width: 0; flex: 1; font-size: 1.0625rem; }
  main, .site-header, .hero, .site-footer { padding-inline: 0.75rem; }
  .results { padding-inline: 0.75rem; }
}
