/* ============================================================
   TalTech CVI palette for MkDocs Material
   ============================================================
   Brand reference: TalTech CVI 2022
   - Dark Blue #342b60 — structural / "primary"
   - Magenta   #e4067e — accent (links, focus, highlights)
   - Burgundy  #aa1352 — primary hover / darker accent
   - Light Blue #4dbed2 — secondary accent
   - Grey-light #dadae4 — surfaces / dividers

   Used with:   palette.primary = custom, palette.accent = custom
   ============================================================ */

@import url('https://rsms.me/inter/inter.css');

:root {
  /* Light scheme */
  --md-primary-fg-color:              #342b60;
  --md-primary-fg-color--light:       #4c3f86;
  --md-primary-fg-color--dark:        #231e42;
  --md-primary-bg-color:              #ffffff;
  --md-primary-bg-color--light:       rgba(255, 255, 255, 0.7);

  --md-accent-fg-color:               #e4067e;
  --md-accent-fg-color--transparent:  rgba(228, 6, 126, 0.1);
  --md-accent-bg-color:               #ffffff;
  --md-accent-bg-color--light:        rgba(255, 255, 255, 0.7);

  /* Type — Inter web font, with Verdana as the CVI print fallback */
  --md-text-font:
    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue',
    Arial, Verdana, sans-serif;
  --md-code-font:
    'JetBrains Mono', 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
}

@supports (font-variation-settings: normal) {
  :root {
    --md-text-font:
      'Inter var', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
      Arial, Verdana, sans-serif;
  }
}

/* Dark scheme (slate) — lighter primary for contrast, same accent */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color:              #231e42;
  --md-primary-fg-color--light:       #342b60;
  --md-primary-fg-color--dark:        #120e28;

  --md-accent-fg-color:               #f272b0;
  --md-accent-fg-color--transparent:  rgba(242, 115, 176, 0.15);

  --md-default-bg-color:              #120e28;
  --md-default-bg-color--light:       rgba(18, 14, 40, 0.7);
  --md-default-bg-color--lighter:     rgba(18, 14, 40, 0.3);
  --md-code-bg-color:                 #1a1634;
}

/* ---------- Header ---------- */
.md-header {
  background: linear-gradient(
    95deg,
    #342b60 0%,
    #aa1352 55%,
    #e4067e 100%
  );
  box-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.25);
}

[data-md-color-scheme="slate"] .md-header {
  background: linear-gradient(
    95deg,
    #120e28 0%,
    #342b60 60%,
    #aa1352 100%
  );
}

/* Subtle brand wordmark next to the site title */
.md-header__topic:first-child .md-ellipsis::before {
  content: 'TalTech';
  display: inline-block;
  margin-right: 0.6rem;
  padding: 0.1rem 0.4rem;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  border-radius: 4px;
  vertical-align: middle;
  line-height: 1.4;
  transform: translateY(-1px);
}

/* ---------- Tabs ---------- */
.md-tabs {
  background: #231e42;
}

[data-md-color-scheme="slate"] .md-tabs {
  background: #0f0b22;
}

.md-tabs__link--active,
.md-tabs__link:hover {
  color: #ffffff;
  opacity: 1;
}

.md-tabs__link--active::after {
  background: #e4067e;
}

/* ---------- Sidebar / nav active state ---------- */
.md-nav__link--active,
.md-nav__link:hover {
  color: var(--md-accent-fg-color);
}

.md-nav__item .md-nav__link--active {
  font-weight: 600;
}

/* ---------- Content headings ---------- */
.md-typeset h1 {
  color: var(--md-primary-fg-color);
  font-weight: 800;
  letter-spacing: -0.01em;
}

[data-md-color-scheme="slate"] .md-typeset h1 {
  color: #ffffff;
}

.md-typeset h2 {
  color: var(--md-primary-fg-color);
  font-weight: 700;
  border-bottom: 2px solid rgba(228, 6, 126, 0.12);
  padding-bottom: 0.3rem;
}

[data-md-color-scheme="slate"] .md-typeset h2 {
  color: #f2f0ff;
  border-bottom-color: rgba(242, 115, 176, 0.25);
}

.md-typeset h3 {
  color: var(--md-accent-fg-color);
  font-weight: 600;
}

/* ---------- Links in prose ---------- */
.md-typeset a {
  color: var(--md-accent-fg-color);
  text-decoration: none;
  border-bottom: 1px dotted rgba(228, 6, 126, 0.45);
  transition: color 120ms ease, border-color 120ms ease;
}

.md-typeset a:hover {
  color: #aa1352;
  border-bottom-color: #aa1352;
}

[data-md-color-scheme="slate"] .md-typeset a:hover {
  color: #ffffff;
  border-bottom-color: #ffffff;
}

/* ---------- Admonitions ---------- */
.md-typeset .admonition,
.md-typeset details {
  border-left-width: 4px;
  border-radius: 6px;
}

/* ---------- Code blocks ---------- */
.md-typeset code {
  background: rgba(228, 6, 126, 0.08);
  color: #aa1352;
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

[data-md-color-scheme="slate"] .md-typeset code {
  background: rgba(242, 115, 176, 0.15);
  color: #fbd0e5;
}

.md-typeset pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* ---------- Tables ---------- */
.md-typeset table:not([class]) {
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(52, 43, 96, 0.08);
}

.md-typeset table:not([class]) th {
  background: #dadae4;
  color: #342b60;
  font-weight: 600;
  border-bottom: 2px solid #342b60;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: #231e42;
  color: #ffffff;
  border-bottom-color: #e4067e;
}

/* ---------- Search ---------- */
.md-search__form {
  background: rgba(255, 255, 255, 0.18);
}

.md-search__form:hover {
  background: rgba(255, 255, 255, 0.28);
}

[data-md-color-scheme="slate"] .md-search__form {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Buttons / CTAs ---------- */
.md-typeset .md-button--primary {
  background: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
  color: #ffffff;
}

.md-typeset .md-button--primary:hover,
.md-typeset .md-button--primary:focus {
  background: #aa1352;
  border-color: #aa1352;
  color: #ffffff;
}

/* ---------- Footer ---------- */
.md-footer {
  background: #231e42;
}

.md-footer-meta {
  background: #120e28;
}

/* ---------- Selection ---------- */
::selection {
  background: var(--md-accent-fg-color);
  color: #ffffff;
}
::-moz-selection {
  background: var(--md-accent-fg-color);
  color: #ffffff;
}

/* ============================================================
   Landing page hero (used on docs/index.md)
   ============================================================ */
.tt-hero {
  position: relative;
  margin: -1.5rem -1.2rem 2rem;
  padding: 3.5rem 2rem 3rem;
  background:
    radial-gradient(ellipse at top right, rgba(228, 6, 126, 0.35), transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(77, 190, 210, 0.18), transparent 60%),
    linear-gradient(125deg, #231e42 0%, #342b60 45%, #aa1352 100%);
  color: #ffffff;
  border-radius: 0 0 18px 18px;
  box-shadow: 0 12px 40px -18px rgba(35, 30, 66, 0.55);
  overflow: hidden;
}

.tt-hero::before {
  content: 'TalTech';
  position: absolute;
  top: 1.2rem;
  left: 2rem;
  padding: 0.18rem 0.55rem;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  border-radius: 4px;
}

.md-typeset .tt-hero__title,
.md-typeset .tt-hero h1 {
  color: #ffffff;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 1.2rem 0 0.8rem;
  border-bottom: 0;
  padding-bottom: 0;
}

.md-typeset .tt-hero__lede {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.05rem;
  max-width: 36rem;
  margin: 0 0 1.5rem;
  line-height: 1.55;
}

.md-typeset .tt-hero .md-button {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  border-color: rgba(255, 255, 255, 0.7);
  color: #ffffff;
}
.md-typeset .tt-hero .md-button:hover,
.md-typeset .tt-hero .md-button:focus {
  background: rgba(255, 255, 255, 0.14);
  border-color: #ffffff;
  color: #ffffff;
}
.md-typeset .tt-hero .md-button--primary {
  background: #ffffff;
  color: #aa1352 !important;
  border-color: #ffffff;
}
.md-typeset .tt-hero .md-button--primary:hover,
.md-typeset .tt-hero .md-button--primary:focus {
  background: #fdecf4;
  color: #5b0232 !important;
  border-color: #fdecf4;
}

@media (max-width: 720px) {
  .tt-hero {
    padding: 4rem 1.2rem 2rem;
  }
  .md-typeset .tt-hero__title,
  .md-typeset .tt-hero h1 {
    font-size: 2rem;
  }
}

/* ============================================================
   Grid card embellishments
   ============================================================ */
.md-typeset .grid.cards > ul > li,
.md-typeset .grid.cards > .card {
  border-radius: 10px;
  border: 1px solid rgba(52, 43, 96, 0.1);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid.cards > .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -16px rgba(52, 43, 96, 0.35);
  border-color: rgba(228, 6, 126, 0.35);
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li,
[data-md-color-scheme="slate"] .md-typeset .grid.cards > .card {
  border-color: rgba(228, 6, 126, 0.18);
}

/* Coloured icon variants used on landing-page cards */
.md-typeset .tt-icon--magenta { color: #e4067e; }
.md-typeset .tt-icon--green   { color: #62bb46; }
.md-typeset .tt-icon--blue    { color: #4dbed2; }
.md-typeset .tt-icon--slate   { color: #342b60; }

[data-md-color-scheme="slate"] .md-typeset .tt-icon--slate {
  color: #b8b9c8;
}

/* ============================================================
   Live device list table
   ============================================================ */
.tt-devices {
  margin: 1.5rem 0;
  border: 1px solid rgba(52, 43, 96, 0.12);
  border-radius: 12px;
  background: var(--md-default-bg-color);
  box-shadow: 0 4px 20px -12px rgba(52, 43, 96, 0.18);
  overflow: hidden;
}

[data-md-color-scheme="slate"] .tt-devices {
  border-color: rgba(228, 6, 126, 0.18);
  background: rgba(35, 30, 66, 0.55);
}

.tt-devices__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(95deg, #342b60 0%, #aa1352 100%);
  color: #ffffff;
}

.tt-devices__count {
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}
.tt-devices__count strong {
  font-size: 1.15rem;
  margin-right: 0.25rem;
}

.tt-devices__refresh {
  appearance: none;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.tt-devices__refresh:hover,
.tt-devices__refresh:focus {
  background: rgba(255, 255, 255, 0.32);
  outline: 0;
}

.tt-devices__scroll {
  overflow-x: auto;
}

.md-typeset .tt-devices__table {
  margin: 0 !important;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.md-typeset .tt-devices__table th,
.md-typeset .tt-devices__table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(52, 43, 96, 0.08);
  background: transparent;
}

.md-typeset .tt-devices__table thead th {
  background: rgba(228, 6, 126, 0.06) !important;
  color: #342b60 !important;
  border-bottom: 2px solid rgba(228, 6, 126, 0.4) !important;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

[data-md-color-scheme="slate"] .md-typeset .tt-devices__table thead th {
  background: rgba(228, 6, 126, 0.18) !important;
  color: #fdecf4 !important;
}

[data-md-color-scheme="slate"] .md-typeset .tt-devices__table th,
[data-md-color-scheme="slate"] .md-typeset .tt-devices__table td {
  border-bottom-color: rgba(228, 6, 126, 0.14);
}

.md-typeset .tt-devices__table tbody tr:hover {
  background: rgba(228, 6, 126, 0.04);
}

[data-md-color-scheme="slate"] .md-typeset .tt-devices__table tbody tr:hover {
  background: rgba(228, 6, 126, 0.08);
}

.tt-devices__name {
  font-weight: 600;
  color: #342b60;
}

[data-md-color-scheme="slate"] .tt-devices__name {
  color: #f2f0ff;
}

.tt-devices__os {
  white-space: nowrap;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tt-os {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tt-os__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tt-os--android .tt-os__icon { color: #62bb46; }   /* TalTech Green */
.tt-os--ios     .tt-os__icon { color: #342b60; }   /* TalTech Dark Blue */

[data-md-color-scheme="slate"] .tt-os--ios .tt-os__icon {
  color: #f2f0ff;
}

.md-typeset .tt-devices__table code {
  background: rgba(52, 43, 96, 0.06);
  color: #342b60;
  font-size: 0.82rem;
  padding: 0.08em 0.4em;
  border-radius: 4px;
}

[data-md-color-scheme="slate"] .md-typeset .tt-devices__table code {
  background: rgba(255, 255, 255, 0.08);
  color: #fdecf4;
}

.tt-devices__empty,
.tt-devices__loading,
.tt-devices__error {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--md-default-fg-color--light);
}

.tt-devices__error {
  color: #aa1352;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
}

.tt-devices__error .tt-devices__refresh {
  background: rgba(228, 6, 126, 0.12);
  color: #aa1352;
  border-color: rgba(228, 6, 126, 0.4);
}
.tt-devices__error .tt-devices__refresh:hover {
  background: rgba(228, 6, 126, 0.22);
}

.tt-devices__hint {
  margin: 0 !important;
  padding: 0.5rem 1rem 0.75rem;
  font-size: 0.78rem;
  color: var(--md-default-fg-color--light);
  border-top: 1px solid rgba(52, 43, 96, 0.08);
  background: rgba(228, 6, 126, 0.03);
}

[data-md-color-scheme="slate"] .tt-devices__hint {
  background: rgba(228, 6, 126, 0.06);
  border-top-color: rgba(228, 6, 126, 0.14);
}

.md-typeset .tt-devices__hint code {
  background: rgba(52, 43, 96, 0.08);
  color: #aa1352;
  font-size: 0.8rem;
}

/* Spinner */
.tt-devices__spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.4rem;
  border: 2px solid rgba(228, 6, 126, 0.2);
  border-top-color: #e4067e;
  border-radius: 50%;
  animation: tt-spin 0.8s linear infinite;
  vertical-align: -2px;
}

@keyframes tt-spin {
  to { transform: rotate(360deg); }
}

/* Type badges */
.tt-badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tt-badge--phone  { background: rgba(228, 6, 126, 0.12); color: #aa1352; }
.tt-badge--tablet { background: rgba(77, 190, 210, 0.18); color: #115a65; }
.tt-badge--watch  { background: rgba(98, 187, 70, 0.16); color: #2d5a22; }
.tt-badge--slate  { background: rgba(52, 43, 96, 0.1); color: #342b60; }

[data-md-color-scheme="slate"] .tt-badge--phone  { background: rgba(228, 6, 126, 0.22); color: #fdecf4; }
[data-md-color-scheme="slate"] .tt-badge--tablet { background: rgba(77, 190, 210, 0.25); color: #d0f0f5; }
[data-md-color-scheme="slate"] .tt-badge--watch  { background: rgba(98, 187, 70, 0.25); color: #e7f6e0; }
[data-md-color-scheme="slate"] .tt-badge--slate  { background: rgba(255, 255, 255, 0.1); color: #f2f0ff; }
