/* ===== CSS-only tooltips via [data-tooltip] =====
   Usage:
     <button data-tooltip="Save changes">Save</button>
     <span class="tt-wrap" data-tooltip="Tip for disabled"><button disabled>Save</button></span>
   Position:
     data-tooltip-pos="top" | "bottom" | "left" | "right" (default: top)
   Theming via CSS vars:
     --tt-bg, --tt-fg, --tt-border, --tt-radius, --tt-shadow, --tt-offset
================================================== */
:root {
  /* sensible defaults mapped to your tokens */
  --tt-bg: var(--background-color-light);
  --tt-fg: var(--text-color);
  --tt-border: var(--border-color);
  --tt-radius: calc(var(--border-radius, 10px) - 4px);
  --tt-shadow: var(--shadow-color);
  --tt-offset: 8px;
}

/* Elements that own tooltips */
[data-tooltip],
.tt-wrap[data-tooltip] {
  position: relative; /* creates containing block for the tooltip */
}

/* Base tooltip box (::after) and arrow (::before) */
[data-tooltip]::after,
[data-tooltip]::before,
.tt-wrap[data-tooltip]::after,
.tt-wrap[data-tooltip]::before {
  position: absolute;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

/* Tooltip bubble */
[data-tooltip]::after,
.tt-wrap[data-tooltip]::after {
  content: attr(data-tooltip);
  max-width: 320px;
  padding: 6px 8px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--tt-fg);
  background: var(--tt-bg);
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  box-shadow: 0 10px 15px -3px var(--tt-shadow), 0 4px 6px -4px var(--tt-shadow);
  white-space: normal; /* allow wrapping */
  word-break: break-word;
}

/* Arrow */
[data-tooltip]::before,
.tt-wrap[data-tooltip]::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--tt-bg);
  border-left: 1px solid var(--tt-border);
  border-top: 1px solid var(--tt-border);
  transform: rotate(45deg);
}

/* Show on hover and keyboard focus */
[data-tooltip]:hover::after,
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::after,
[data-tooltip]:focus-visible::before,
.tt-wrap[data-tooltip]:hover::after,
.tt-wrap[data-tooltip]:hover::before,
.tt-wrap[data-tooltip]:focus-within::after,
.tt-wrap[data-tooltip]:focus-within::before {
  opacity: 1;
  visibility: visible;
}

/* ====== Positioning (default: top) ====== */
/* TOP (default) */
[data-tooltip]::after,
.tt-wrap[data-tooltip]::after {
  bottom: calc(100% + var(--tt-offset));
  left: 50%;
  transform: translate(-50%, -2px);
}

[data-tooltip]::before,
.tt-wrap[data-tooltip]::before {
  bottom: calc(100% + var(--tt-offset) - 4px);
  left: 50%;
  transform: translate(-50%, 0) rotate(45deg);
}

/* BOTTOM */
[data-tooltip][data-tooltip-pos=bottom]::after,
.tt-wrap[data-tooltip][data-tooltip-pos=bottom]::after {
  top: calc(100% + var(--tt-offset));
  left: 50%;
  transform: translate(-50%, 2px);
}

[data-tooltip][data-tooltip-pos=bottom]::before,
.tt-wrap[data-tooltip][data-tooltip-pos=bottom]::before {
  top: calc(100% + var(--tt-offset) - 4px);
  left: 50%;
  transform: translate(-50%, 0) rotate(45deg);
}

/* LEFT */
[data-tooltip][data-tooltip-pos=left]::after,
.tt-wrap[data-tooltip][data-tooltip-pos=left]::after {
  right: calc(100% + var(--tt-offset));
  top: 50%;
  transform: translate(-2px, -50%);
}

[data-tooltip][data-tooltip-pos=left]::before,
.tt-wrap[data-tooltip][data-tooltip-pos=left]::before {
  right: calc(100% + var(--tt-offset) - 4px);
  top: 50%;
  transform: translate(0, -50%) rotate(45deg);
}

/* RIGHT */
[data-tooltip][data-tooltip-pos=right]::after,
.tt-wrap[data-tooltip][data-tooltip-pos=right]::after {
  left: calc(100% + var(--tt-offset));
  top: 50%;
  transform: translate(2px, -50%);
}

[data-tooltip][data-tooltip-pos=right]::before,
.tt-wrap[data-tooltip][data-tooltip-pos=right]::before {
  left: calc(100% + var(--tt-offset) - 4px);
  top: 50%;
  transform: translate(0, -50%) rotate(45deg);
}

/* Reduced motion: no subtle nudge */
@media (prefers-reduced-motion: reduce) {
  [data-tooltip]::after,
  [data-tooltip]::before,
  .tt-wrap[data-tooltip]::after,
  .tt-wrap[data-tooltip]::before {
    transition: opacity 0.12s ease;
  }
}
:root {
  font-family: Shigoto, Inter, Avenir, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  overflow: hidden;
  background: var(--background-color);
  --primary-color: #3fa62a;
  --primary-color-high: rgb(147 198 67);
  --primary-color-ultra: rgb(172 210 70);
  --primary-color-text: #fff;
  --secondary-color: #2aa6a6;
  --secondary-color-high: rgb(68, 199, 199);
  --secondary-color-ultra: rgb(69, 209, 209);
  --secondary-color-text: #fff;
  --text-color: #0f0f0f;
  --label-color: #666;
  --border-radius: 10px;
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --background-color: #f6f6f6;
  --background-color-light: #fff;
  --background-color-light-hover: #f8fafc;
  --background-color-high: #f6f6f6;
  --background-color-high-hover: #e6e6e6;
  --shadow-color: rgba(15, 15, 15, 0.1);
  --error-color: #c00000;
  --error-color-high: #f17676;
  --error-color-dark: hsl(from var(--error-color) h s 30);
  --warning-color: #e67d0c;
  --success-color: var(--primary-color);
  --info-color: #02648f;
  --info-color-high: #009de2;
  --forbidden-color: var(--error-color, red);
  --gradient: linear-gradient(120deg, var(--gradientStop1, var(--primary-color)) 0%, var(--gradientStop2, var(--primary-color-high)) 75%, var(--gradientStop3, var(--primary-color-ultra)) 100%);
  --padding: 20px;
  --half-padding: calc(var(--padding) / 2);
  --quarter-padding: calc(var(--padding) / 4);
  --scrollbar-color: rgba(15, 15, 15, 0.25);
  --scrollbar-hover-color: rgba(10, 10, 10, 0.3);
  --light: color-mix(in srgb, var(--text-color) 50%, transparent);
  --light-hover: color-mix(in srgb, var(--text-color) 70%, transparent);
  color: var(--text-color);
  background-color: transparent;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}
@property --gradientStop1 {
  :root {
    syntax: "<color>";
    initial-value: magenta;
    inherits: false;
  }
}
@property --gradientStop2 {
  :root {
    syntax: "<color>";
    initial-value: #00ff00;
    inherits: false;
  }
}
@property --gradientStop3 {
  :root {
    syntax: "<color>";
    initial-value: #0000ff;
    inherits: false;
  }
}
:root:has(.platform.windows) {
  height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

*::selection {
  background: var(--primary-color-high);
  color: #ffffff;
}

*::-moz-selection {
  background: var(--primary-color-high);
  color: #ffffff;
}

*::-webkit-selection {
  background: var(--primary-color-high);
  color: #ffffff;
}

.label {
  font-size: 95%;
  color: var(--label-color);
  text-align: left;
}

.link {
  color: var(--primary-color);
}
.link:visited {
  color: var(--primary-color);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #f6f6f6;
    --border-color: #4c4e51;
    --border-color-hover: #4c4e51;
    --background-color: #2f2f2f;
    --background-color-light: #1f1f1f;
    --background-color-light-hover: #333333;
    --background-color-high: #2f2f2f;
    --background-color-high-hover: #4c4e51;
    --shadow-color: rgba(15, 15, 15, 0.25);
    --scrollbar-color: rgba(179, 179, 179, 0.5);
    --scrollbar-hover-color: rgba(131, 131, 131, 0.25);
  }
  input[type=checkbox]:not(:checked) {
    filter: invert(1) hue-rotate(180deg) brightness(1.2);
  }
}
a {
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
}

body {
  margin: 0;
  min-height: 100000px;
  background: var(--background-color);
}

input[type=text]:not(.shigoto),
input[type=email]:not(.shigoto),
input[type=password]:not(.shigoto),
input[type=search]:not(.shigoto),
input[type=number]:not(.shigoto),
textarea:not(.shigoto),
select:not(.shigoto) {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text-color);
  background-color: var(--background-color-high);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--half-padding) calc(var(--half-padding) + 2px);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
input[type=text][required]:not(:valid):not(:focus),
input[type=email][required]:not(:valid):not(:focus),
input[type=password][required]:not(:valid):not(:focus),
input[type=search][required]:not(:valid):not(:focus),
input[type=number][required]:not(:valid):not(:focus),
textarea[required]:not(:valid):not(:focus),
select[required]:not(:valid):not(:focus) {
  --primary-color: var(--error-color);
  --primary-color-high: var(--error-color-high);
}

input::placeholder:not(.shigoto),
textarea::placeholder:not(.shigoto) {
  color: var(--label-color);
}

input:hover:not(.shigoto),
textarea:hover:not(.shigoto),
select:hover:not(.shigoto) {
  border-color: var(--border-color-hover);
  background-color: var(--background-color-high-hover);
}

input:focus:not(.shigoto),
textarea:focus:not(.shigoto),
select:focus:not(.shigoto) {
  outline: none;
  border-color: var(--primary-color-high);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent);
}

input:disabled:not(.shigoto),
textarea:disabled:not(.shigoto),
select:disabled:not(.shigoto) {
  background-color: transparent;
  border: none;
}

input[type=checkbox]:not(.shigoto),
input[type=radio]:not(.shigoto) {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
  cursor: pointer;
}

/* optional: consistent focus outline for checkboxes/radios */
input[type=checkbox]:focus-visible:not(.shigoto),
input[type=radio]:focus-visible:not(.shigoto) {
  outline: 2px solid color-mix(in srgb, var(--primary-color) 30%, transparent);
  outline-offset: 2px;
}