@property --tg-rim-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 222deg;
}

[data-tg-button] {
  --tg-top: #335b44;
  --tg-middle: #173e2d;
  --tg-bottom: #09251b;
  --tg-ink: #ffe299;
  --tg-letter: linear-gradient(176deg, #fff0b4 12%, #ffdf83 37%, #f7bf54 64%, #ffe59c 90%);
  --tg-flash: #fff9da;
  --tg-depth: 3px;
  --tg-crest: -.19em;
  --tg-metal: conic-gradient(from var(--tg-rim-angle, 222deg), #a57434 0deg, #dfba75 54deg,
       #94622b 103deg, #d8ab62 149deg, #8c622e 200deg, #b18343 267deg, #e7bb6e 305deg,
       #ffd678 324deg, #ffefac 334deg, #ffffe4 339deg, #edc56b 345deg, #a57434 360deg);
}

/* Only the finish is shared. Each control retains its own layout, content and hit area. */
@layer tedyGoldControls {
  :is([data-tg-button="face"], [data-tg-button="value"]) {
    background-color: var(--tg-bottom) !important;
    background-image: linear-gradient(174deg, var(--tg-top), var(--tg-middle) 51%, var(--tg-bottom)), var(--tg-metal) !important;
    background-clip: padding-box, border-box !important;
    background-origin: padding-box, border-box !important;
    background-size: 100% 100%, 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border: 2px solid transparent !important;
    box-shadow: inset 0 1px 0 #f9e9b45c, inset 0 -1px 1px #071a12,
         0 1px 0 #e7be77, 0 var(--tg-depth) 0 #795325,
         0 calc(var(--tg-depth) + 3px) 7px -4px #150f08a8 !important;
    color: var(--tg-ink) !important;
    text-shadow: 0 1px 1px #32200f !important;
    text-decoration: none !important;
  }
  [data-tg-button="art"] {
    outline: 1px solid #e4bf74 !important;
    outline-offset: -2px !important;
    box-shadow: inset 0 0 0 1px #95622e, 0 1px 3px #86612c99 !important;
  }
  @supports (width: calc(1px * sin(1deg))) {
    [data-tg-button="art"][data-tg-visible] {
      box-shadow: inset 0 0 0 1px #95622e,
          calc(2px * sin(var(--tg-rim-angle, 222deg))) calc(-2px * cos(var(--tg-rim-angle, 222deg)))
          3px #ffe9a6a6 !important;
    }
  }
  :is([data-tg-button="face"], [data-tg-button="value"]):active:not(:disabled):not([aria-disabled="true"]) {
    box-shadow: inset 0 2px 4px #04180fa3, 0 1px 0 #b48a4a !important;
  }
  [data-tg-button]:focus-visible {
    outline: 3px solid #fff0be !important;
    outline-offset: 3px !important;
  }
  [data-tg-button]:is(:disabled, [aria-disabled="true"], .disabled) {
    box-shadow: inset 0 1px 0 #c1c6b52e, 0 1px 0 #655f4d !important;
  }
}

:where([data-tg-button="face"], [data-tg-button="value"]) { border-radius: .85rem; }

[data-tg-button]:is(.active, .is-active, .selected, .is-selected, .current,
                    [aria-selected="true"], [aria-pressed="true"], [aria-checked="true"],
                    [aria-expanded="true"], [aria-current="page"], [aria-current="step"], [aria-current="true"]) {
  --tg-top: #ffedaa;
  --tg-middle: #e8bc6b;
  --tg-bottom: #c59950;
  --tg-ink: #2d210e;
  --tg-letter: linear-gradient(#30210e, #49310f);
  --tg-flash: #5c3c16;
}
[data-tg-button]:is(.danger, .btn-danger, .destructive, .recording, .is-recording,
                    [data-tg-danger], [data-recording="true"]) {
  --tg-top: #74483b;
  --tg-middle: #532b27;
  --tg-bottom: #341e1c;
  --tg-ink: #ffdfab;
  --tg-letter: linear-gradient(#fff0cc, #f6c893);
}
[data-tg-button="art"]:is(.active, .selected, [aria-selected="true"], [aria-pressed="true"]) {
  outline-width: 3px !important;
}
[data-tg-button]:is(:disabled, [aria-disabled="true"], .disabled) {
  --tg-top: #475349;
  --tg-middle: #354238;
  --tg-bottom: #2c362f;
  --tg-ink: #d4d3c5;
  --tg-letter: linear-gradient(#dedccd, #c4c4b6);
  --tg-metal: linear-gradient(115deg, #827862, #b5aa8e 50%, #7b7568);
  --tg-depth: 1px;
  --tg-crest: 0em;
}
:where(nav a:not([class]), .tedy-live-header a:not([class]), a.back)[data-tg-button="face"] {
  padding-inline: .65em;
}

tedy-button-caption, tedy-button-word {
  pointer-events: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
tedy-button-caption { display: inline; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
tedy-button-word {
  display: inline-block;
  vertical-align: baseline;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--tg-ink);
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  tedy-button-word {
    color: transparent;
    -webkit-text-fill-color: transparent;
    background-color: var(--tg-ink);
    background-image: linear-gradient(106deg, transparent 36%, var(--tg-flash) 50%, transparent 65%), var(--tg-letter);
    background-size: 270% 100%, 100% 100%;
    background-position: 115% 50%, center;
    background-repeat: no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    text-shadow: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  [data-tg-visible]:not(:disabled):not([aria-disabled="true"]):not(.disabled) > :is(tedy-button-caption, :not([data-tg-button])) tedy-button-word {
    animation: tg-word-lift 4.8s ease-in-out infinite backwards;
    animation-delay: var(--tg-phase, -.55s);
  }
  input[data-tg-button="value"][data-tg-visible]:not(:disabled):not([aria-disabled="true"]) {
    animation: tg-native-caption 4.8s ease-in-out infinite;
  }
}
@keyframes tg-word-lift {
  0% { transform: translateY(0); background-position: 115% 50%, center; }
  16% { transform: translateY(var(--tg-crest)); }
  36%, 100% { transform: translateY(0); background-position: -15% 50%, center; }
}
@keyframes tg-native-caption {
  0%, 36%, 100% { text-indent: 0; }
  16% { text-indent: .22em; }
}

input[type="file"]::file-selector-button {
  border: 1px solid #dab66e;
  border-radius: .7em;
  background: linear-gradient(#345b44, #103021);
  color: #ffe29d;
  font: inherit;
  box-shadow: 0 2px 0 #845d2b;
}
html:not([data-tg-installed]) :where(a.btn, a.download, a.back, button.btn, button.gold-btn, input[type="submit"]) {
  background: linear-gradient(#315741, #102c20);
  color: #ffe29d;
  border: 2px solid #d5ac64;
  box-shadow: 0 2px 0 #815a2b;
}

@media (forced-colors: active) {
  @layer tedyGoldControls {
    [data-tg-button] {
      background: ButtonFace !important; border-color: ButtonText !important;
      color: ButtonText !important; text-shadow: none !important; box-shadow: none !important;
    }
    [data-tg-button="art"] { background: revert !important; outline-color: ButtonText !important; }
    [data-tg-button]:is([aria-selected="true"], [aria-pressed="true"], .active, .selected) {
      outline: 2px solid Highlight !important;
    }
    [data-tg-button]:focus-visible { outline-color: Highlight !important; }
    [data-tg-button]:disabled { color: GrayText !important; border-color: GrayText !important; }
  }
  [data-tg-visible] tedy-button-word, input[data-tg-button][data-tg-visible] {
    animation: none !important;
  }
  tedy-button-word { background: none; color: ButtonText; -webkit-text-fill-color: ButtonText; }
  :disabled tedy-button-word { color: GrayText; -webkit-text-fill-color: GrayText; }
}
