/* Guide (article) pages. Loaded after styles.css and built on its tokens. */

/* Hero */
.guide-hero {
  padding: 26px 0 60px;
  background:
    radial-gradient(60% 80% at 100% 0%, rgb(190 214 255 / 0.75), transparent 70%),
    radial-gradient(45% 60% at 0% 100%, rgb(214 228 255 / 0.7), transparent 70%),
    linear-gradient(180deg, #f6f9ff 0%, #e9f0fd 100%);
  overflow: hidden;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

.crumbs a:hover {
  color: var(--primary);
}

.crumbs .icon {
  width: 0.95em;
  height: 0.95em;
}

.guide-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 48px;
  margin-top: 26px;
}

.guide-hero h1 {
  font-size: clamp(2rem, 3.5vw, 2.85rem);
  line-height: 1.1;
}

.guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--muted);
}

.guide-meta li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.guide-meta .icon {
  color: var(--primary);
}

.guide-art img {
  display: block;
  width: 100%;
  height: auto;
}

/* Layout: sticky contents rail + article */
.guide-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 740px);
  justify-content: center;
  gap: 64px;
  padding-top: 56px;
}

.toc {
  position: sticky;
  top: 100px;
  align-self: start;
  font-size: 0.92rem;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--line);
}

.toc ol a {
  display: block;
  margin-left: -2px;
  padding: 7px 0 7px 16px;
  border-left: 2px solid transparent;
  line-height: 1.35;
  color: var(--muted);
}

.toc ol a:hover,
.toc ol a.is-current {
  border-left-color: var(--primary);
  color: var(--primary);
}

.toc ol a.is-current {
  font-weight: 600;
}

.toc-promo {
  margin-top: 28px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--soft);
}

.toc-promo .tile {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--white);
  font-size: 1.15rem;
}

.toc-promo p {
  margin: 12px 0 14px;
  line-height: 1.45;
  color: var(--navy);
}

.toc-promo .btn {
  width: 100%;
}

/* Article text */
.prose {
  font-size: 1.06rem;
  line-height: 1.7;
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h2 {
  margin-top: 2.3em;
  font-size: clamp(1.45rem, 2.2vw, 1.75rem);
  font-weight: 700;
}

.prose h2 + * {
  margin-top: 0.8em;
}

.prose strong {
  font-weight: 700;
  color: var(--navy);
}

.prose .note {
  font-size: 0.92rem;
  color: var(--muted);
}

.disclaimer {
  display: flex;
  gap: 14px;
  margin-top: 2.6em;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--soft);
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

.disclaimer .icon {
  margin-top: 2px;
  font-size: 1.1rem;
  color: var(--primary);
}

/* Schedule E line table */
.line-table {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-spacing: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  overflow: hidden;
}

.line-table th {
  padding: 12px 16px;
  background: var(--soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
}

.line-table td {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
}

.line-table .is-income td {
  background: #f2fbf6;
}

.line-no {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--primary);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--white);
}

.is-income .line-no {
  background: var(--green);
}

.cat {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--navy);
}

.cat .tile {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 9px;
  font-size: 1.05rem;
}

/* Cards for the lines that need explaining */
.line-cards {
  display: grid;
  gap: 16px;
}

.line-card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 14px 30px -26px rgb(20 50 120 / 0.6);
}

.line-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Figures */
.figure {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f7faff, #edf3fd);
  line-height: 1.4;
}

.figure-title {
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
}

.figure figcaption {
  margin-top: 16px;
  font-size: 0.86rem;
  text-align: center;
  color: var(--muted);
}

.panel {
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 1px 4px rgb(30 60 120 / 0.1);
}

/* Repair -> deduct now, improvement -> depreciate */
.flow {
  display: grid;
  gap: 12px;
}

.flow-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
}

.flow-step {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 14px 10px;
  font-size: 0.9rem;
  text-align: center;
}

.flow-step b {
  color: var(--navy);
}

.flow-step small {
  font-size: 0.8rem;
  color: var(--muted);
}

.flow-step .tile {
  width: 38px;
  height: 38px;
  margin-bottom: 6px;
  border-radius: 10px;
  font-size: 1.1rem;
}

.flow-step.is-now {
  box-shadow: inset 0 0 0 2px #9fdcb9;
}

.flow-step.is-later {
  box-shadow: inset 0 0 0 2px #f3cf85;
}

.flow-arrow {
  align-self: center;
  color: var(--primary);
}

/* Side-by-side comparison */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compare-col {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.compare-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  color: var(--navy);
}

.compare-head .tile {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  font-size: 1.15rem;
}

.compare-col ul {
  display: grid;
  gap: 10px;
  margin: 14px 0 16px;
  font-size: 0.95rem;
}

.compare-col li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.compare-col li .icon {
  margin-top: 2px;
  color: var(--primary);
}

.compare-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 0.86rem;
  font-weight: 600;
}

.compare-foot.is-now {
  color: #1c8a52;
}

.compare-foot.is-later {
  color: #a86a05;
}

/* Expense list with category tiles */
.deduct-list {
  display: grid;
  gap: 20px;
}

.deduct-list li {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.deduct-list .tile {
  width: 46px;
  height: 46px;
  margin-top: 4px;
  border-radius: 12px;
  font-size: 1.25rem;
}

/* Depreciation example */
.split-bar {
  display: flex;
  height: 56px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--white);
  overflow: hidden;
}

.split-bar span {
  display: grid;
  place-content: center;
  padding: 0 8px;
  text-align: center;
}

.split-bar small {
  font-weight: 500;
  opacity: 0.9;
}

.split-land {
  flex: 0 0 20%;
  background: #8fa6cf;
}

.split-building {
  flex: 1;
  background: var(--primary);
}

.year-strip {
  display: grid;
  grid-template-columns: repeat(27, 2fr) 1fr;
  gap: 3px;
  margin-top: 18px;
}

.year-strip i {
  height: 22px;
  border-radius: 3px;
  background: #c5d7f8;
}

.year-strip i:first-child {
  background: var(--primary);
}

.year-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.stat {
  padding: 12px 14px;
}

.stat span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
}

/* Not-deductible chips */
.no-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.no-list li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 1px 4px rgb(30 60 120 / 0.12);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
}

.no-list .icon {
  color: var(--red);
}

/* Year-end callout */
.deadline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}

.cal {
  width: 96px;
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow);
  text-align: center;
  overflow: hidden;
}

.cal b {
  display: block;
  padding: 6px 0;
  background: var(--red);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  color: var(--white);
}

.cal span {
  display: block;
  padding: 8px 0 12px;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--navy);
}

.tick-list {
  display: grid;
  gap: 10px;
  font-size: 0.95rem;
}

.tick-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tick-list .icon {
  margin-top: 1px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  stroke-width: 2.6;
}

/* Three attributes of a well-recorded expense */
.tagged {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 28px;
}

.receipt-wrap {
  filter: drop-shadow(0 12px 14px rgb(20 50 120 / 0.2));
  transform: rotate(-4deg);
}

.receipt {
  display: grid;
  gap: 9px;
  width: 132px;
  padding: 16px 14px 26px;
  background: var(--white);
  /* Zigzag tear along the bottom edge. */
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 12px 100%;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / 12px 100%;
}

.receipt i {
  display: block;
  height: 7px;
  border-radius: 4px;
  background: #d3dcec;
}

.receipt i:first-child {
  width: 55%;
  height: 9px;
  background: var(--primary);
}

.receipt i:nth-child(3) {
  width: 70%;
}

.receipt i:nth-child(5) {
  width: 45%;
}

.receipt i:last-child {
  width: 50%;
  height: 9px;
  margin: 6px 0 0 auto;
  background: var(--green);
}

.attrs {
  display: grid;
  gap: 10px;
}

.attrs li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 10px;
}

.attrs .tile {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  font-size: 1.1rem;
}

.attrs span {
  flex: 1;
  font-size: 0.8rem;
  color: var(--muted);
}

.attrs b {
  display: block;
  font-size: 0.98rem;
  color: var(--navy);
}

/* Property columns A / B / C */
.abc {
  width: 100%;
  border-spacing: 0;
  font-size: 0.92rem;
  overflow: hidden;
}

.abc th,
.abc td {
  padding: 10px 14px;
  text-align: right;
}

.abc th:first-child,
.abc td:first-child {
  text-align: left;
}

.abc thead th {
  background: #1b4fb8;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgb(255 255 255 / 0.85);
}

.abc thead b {
  display: block;
  font-size: 1.05rem;
  color: var(--white);
}

.abc tbody td {
  border-top: 1px solid #edf1f8;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.abc tbody td:first-child {
  font-weight: 600;
}

.abc .line-no {
  min-width: 28px;
  height: 22px;
  margin-right: 10px;
  border-radius: 6px;
  background: #e1ecff;
  font-size: 0.78rem;
  color: var(--primary);
}

/* Passive loss chart */
.chart {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font);
}

/* Next guide + guide cards */
.next-guide {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  margin-top: 2.6em;
  padding: 18px 24px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: var(--shadow);
  line-height: 1.45;
  transition: transform 0.15s;
}

.next-guide:hover {
  transform: translateY(-2px);
}

.next-guide img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: var(--soft);
}

.next-guide .eyebrow {
  margin-bottom: 6px;
}

.next-guide h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.next-guide p:not(.eyebrow) {
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--muted);
}

@media (max-width: 1020px) {
  .guide-hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .guide-art {
    width: min(100%, 460px);
    margin-inline: auto;
  }

  .guide-layout {
    grid-template-columns: minmax(0, 740px);
    gap: 36px;
    padding-top: 36px;
  }

  .toc {
    position: static;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--soft);
  }

  .toc ol {
    border-left: 0;
  }

  .toc ol a {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .toc-promo {
    display: none;
  }
}

@media (max-width: 600px) {
  .guide-hero {
    padding-bottom: 40px;
  }

  .figure {
    padding: 18px 16px;
  }

  /* Each table row becomes a small card: badge + category, then the description. */
  .line-table,
  .line-table tbody,
  .line-table tr,
  .line-table td {
    display: block;
  }

  .line-table thead {
    display: none;
  }

  .line-table tr {
    position: relative;
    padding: 12px 14px 12px 60px;
    border-top: 1px solid var(--line);
  }

  .line-table tr:first-child {
    border-top: 0;
  }

  .line-table td {
    padding: 0;
    border: 0;
    background: none !important;
  }

  .line-table td:first-child {
    position: absolute;
    top: 14px;
    left: 14px;
  }

  .line-table td:last-child {
    margin-top: 4px;
    color: var(--muted);
  }

  .line-table .is-income {
    background: #f2fbf6;
  }

  .cat .tile {
    display: none;
  }

  .flow-row,
  .compare,
  .stat-row {
    grid-template-columns: 1fr;
  }

  .flow-arrow {
    justify-self: center;
    transform: rotate(90deg);
  }

  .flow-row + .flow-row {
    margin-top: 12px;
    padding-top: 24px;
    border-top: 1px dashed var(--line);
  }

  .deadline,
  .tagged {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .attrs,
  .tick-list {
    width: 100%;
  }

  .abc {
    font-size: 0.8rem;
  }

  .abc th,
  .abc td {
    padding: 8px;
  }

  .abc .line-no {
    display: none;
  }

  .next-guide {
    grid-template-columns: 1fr;
    padding: 18px;
  }
}
