/* Shivar Consulting — home page
   Palette: paper, navy ink, one raspberry thread. */

:root {
  --paper:  #FAFBFD;
  --ink:    #1B2447;
  --ink-2:  #545E80;
  --rule:   #DCE0EB;
  --wash:   #EEF0F7;
  --thread: #1B2447;
  --accent: #D4145A;
  --on-accent: #FFFFFF;

  --font: "Familjen Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 16px;
  --measure: 36em;

  --tangle-h: clamp(22rem, 34vw, 27rem);   /* 8 rows, never under 44px each */
  --cat-w: clamp(6.5rem, 22vw, 16.25rem);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:  #121935;
    --ink:    #E8EBF5;
    --ink-2:  #A3ABC7;
    --rule:   #2A3356;
    --wash:   #1A2249;
    --thread: #E8EBF5;
    --accent: #FF4D8D;
    --on-accent: #121935;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

.wordmark {
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.masthead-link {
  color: var(--ink-2);
  text-underline-offset: 0.2em;
}
.masthead-link:hover { color: var(--accent); }

/* ---------- Hero ---------- */

.hero { padding-top: clamp(3rem, 9vw, 7rem); }

.hero h1 {
  font-size: clamp(2.75rem, 1.4rem + 6.4vw, 6.25rem);
  font-weight: 620;
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-wrap: balance;
}
.hero h1 span { display: block; }

.lede {
  max-width: var(--measure);
  margin-top: clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.5;
  text-wrap: pretty;
}

/* ---------- Actions ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}
.button:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.text-link {
  font-weight: 500;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}
.text-link:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

/* ---------- The tangle ---------- */

.tangle-section { margin-top: clamp(3.5rem, 8vw, 6rem); }

.tangle-hint {
  color: var(--ink-2);
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

.tangle {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) var(--cat-w);
  grid-template-rows: minmax(0, 1fr);
  height: var(--tangle-h);
}

.channels {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.channel {
  position: relative;
  display: flex;
}

.channel input {
  position: absolute;
  inset: 50% auto auto 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}

.channel label {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding-right: 1rem;
  color: var(--ink-2);
  font-size: 0.8125rem;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s;
}

/* The knot where a channel's thread begins */
.channel label::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -4px;
  width: 9px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: var(--paper);
  transform: translateY(-50%);
  transition: background-color 0.2s, border-color 0.2s;
}

.channel label:hover { color: var(--ink); }

.channel input:checked + label {
  color: var(--accent);
  font-weight: 600;
}
.channel input:checked + label::after {
  background: var(--accent);
  border-color: var(--accent);
}

.channel input:focus-visible + label {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.threads {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: visible;
}

.thread {
  fill: none;
  stroke: var(--thread);
  stroke-opacity: 0.4;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.25s, stroke-opacity 0.25s, stroke-width 0.25s;
}

/* Follow one thread: fade the rest, light up the chosen one */
.tangle:has(input:checked) .thread { stroke-opacity: 0.16; }

.tangle:has(#c-search:checked)  .t-search,
.tangle:has(#c-ai:checked)      .t-ai,
.tangle:has(#c-podcast:checked) .t-podcast,
.tangle:has(#c-social:checked)  .t-social,
.tangle:has(#c-friend:checked)  .t-friend,
.tangle:has(#c-email:checked)   .t-email,
.tangle:has(#c-paid:checked)    .t-paid,
.tangle:has(#c-direct:checked)  .t-direct {
  stroke: var(--accent);
  stroke-opacity: 1;
  stroke-width: 3;
}

.cat {
  position: relative;
  align-self: center;
}

.cat img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 35%;
  border-radius: 14px;
  background: var(--wash);
}

.cat figcaption {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  right: 0;
  color: var(--ink-2);
  font-size: 0.8125rem;
  line-height: 1.3;
}

/* Notes under the tangle */
.notes {
  max-width: var(--measure);
  min-height: 5.5em;
  margin-top: 1.5rem;
}

.note + .note { margin-top: 0.75rem; }

.note-name {
  display: block;
  color: var(--accent);
  font-weight: 600;
}

@supports selector(:has(*)) {
  .note { display: none; }
  .note + .note { margin-top: 0; }

  .tangle-section:has(#c-search:checked)  #n-search,
  .tangle-section:has(#c-ai:checked)      #n-ai,
  .tangle-section:has(#c-podcast:checked) #n-podcast,
  .tangle-section:has(#c-social:checked)  #n-social,
  .tangle-section:has(#c-friend:checked)  #n-friend,
  .tangle-section:has(#c-email:checked)   #n-email,
  .tangle-section:has(#c-paid:checked)    #n-paid,
  .tangle-section:has(#c-direct:checked)  #n-direct {
    display: block;
  }
}

/* One orchestrated moment: the threads spool out to the cat */
@media (prefers-reduced-motion: no-preference) {
  .threads { animation: spool 1.7s cubic-bezier(0.25, 0.7, 0.2, 1) 0.15s both; }
  .cat img  { animation: arrive 0.6s ease-out 1.05s both; }

  @keyframes spool {
    from { clip-path: inset(-20px 100% -20px -20px); }
    to   { clip-path: inset(-20px -20px -20px -20px); }
  }
  @keyframes arrive {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---------- The Attribution Day ---------- */

.day {
  display: grid;
  gap: 2.5rem;
  margin-top: clamp(4.5rem, 10vw, 8rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1.5rem;
}

.day h2,
.helped h2 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  font-weight: 620;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.price {
  margin-top: 0.75rem;
  color: var(--ink-2);
}
.price-amount {
  display: block;
  color: var(--ink);
  font-size: clamp(2.25rem, 1.6rem + 2.4vw, 3.25rem);
  font-weight: 620;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.day-head > p:last-child {
  max-width: 30em;
  margin-top: 1.25rem;
  text-wrap: pretty;
}

/* Before, the day, after: one straight thread, ending in a knot */
.day-steps {
  position: relative;
  list-style: none;
  padding: 0;
}
.day-steps::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.55em;
  bottom: 0.6em;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.day-steps li {
  position: relative;
  padding-left: 2.25rem;
}
.day-steps li + li { margin-top: 1.75rem; }

.day-steps li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.38em;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--paper);
}
.day-steps li:last-child::before { background: var(--accent); }

.day-steps h3 {
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.3;
}
.day-steps p {
  max-width: 34em;
  margin-top: 0.25rem;
  color: var(--ink-2);
  text-wrap: pretty;
}

.fine {
  max-width: 34em;
  color: var(--ink-2);
  font-size: 0.9375rem;
}
.day-foot .actions { margin-top: 1.25rem; }

/* ---------- I've helped ---------- */

.helped {
  margin-top: clamp(4.5rem, 10vw, 8rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
}

.helped ul {
  display: grid;
  gap: 1.25rem 2.5rem;
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
}

.helped li {
  padding-top: 0.875rem;
  border-top: 1px solid var(--rule);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.4;
  text-wrap: pretty;
}

/* ---------- Footer ---------- */

.site-footer {
  display: grid;
  gap: 1.75rem;
  margin-top: clamp(4.5rem, 10vw, 8rem);
  padding-top: 2rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.site-footer h2 {
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 600;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0;
  list-style: none;
}
.link-row a {
  display: inline-block;
  padding-block: 0.35rem;
  text-underline-offset: 0.2em;
}
.link-row a:hover { color: var(--accent); }

.legal p { margin-top: 0.5rem; }

/* ---------- Wider screens ---------- */

@media (min-width: 40em) {
  :root { --gutter: 32px; }

  .channel label { font-size: 0.9375rem; padding-right: 1.5rem; }
  .cat img { border-radius: 18px; }
  .cat figcaption { font-size: 0.875rem; }

  .helped ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .site-footer {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
  .legal { text-align: right; }
  .legal .link-row { justify-content: flex-end; }
}

@media (min-width: 60em) {
  body { font-size: 1.125rem; }

  .channel label { font-size: 1rem; padding-right: 2rem; }

  .day {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "head steps"
      "foot steps";
    column-gap: clamp(3rem, 6vw, 6rem);
    row-gap: 1.75rem;
  }
  .day-head  { grid-area: head; }
  .day-steps { grid-area: steps; align-self: start; }
  .day-foot  { grid-area: foot; }
}
