/* Kacper Hajdamowicz, personal site. One stylesheet, no build step.
   Colours live only in :root; tune them here and nowhere else.
   Shapes: buttons are pills, cards and the photo use --radius, inline code 6px. */

:root {
  /* Warm paper surfaces, dark ink, one yellow accent.
     The accent splits in two because #F1D302 only reaches 1.4:1 on paper:
     --accent is a FILL (buttons, highlights, rules) and always carries
     --on-accent ink on top; --accent-ink is the readable yellow, and the
     only one allowed to be text. */
  --bg: #FAF6EC;
  --bg-card: #F2EBD9;
  --text: #26241F;
  --text-muted: #605B4F;
  --border: #D5CBB0;
  --accent: #F1D302;
  --accent-hover: #D9BE00;
  --accent-ink: #6B5900;
  --on-accent: #26241F;
  /* Calendly's own page colour on the free plan (colour params ignored).
     Fills the booking frame below Calendly's content so it reads as one sheet. */
  --bg-sheet: #FFFFFF;
  /* Pixel accents: one dark and one light tone per area of work, taken from
     the brand marks in icons/techno (Power Apps, Copilot, Power BI, Power
     Automate). Decoration only, never text. */
  --pp-dark: #742774;
  --pp-light: #BB35A4;
  --ai-dark: #1F9A8A;
  --ai-light: #73B75D;
  --data-dark: #C9870E;
  --data-light: #E6AD10;
  --azure-dark: #1B44B1;
  --azure-light: #4894FE;

  --font-body: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;

  --radius: 12px;
  --content-width: 820px;
  --sidebar-width: 320px;
  --transition: 0.15s ease;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

/* Cross-document view transition: moving between pages cross-fades the
   viewport (about 0.25s) instead of flashing. Chrome, Edge and Safari;
   Firefox and file:// fall back to a plain navigation. */
@view-transition { navigation: auto; }

body {
  margin: 0;
  padding-left: var(--sidebar-width);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
p, dd, .post-desc { text-wrap: pretty; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }

.skip-link {
  position: absolute; left: calc(var(--sidebar-width) + 1rem); top: -3rem; z-index: 20;
  padding: 0.5rem 1rem; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
}
.skip-link:focus { top: 1rem; }

/* Sidebar: fixed on the left, the page scrolls past it.
   The social links and the note sit at the bottom (margin-top: auto). */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 10;
  width: var(--sidebar-width);
  display: flex; flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1.5rem; }
/* shrink to the label so the marker stripe hugs the word, not the column */
.sidebar-nav a { align-self: flex-start; }
.sidebar-social { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin-top: auto; padding-top: 1.5rem; font-size: 0.8rem; }
.sidebar-social a { display: inline-flex; align-items: center; gap: 0.3rem; }
/* Brand marks are masks, not images, so the glyph takes currentColor and
   follows the hover state. No colour is baked into the data URI. */
.sidebar-social a::before {
  content: "";
  width: 1.15em; height: 1.15em;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.sidebar-social a[href*="linkedin"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 22H1V8h6v14Zm12-12h-8v10h2v-8h4v2h-2v8H9V8h10v2Zm4 12h-6v-8h2v6h2v-8h2v10ZM3 20h2V10H3v10Zm18-8h-2v-2h2v2ZM5 7H3V5h2v2ZM3 5H1V3h2v2Zm4 0H5V3h2v2ZM5 3H3V1h2v2Z'/%3E%3C/svg%3E"); }
.sidebar-social a[href*="github"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 2h4v2H7v2H5V2Zm0 10H3V6h2v6Zm2 2H5v-2h2v2Zm2 2v-2H7v2H3v-2H1v2h2v2h4v4h2v-4h2v-2H9Zm0 0v2H7v-2h2Zm6-12v2H9V4h6Zm4 2h-2V4h-2V2h4v4Zm0 6V6h2v6h-2Zm-2 2v-2h2v2h-2Zm-2 2v-2h2v2h-2Zm0 2h-2v-2h2v2Zm0 0h2v4h-2v-4Z'/%3E%3C/svg%3E"); }
.sidebar-social a[href^="mailto"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 8h2v2H6zm2 2h2v2H8zm10-2h-2v2h2zm-2 2h-2v2h2zm-6 2h4v2h-4zM2 6h2v12H2zm18 0h2v12h-2zM4 4h16v2H4zm0 14h16v2H4z'/%3E%3C/svg%3E"); }
.sidebar-nav a, .sidebar-social a { color: var(--text); }
/* Highlighter stripe drawn as a background that grows from the left. The
   current page has it at full width; hovering any other item sweeps it in,
   so hover previews the active state. Text colour never changes. */
.sidebar-nav a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 100% / 0% 0.45em;
  transition: background-size var(--transition);
}
.pix { image-rendering: pixelated; vertical-align: -0.2em; }
.cv h2 .pix {
  width: 16px; height: 16px;
  vertical-align: middle;
  margin-right: 0.25em;
}
.sidebar-nav a[aria-current] { font-weight: 600; }
.sidebar-nav a:hover, .sidebar-nav a[aria-current] { background-size: 100% 0.45em; }
.sidebar-nav a:hover { text-decoration: none; }
.sidebar-social a:hover { color: var(--accent-ink); text-decoration: none; }
.sidebar-note { margin: 0.75rem 0 0; font-size: 0.8rem; color: var(--text-muted); text-align: center; }
/* Above the note: a row of four pixels in the brand colours of icons/techno,
   in the order purple (Power Apps), blue (Power Automate), green (Copilot),
   yellow (Power BI). */
.sidebar-note::before {
  content: "";
  display: block;
  width: 30px; height: 6px;
  margin: 0 auto 0.75rem;
  background: linear-gradient(90deg,
    var(--pp-light) 0 6px, transparent 6px 8px,
    var(--azure-light) 8px 14px, transparent 14px 16px,
    var(--ai-light) 16px 22px, transparent 22px 24px,
    var(--data-light) 24px 30px);
}

/* Layout */
.main { max-width: var(--content-width); margin: 0 auto; padding: 2.5rem 1.5rem 3rem; }
.section { margin-top: 3rem; }
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.heading-row h2 { margin: 0; }
.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 32em; }

/* Booking: our own details panel next to Calendly, mirroring Calendly's
   own layout. The frame stays under ~650px wide so Calendly uses its flat
   layout (no inner card). On the free plan the colour params are ignored,
   so the frame is a white sheet with our border. */
.booking-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.5rem 2rem; margin-top: 1.5rem; }
.booking-facts { flex: 0 0 14rem; margin: 0; }
.booking-facts dt { color: var(--accent-ink); font-weight: 600; font-size: 0.85rem; }
.booking-facts dd { margin: 0 0 1rem; }
.booking {
  flex: 1 1 22rem; min-width: 0;
  display: block;
  height: clamp(560px, calc(100svh - 12rem), 760px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sheet);
}
.booking-fallback { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted); }

/* Buttons */
.button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--accent-ink);
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-ink); color: var(--on-accent); text-decoration: none; }
.button:active { transform: translateY(1px); }
.button.secondary { background: transparent; border-color: var(--border); color: var(--text); }
.button.secondary:hover { background: var(--bg-card); border-color: var(--text-muted); color: var(--text); }
.button.small { padding: 0.35rem 0.8rem; font-size: 0.9rem; }

/* Landing: hero with timeline and photo */
.hero { display: grid; grid-template-columns: 1fr 250px; gap: 2.5rem; align-items: start; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

.timeline-title { font-size: 1.1rem; color: var(--text-muted); margin: 1.5rem 0 0.75rem; }
.timeline {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1.25rem;
  row-gap: 0.6rem;
  margin: 0;
}
.timeline dt {
  color: var(--accent-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timeline dd { margin: 0; }
/* A pixel in the column gap after each year, coloured by the area that
   period was about (order of the rows in index.html). Absolute, so the
   hero gains no height. */
.timeline dt { position: relative; }
.timeline dt::after {
  content: "";
  position: absolute; right: -12px; top: 0.6em;
  width: 6px; height: 6px;
  background: var(--era);
}
.timeline dt:nth-of-type(1), .timeline dt:nth-of-type(2) { --era: var(--data-light); }
.timeline dt:nth-of-type(3) { --era: var(--pp-light); }
.timeline dt:nth-of-type(4) { --era: var(--azure-light); }
.timeline dt:nth-of-type(5) { --era: var(--ai-light); }

.hero-figure { margin: 0; text-align: center; }
.hero-tech {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.25rem;
  margin: 0.9rem 0.35rem 0;
}
.hero-image {
  display: block;
  width: 250px; height: 250px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
}
.hero-bubble {
  margin-top: 1rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Landing: cards and certificates */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.card h3 { margin-bottom: 0.35rem; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
/* 8-bit sparkle in each card's corner, drawn as box-shadows of a 4px square
   so it stays on a 4px grid and needs no asset. Colours follow the card
   order in index.html: Power Platform, AI and agents, Data, Azure and ALM. */
.card { position: relative; }
.card::after {
  content: "";
  position: absolute; top: 1rem; right: 1.1rem;
  width: 4px; height: 4px;
  box-shadow:
    8px 0 var(--pix-dark),
    8px 4px var(--pix-light),
    0 8px var(--pix-dark), 4px 8px var(--pix-light), 12px 8px var(--pix-light), 16px 8px var(--pix-dark),
    8px 12px var(--pix-light),
    8px 16px var(--pix-dark);
}
.card:nth-child(1) { --pix-dark: var(--pp-dark); --pix-light: var(--pp-light); }
.card:nth-child(2) { --pix-dark: var(--ai-dark); --pix-light: var(--ai-light); }
.card:nth-child(3) { --pix-dark: var(--data-dark); --pix-light: var(--data-light); }
.card:nth-child(4) { --pix-dark: var(--azure-dark); --pix-light: var(--azure-light); }

.certs { list-style: none; margin: 0; padding: 0; }
.certs li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.certs li:first-child { border-top: 0; }
/* Pixel before each certificate, coloured by its area; ITIL stays neutral.
   Order follows the list in index.html. */
.certs li > span:first-child::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 0.6rem;
  vertical-align: 0.15em;
  background: var(--cert, var(--border));
}
.certs li:nth-child(1) { --cert: var(--ai-light); }
.certs li:nth-child(2), .certs li:nth-child(4) { --cert: var(--data-light); }
.certs li:nth-child(5) { --cert: var(--azure-light); }

/* Posts list (blog index and landing) */
.posts { list-style: none; margin: 0; padding: 0; }
.post {
  display: flex; flex-direction: column; gap: 0.35rem;
  margin-inline: -0.625rem;
  padding: 0.9rem 0.625rem;
  border-radius: var(--radius);
  color: var(--text);
}
.post:hover { background: var(--bg-card); text-decoration: none; }
.post-top {
  display: flex; align-items: baseline; gap: 1.25rem;
}
.post-top .pix { flex: 0 0 auto; align-self: flex-start; margin-top: 0.2rem; }
.post-top time {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 8.5em;
}
.post-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
  font-style: italic;
}

/* Article */
.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: 0.9rem; }
.article h1 { margin-bottom: 0.25rem; text-wrap: wrap; }
.post-meta { color: var(--text-muted); margin-bottom: 2rem; }
.article h2 { margin-top: 2rem; text-wrap: wrap; }
.article { max-width: 65ch; }
.article p { text-align: justify; hyphens: auto; }
.article .post-meta { text-align: left; hyphens: manual; }
/* long source URLs have no spaces; let them break anywhere instead of
   pushing the page wider than a phone screen */
.article a { overflow-wrap: anywhere; }
.article code {
  font-size: 0.92em;
  padding: 0 0.3em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
}

/* Article figures: inline SVG diagrams drawn at phone width (viewBox 352),
   shown 1:1 on desktop and scaled down slightly on small screens. */
.article-figure { margin: 1.25rem auto 1.75rem; max-width: 22rem; }
.article-figure svg { display: block; width: 100%; height: auto; font-family: inherit; font-size: 12px; }
.article-figure figcaption {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  margin-top: 0.5rem;
}
.diagram .box { fill: var(--bg-card); stroke: var(--border); }
.diagram .box-accent { fill: var(--accent); stroke: var(--accent-ink); }
.diagram .line { fill: none; stroke: var(--text-muted); stroke-width: 1.5; }
.diagram .label { fill: var(--text); }
.diagram .on-accent { fill: var(--on-accent); }
.diagram .muted { fill: var(--text-muted); font-size: 11px; }
.diagram marker path { fill: var(--text-muted); }

/* CV: same rules as the printed CV, the accent is a line, not a fill */
.cv-header { margin-bottom: 1.5rem; }
.cv-name { font-size: 2rem; color: var(--accent-ink); line-height: 1.1; margin: 0; }
.cv-role { font-size: 1.15rem; margin: 0.25rem 0 0; }
.cv-contact { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; margin: 0.5rem 0 0; }
.cv-contact-row { display: inline-block; }
.cv-contact-row + .cv-contact-row { margin-top: 0.25rem; }
.cv-contact a { color: inherit; }
.cv-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }

.cv section { margin-top: 1.75rem; }
.cv h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.3rem;
  margin: 0 0 0.75rem;
}
.cv h3, .cv h4 { font-family: var(--font-body); font-size: 1.05rem; font-weight: 700; margin: 0; }
.company { font-weight: 400; }

.skills div { margin-bottom: 0.3rem; }
/* Pixel before each skill label, coloured by area; order follows the
   list in cv/index.html. Hidden in print. */
.skills b::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 0.5rem;
  vertical-align: 0.15em;
  background: var(--skill, var(--border));
}
.skills div:nth-child(1), .skills div:nth-child(4) { --skill: var(--pp-light); }
.skills div:nth-child(2), .skills div:nth-child(8) { --skill: var(--ai-light); }
.skills div:nth-child(3), .skills div:nth-child(6) { --skill: var(--azure-light); }
.skills div:nth-child(5) { --skill: var(--data-light); }

.entry { margin-bottom: 1.25rem; break-inside: avoid; }
.entry-line { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.dates, .year {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.qualifier { font-size: 0.9rem; font-style: italic; color: var(--text-muted); margin-top: 0.1rem; }
.sub-role { margin: 0.6rem 0 0 1rem; }

.cv ul { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.cv li { position: relative; padding-left: 1rem; margin-bottom: 0.3rem; }
.cv li::before {
  content: "";
  position: absolute; left: 0; top: 0.6em;
  width: 5px; height: 5px;
  background: var(--accent-ink);
}

.item { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.3rem; }
.muted { color: var(--text-muted); font-size: 0.9rem; }

@media print {
  @page { size: A4; margin: 14mm; }
  /* On paper the yellow fill washes out, so both accents collapse into one
     dark mustard (8.6:1 on white) and the warm greys get sharper. */
  :root {
    --accent: #5A4B00;
    --accent-ink: #5A4B00;
    --text-muted: #555555;
    --border: #CCCCCC;
  }
  .skip-link, .sidebar, .cv-actions, .skills b::before { display: none; }
  body {
    padding-left: 0;
    background: #fff; color: var(--text);
    font-size: 10pt; line-height: 1.35;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .main { max-width: none; padding: 0; }
  .cv-contact a { text-decoration: none; }
}

/* Mobile */
@media (max-width: 700px) {
  h1 { font-size: 1.8rem; }
  body { padding-left: 0; }
  .sidebar {
    position: static; width: auto;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch;
    gap: 0.35rem;
    padding: 0.75rem 0.6rem;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin-top: 0; align-items: center; width: auto; }
  .sidebar-nav a { justify-content: flex-start; text-align: left; padding: 0.2rem 0; flex: 0 0 auto; }
  .sidebar-social { order: -1; align-self: flex-end; margin: 0; padding-top: 0; flex-direction: row; flex-wrap: nowrap; gap: 0.6rem; align-items: center; justify-content: flex-end; width: auto; }
  .sidebar-social a { flex: 0 0 auto; font-size: 0; line-height: 0; }
  .sidebar-social a::before { width: 0.95rem; height: 0.95rem; }
  .sidebar-note { display: none; }
  .skip-link { left: 1rem; }
  .main { padding: 1.5rem 1rem 2.5rem; }
  .entry-line, .item { flex-direction: column; gap: 0; }
  .post { gap: 0.35rem; }
  .hero { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-figure { order: -1; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 0 1rem; text-align: left; }
  .hero-image { grid-column: 1; grid-row: 1; width: 96px; height: 96px; justify-self: center; }
  .hero-tech { grid-column: 1; grid-row: 2; order: 0; justify-content: flex-start; gap: 0.5rem; margin: 0.4rem 0 0; }
  .hero-bubble { grid-column: 2; grid-row: 1; min-height: 60px; margin-top: 0; align-self: center; padding: 0.5rem 0.8rem; display: flex; align-items: center; }
  .cards { grid-template-columns: 1fr; }
  .booking-facts { flex-basis: 100%; display: grid; grid-template-columns: max-content 1fr; column-gap: 1.25rem; row-gap: 0.4rem; align-items: baseline; }
  .booking-facts dd { margin: 0; }
  .certs li { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
