/* =========================================================================
   Paper Pencil Pixel — Colors & Type (inlined)
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: var(--font-sans);

  /* Brand */
  --ppp-red:         #DA4B26;
  --ppp-red-deep:    #B23A1B;
  --ppp-red-soft:    #F7E4DE;

  /* Neutrals */
  --ink:             #0F0F0F;
  --ink-2:           #2B2B2B;
  --ink-3:           #6B6B6B;
  --ink-4:           #9A9A9A;
  --rule:            #E5E3DE;
  --paper:           #F4F1EC;
  --paper-2:         #EDEAE4;
  --bone:            #FAF8F4;
  --white:           #FFFFFF;

  /* Semantic */
  --bg:              var(--paper);
  --bg-alt:          var(--paper-2);
  --bg-surface:      var(--bone);
  --fg:              var(--ink);
  --fg-muted:        var(--ink-3);
  --fg-subtle:       var(--ink-4);
  --accent:          var(--ppp-red);
  --accent-hover:    var(--ppp-red-deep);
  --border:          var(--rule);
  --border-strong:   var(--ink);

  /* Type scale */
  --fs-xs:    12px;
  --fs-sm:    14px;
  --fs-base:  18px;
  --fs-md:    21px;
  --fs-lg:    28px;
  --fs-xl:    40px;
  --fs-2xl:   56px;

  /* Motion */
  --ease-out:  cubic-bezier(.2,.7,.2,1);
  --ease-in:   cubic-bezier(.5,0,.8,.3);
  --dur-fast:  140ms;
  --dur-med:   260ms;

  /* Shadows */
  --shadow-soft: 0 1px 2px rgba(15,15,15,.04), 0 8px 24px rgba(15,15,15,.06);
  --shadow-lift: 0 2px 4px rgba(15,15,15,.06), 0 16px 48px rgba(15,15,15,.12);
}

/* =========================================================================
   Base
   ========================================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Links — animated underline (from index.html) */
a, a:visited {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.28s var(--ease-out);
  padding-bottom: 1px;
}
a:hover { background-size: 100% 1px; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =========================================================================
   Layout shell
   ========================================================================= */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 40px 80px;
}
@media (max-width: 640px) {
  .shell { padding: 24px 20px 48px; }
}

/* =========================================================================
   Sticky header unit (masthead + toolbar)
   ========================================================================= */
.stickybar {
  background: var(--paper);
  z-index: 40;
  will-change: transform;
}
body[data-sticky="on"] .stickybar {
  position: sticky;
  top: 0;
  margin: -48px -40px 0;
  padding: 16px 40px 0;
  border-bottom: 1px solid transparent;
  contain: layout paint;
}
@media (max-width: 640px) {
  body[data-sticky="on"] .stickybar { margin: -24px -20px 0; padding: 12px 20px 0; }
}
body[data-sticky="on"] .stickybar.is-stuck {
  border-bottom-color: var(--ink);
}
body[data-sticky="on"] .masthead {
  transition: padding-bottom 180ms var(--ease-out);
}
body[data-sticky="on"] .stickybar.is-stuck .masthead {
  padding-bottom: 10px;
  border-bottom-color: var(--rule);
}
body[data-sticky="on"] .mast-eyebrow,
body[data-sticky="on"] .mast-meta .sub {
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
  transition: grid-template-rows 180ms var(--ease-out), opacity 140ms var(--ease-out), margin 180ms var(--ease-out);
}
body[data-sticky="on"] .mast-eyebrow > *,
body[data-sticky="on"] .mast-meta .sub > * { min-height: 0; }
body[data-sticky="on"] .stickybar.is-stuck .mast-eyebrow,
body[data-sticky="on"] .stickybar.is-stuck .mast-meta .sub {
  grid-template-rows: 0fr;
  opacity: 0;
  margin: 0;
}
/* =========================================================================
   Masthead
   ========================================================================= */
.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: none;
}
.mast-left { display: flex; gap: 20px; align-items: flex-start; }
.mast-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ppp-red);
  margin-bottom: 8px;
}
.mast-title {
  font-size: clamp(34px, 5.2vw, 64px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -3px;
  color: var(--ink);
  margin: 0;
  max-width: 14ch;
}
.mast-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
  padding-top: 4px;
}
.mast-meta .year {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
.mast-meta .sub {
  font-size: 13px;
  color: var(--ink-3);
}
@media (max-width: 640px) {
  .masthead { flex-direction: column; }
  .mast-meta { align-items: flex-start; text-align: left; }
}

/* =========================================================================
   Toolbar
   ========================================================================= */
.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 0;
  flex-wrap: wrap;
}
.filters {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
  border-bottom: 1px solid var(--rule);
}
.filters::-webkit-scrollbar { display: none; }
.filter-indicator {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--ppp-red);
  transform: translateX(0);
  transition: transform var(--dur-med) var(--ease-out), width var(--dur-med) var(--ease-out);
  pointer-events: none;
}
.filter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-3);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.filter:hover { color: var(--ink); }
.filter[aria-pressed="true"] {
  color: var(--ink);
}
.tools { display: inline-flex; gap: 4px; align-items: center; }
.tool {
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
  cursor: pointer;
  color: var(--ink-3);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.tool:hover { color: var(--ink); border-color: var(--ink); }
.tool[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bone);
  border-color: var(--ink);
}
.tool svg { width: 16px; height: 16px; }
.tool-spacer {
  visibility: hidden;
  pointer-events: none;
}
@media (max-width: 639px) {
  .view-switcher { display: none !important; }
}
/* =========================================================================
   Page switch (Holiday Planner / Timetable) — segmented toggle
   ========================================================================= */
.page-switch {
  display: inline-flex;
  margin: 0 0 8px;
  border: 1px solid var(--rule);
  background: transparent;
}
.page-switch a {
  background: none;
  background-image: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--ink-3);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.page-switch a:hover { color: var(--ink); background-image: none; }
.page-switch a.active,
.page-switch a[aria-current="page"] {
  color: var(--bone);
  background: var(--ink);
}

/* =========================================================================
   Section headers
   ========================================================================= */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 56px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}
.section-head h2 {
  margin: 0;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.section-head .count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}

/* =========================================================================
   Footnote
   ========================================================================= */
.footnote {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-3);
}
.footnote .star { color: var(--ppp-red); font-weight: 700; }

/* =========================================================================
   Dark theme
   ========================================================================= */
html.dark body { background: #141310; color: #EDEAE4; }
html.dark {
  --paper: #141310; --paper-2: #1B1916; --bone: #1F1D19; --white: #25221D;
  --rule: #2E2B26; --ink: #F4F1EC; --ink-2: #D7D3CC; --ink-3: #9A958C; --ink-4: #5F5B54;
}
/* =========================================================================
   Theme switch
   ========================================================================= */
.theme-switch { display: inline-flex; align-items: center; cursor: pointer; }
.theme-switch input { display: none; }
.theme-switch .track {
  position: relative;
  box-sizing: border-box;
  width: 68px; height: 34px;
  border: 1px solid var(--rule);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: space-between;
  padding: 0 9px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.theme-switch:hover .track { border-color: var(--ink); }
.theme-switch .ico { width: 16px; height: 16px; color: var(--ink-3); z-index: 1; position: relative; transition: color var(--dur-fast) var(--ease-out); }
.theme-switch input:not(:checked) ~ .track .sun { color: var(--bone); }
.theme-switch input:checked ~ .track .moon { color: var(--bone); }
.theme-switch .knob {
  position: absolute;
  top: -1px; left: -1px;
  width: 34px; height: 34px;
  background: var(--ink);
  transition: transform 200ms var(--ease-out);
}
.theme-switch input:checked ~ .track .knob { transform: translateX(34px); }
html.dark .theme-switch .track { border-color: var(--rule); }

/* Utility */
.hidden { display: none !important; }
