/**
 * Theme Name:        DTB
 * Description:       Einfaches Depot Tagebuch
 * Version:           0.1
 * Author:            Adrian Korte & Chatty
 * Text Domain:       dt
 */

/* --------------------------------------------------------------------------
   1. Design Tokens
-------------------------------------------------------------------------- */
:root {
  --dt-background: 40 20% 98%;
  --dt-foreground: 220 20% 10%;
  --dt-card: 0 0% 100%;
  --dt-muted: 40 10% 93%;
  --dt-muted-foreground: 220 10% 46%;
  --dt-border: 40 10% 88%;
  --dt-input: 40 10% 88%;
  --dt-primary: 220 20% 10%;
  --dt-primary-foreground: 40 20% 98%;
  --dt-accent: 152 50% 42%;
  --dt-accent-foreground: 0 0% 100%;
  --dt-destructive: 0 72% 51%;
  --dt-radius: 0.375rem;
  --dt-font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --dt-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --dt-background: 220 20% 7%;
    --dt-foreground: 40 20% 95%;
    --dt-card: 220 18% 10%;
    --dt-muted: 220 12% 16%;
    --dt-muted-foreground: 220 10% 55%;
    --dt-border: 220 12% 18%;
    --dt-input: 220 12% 18%;
    --dt-primary: 40 20% 95%;
    --dt-primary-foreground: 220 20% 7%;
  }
}

html[data-theme="light"] {
  --dt-background: 40 20% 98%;
  --dt-foreground: 220 20% 10%;
  --dt-card: 0 0% 100%;
  --dt-muted: 40 10% 93%;
  --dt-muted-foreground: 220 10% 46%;
  --dt-border: 40 10% 88%;
  --dt-input: 40 10% 88%;
  --dt-primary: 220 20% 10%;
  --dt-primary-foreground: 40 20% 98%;
}

html[data-theme="dark"] {
  --dt-background: 220 20% 7%;
  --dt-foreground: 40 20% 95%;
  --dt-card: 220 18% 10%;
  --dt-muted: 220 12% 16%;
  --dt-muted-foreground: 220 10% 55%;
  --dt-border: 220 12% 18%;
  --dt-input: 220 12% 18%;
  --dt-primary: 40 20% 95%;
  --dt-primary-foreground: 220 20% 7%;
}

.dt-theme-toggle {
  margin-left: auto;
  width: 2rem;
  height: 2rem;
  border: 1px solid hsl(var(--dt-border));
  border-radius: 999px;
  background: hsl(var(--dt-card));
  color: hsl(var(--dt-muted-foreground));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dt-theme-toggle:hover {
  color: hsl(var(--dt-foreground));
}

.dt-theme-toggle svg {
  width: 1rem;
  height: 1rem;
}

.dt-theme-toggle__icon--moon {
  display: none;
}

html[data-theme="dark"] .dt-theme-toggle__icon--sun {
  display: none;
}

html[data-theme="dark"] .dt-theme-toggle__icon--moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .dt-theme-toggle__icon--sun {
    display: none;
  }

  html:not([data-theme="light"]) .dt-theme-toggle__icon--moon {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   2. Reset / Base
-------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-family: var(--dt-font-sans);
}

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--dt-background));
  color: hsl(var(--dt-foreground));
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
}

/* --------------------------------------------------------------------------
   3. Layout
-------------------------------------------------------------------------- */
.dt-site {
  min-height: 100vh;
  background: hsl(var(--dt-background));
}

.dt-container {
  max-width: 48rem;
  margin-inline: auto;
  padding: 3rem 1rem;
}

@media (min-width: 768px) {
  .dt-container {
    padding-block: 5rem;
  }
}

.dt-header {
  margin-bottom: 4rem;
}

.dt-page-header {
  margin-bottom: 3rem;
}

.dt-section {
  margin-bottom: 3rem;
}

.dt-section--large {
  margin-bottom: 4rem;
}

.dt-section-title {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--dt-muted-foreground));
}

.dt-footer {
  margin-top: 5rem;
  border-top: 1px solid hsl(var(--dt-border));
}

.dt-footer__inner {
  max-width: 48rem;
  margin-inline: auto;
  padding: 1.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: hsl(var(--dt-muted-foreground));
}

.dt-footer a:hover {
  color: hsl(var(--dt-foreground));
}

/* --------------------------------------------------------------------------
   4. Typography
-------------------------------------------------------------------------- */
.dt-title {
  margin: 0;
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

@media (min-width: 768px) {
  .dt-title {
    font-size: 2.25rem;
    line-height: 2.5rem;
  }
}

.dt-title--page {
  margin-bottom: 2rem;
}

.dt-intro {
  max-width: 32rem;
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.625;
  color: hsl(var(--dt-muted-foreground));
}

.dt-excerpt {
  margin: 1rem 0 0;
  line-height: 1.625;
  color: hsl(var(--dt-muted-foreground));
}

.dt-date {
  font-family: var(--dt-font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: hsl(var(--dt-muted-foreground));
}

.dt-prose {
  max-width: none;
  font-size: 0.875rem;
  line-height: 1.625;
}

.dt-prose > * + * {
  margin-top: 1.5rem;
}

.dt-prose h2 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
}

.dt-prose p,
.dt-prose li {
  color: hsl(var(--dt-muted-foreground));
}

/* --------------------------------------------------------------------------
   5. Links / Navigation
-------------------------------------------------------------------------- */
.dt-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: hsl(var(--dt-muted-foreground));
  transition: color 150ms ease;
}

.dt-back-link:hover {
  color: hsl(var(--dt-foreground));
}

.dt-back-link svg {
  width: 0.875rem;
  height: 0.875rem;
}

.dt-post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--dt-border));
  font-size: 0.875rem;
}

.dt-post-nav a {
  color: hsl(var(--dt-muted-foreground));
  transition: color 150ms ease;
}

.dt-post-nav a:hover {
  color: hsl(var(--dt-foreground));
}

/* --------------------------------------------------------------------------
   6. Cards
-------------------------------------------------------------------------- */
.dt-card {
  border: 1px solid hsl(var(--dt-border));
  border-radius: var(--dt-radius);
  background: hsl(var(--dt-card));
}

.dt-card--padded {
  padding: 1rem;
}

@media (min-width: 768px) {
  .dt-card--padded {
    padding: 1.5rem;
  }
}

/* --------------------------------------------------------------------------
   7. Metrics
-------------------------------------------------------------------------- */
.dt-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .dt-metric-grid {
    grid-template-columns: grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  }
}

.dt-metric {
  display: grid;
}

.dt-metric__label {
  margin: 0;
  margin-left: 1.5rem;
  font-size: 0.6rem;
  line-height: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--dt-muted-foreground));
}

.dt-metric__value {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-family: var(--dt-font-mono);
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: hsl(var(--dt-muted-foreground));
}

@media (max-width: 640px) {
  .dt-metric__value {
    font-size: 1.15rem;
  }
}

.dt-metric__value svg {
  width: 1rem;
  height: 1rem;
}

.dt-metric__value--positive {
  color: hsl(var(--dt-accent));
}

.dt-metric__value--negative {
  color: hsl(var(--dt-destructive));
}

/* --------------------------------------------------------------------------
   8. Chart
-------------------------------------------------------------------------- */
.dt-chart-card {
  width: 100%;
  height: auto;
}

.dt-chart-placeholder {
  width: 100%;
  height: auto;
}

.dt-chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   9. Update List
-------------------------------------------------------------------------- */
.dt-update-list {
  display: grid;
}

.dt-update-item {
  display: block;
  margin-inline: -1rem;
  padding: 1.5rem 1rem;
  border-bottom: 1px solid hsl(var(--dt-border));
  border-radius: 0.25rem;
  transition: background-color 150ms ease;
}

.dt-update-item:last-child {
  border-bottom: 0;
}

.dt-update-item:hover {
  background: hsl(var(--dt-muted) / 0.3);
}

.dt-update-item__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dt-update-item__content {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.dt-update-item__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dt-update-item__title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  transition: color 150ms ease;
}

.dt-update-item:hover .dt-update-item__title {
  color: hsl(var(--dt-accent));
}

.dt-update-item__excerpt {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 0.875rem;
  line-height: 1.625;
  color: hsl(var(--dt-muted-foreground));
}

.dt-update-item__side {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: right;
}

.dt-update-item__performance {
  font-family: var(--dt-font-mono);
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: hsl(var(--dt-muted-foreground));
}

.dt-update-item__performance--positive {
  color: hsl(var(--dt-accent));
}

.dt-update-item__performance--negative {
  color: hsl(var(--dt-destructive));
}

.dt-update-item__arrow {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--dt-muted-foreground));
  transition: color 150ms ease;
}

.dt-update-item:hover .dt-update-item__arrow {
  color: hsl(var(--dt-foreground));
}

.dt-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0.25rem;
  background: hsl(var(--dt-muted));
  padding: 0.125rem 0.375rem;
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--dt-muted-foreground));
}

.dt-comment-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 11px;
  color: hsl(var(--dt-muted-foreground));
}

.dt-comment-count svg {
  width: 0.75rem;
  height: 0.75rem;
}

@media (max-width: 640px) {
  .dt-update-item__inner {
    display: grid;
  }

  .dt-update-item__side {
    justify-content: space-between;
    text-align: left;
  }
}

/* --------------------------------------------------------------------------
   10. Tables
-------------------------------------------------------------------------- */
.dt-table-wrap {
  overflow-x: auto;
}

.dt-table th,
.dt-table td {
  padding: 0.5rem;
  vertical-align: middle;
  border-bottom: 1px solid hsl(var(--dt-border));
}

.dt-table tr:last-child td {
  border-bottom: 0;
}

.dt-table th {
  height: 2.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--dt-muted-foreground));
}

.dt-table td {
  font-size: 0.875rem;
}

.dt-table .is-number,
.dt-table .is-money {
  text-align: right;
  font-family: var(--dt-font-mono);
}

.dt-table .is-strong {
  font-weight: 500;
}

.dt-table .is-positive {
  color: hsl(var(--dt-accent));
}

.dt-table .is-negative {
  color: hsl(var(--dt-destructive));
}

.dt-security-name {
  font-weight: 500;
}

.dt-security-ticker {
  margin-left: 0.375rem;
  font-family: var(--dt-font-mono);
  font-size: 0.75rem;
  color: hsl(var(--dt-muted-foreground));
}

.dt-transaction-type {
  display: inline-flex;
  align-items: center;
  border: 1px solid hsl(var(--dt-border));
  border-radius: calc(var(--dt-radius) - 2px);
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.dt-transaction-type--buy {
  border-color: hsl(var(--dt-accent) / 0.2);
  background: hsl(var(--dt-accent) / 0.1);
  color: hsl(var(--dt-accent));
}

.dt-transaction-type--sell {
  border-color: hsl(var(--dt-destructive) / 0.2);
  background: hsl(var(--dt-destructive) / 0.1);
  color: hsl(var(--dt-destructive));
}

@media (max-width: 640px) {
  .dt-table td {
  font-size: 0.75rem;
  }
  .dt-table th,
  .dt-table th.is-number,
  .dt-table th.is-money {
  font-size: 0.625rem   
  }
}

/* --------------------------------------------------------------------------
   11. Dividends
-------------------------------------------------------------------------- */
.dt-dividend-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .dt-dividend-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  }
}

.dt-dividend-summary__item {
  display: grid;
}

.dt-dividend-summary__label {
  margin: 0;
  font-size: 0.6rem;
  line-height: 0.75rem
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--dt-muted-foreground));
}

.dt-dividend-summary__value {
  margin: 0;
  font-family: var(--dt-font-mono);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   12. Comments
-------------------------------------------------------------------------- */
.dt-comments {
  display: grid;
  gap: 2rem;
}

.dt-comment-list {
  display: grid;
  gap: 1.25rem;
}

.dt-comment {
  display: flex;
  gap: 0.75rem;
}

.dt-comment__avatar {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  flex-shrink: 0;
  overflow: hidden;
  background: hsl(var(--dt-muted));
}

.dt-comment__avatar-img,
.dt-comment__avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 999px;
}

.dt-comment__avatar-img {
  display: block;
  object-fit: cover;
  position: relative;
  z-index: 2;
}

.dt-comment__avatar-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--dt-muted-foreground));
  font-size: 0.75rem;
  font-weight: 600;
}

.dt-comment__avatar.is-fallback .dt-comment__avatar-img {
  display: none;
}

.dt-comment__body {
  flex: 1;
  min-width: 0;
}

.dt-comment__meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.dt-comment__author {
  font-size: 0.875rem;
  font-weight: 600;
}

.dt-comment__date {
  font-family: var(--dt-font-mono);
  font-size: 0.75rem;
  color: hsl(var(--dt-muted-foreground));
}

.dt-comment__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.625;
  color: hsl(var(--dt-muted-foreground));
}

.dt-comment-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.dt-comment-form__field {
  margin: 0;
}

.dt-comment-form__field--full,
.dt-comment-form .comment-form-cookies-consent,
.dt-comment-form .form-submit {
  grid-column: 1 / -1;
}

.dt-comment-form .comment-form-cookies-consent {
  font-size: 0.875rem;
  color: hsl(var(--dt-muted-foreground));
}

@media (max-width: 640px) {
  .dt-comment-form {
    grid-template-columns: 1fr;
  }
}

.dt-comment-form__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .dt-comment-form__row {
    grid-template-columns: 1fr;
  }
}

.dt-input,
.dt-textarea {
  width: 100%;
  border: 1px solid hsl(var(--dt-input));
  border-radius: calc(var(--dt-radius) - 2px);
  background: transparent;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  color: hsl(var(--dt-foreground));
  font-size: 0.875rem;
}

.dt-input {
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
}

.dt-textarea {
  min-height: 60px;
  padding: 0.5rem 0.75rem;
  resize: vertical;
}

.dt-input::placeholder,
.dt-textarea::placeholder {
  color: hsl(var(--dt-muted-foreground));
}

.dt-input:focus,
.dt-textarea:focus {
  outline: 1px solid hsl(var(--dt-primary));
  outline-offset: 0;
}

.dt-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: fit-content;
  height: 2rem;
  border: 0;
  border-radius: calc(var(--dt-radius) - 2px);
  padding-inline: 0.75rem;
  background: hsl(var(--dt-primary));
  color: hsl(var(--dt-primary-foreground));
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.dt-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* --------------------------------------------------------------------------
   13. Utilities
-------------------------------------------------------------------------- */
.dt-text-positive {
  color: hsl(var(--dt-accent));
}

.dt-text-negative {
  color: hsl(var(--dt-destructive));
}

.dt-text-muted {
  color: hsl(var(--dt-muted-foreground));
}

.dt-font-mono {
  font-family: var(--dt-font-mono);
}

/* --------------------------------------------------------------------------
   13. Chart
-------------------------------------------------------------------------- */

.dt-chart-placeholder {
  height: 100%;
  width: 100%;
}

.dt-chart-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dt-chart-grid {
  stroke: hsl(var(--dt-border));
  stroke-dasharray: 3 3;
  stroke-width: 1;
}

.dt-chart-axis {
  fill: hsl(var(--dt-muted-foreground));
  font-family: var(--dt-font-sans);
  font-size: 11px;
}

.dt-chart-axis--y {
  text-anchor: end;
  dominant-baseline: middle;
}

.dt-chart-axis--x {
  text-anchor: middle;
}

.dt-chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dt-chart-dot.is-negative {
  fill: hsl(var(--dt-destructive));
}

.dt-chart-dot {
  fill: hsl(var(--dt-accent));

  stroke-width: 1;
}

/* --------------------------------------------------------------------------
   13. Reading List
-------------------------------------------------------------------------- */


.dt-reading-link {
  border-bottom: 1px solid hsl(var(--dt-border));
  padding: 0.5rem 0;
}

.dt-reading-link:last-child {
  border-bottom: none;
  padding: 0.5rem 0 0 0;
}

.dt-reading-link__intro {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.625;
  color: hsl(var(--dt-muted-foreground));
}

.dt-reading-link__link {
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--dt-font-mono);
  gap: 0.375rem;
}

.dt-reading-link__link:hover {
  text-decoration: underline;
}

.dt-reading-link__link svg {
  width: 0.875rem;
  height: 0.875rem;
  margin-top: 0.2rem;
}