/* Beers & Code — Habit Tracker widget
   Self-contained: tokens are scoped to .bchht-habit-tracker so the widget
   looks right regardless of the active theme. Ported from the Claude
   Design prototype (habit-tracker.html / .ht styles). */

.bchht-habit-tracker{
  --bchht-navy: #1E293B;
  --bchht-gold: #F4D35E;
  --bchht-paper: #F8FAFC;
  --bchht-paper-2: #94A3B8;
  --bchht-days: 30;

  max-width: 1080px;
  margin-inline: auto;
  background: var(--bchht-navy);
  color: var(--bchht-paper);
  border-radius: 26px;
  box-shadow: 0 30px 60px -26px rgba(15,23,42,.4);
  overflow: hidden;
  position: relative;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  box-sizing: border-box;
}
.bchht-habit-tracker *,
.bchht-habit-tracker *::before,
.bchht-habit-tracker *::after{ box-sizing: inherit; }

.bchht-habit-tracker::before{
  content: "";
  position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
.bchht-habit-tracker > *{ position: relative; z-index: 1; }

/* header */
.bchht-head{
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: clamp(22px,3vw,30px) clamp(22px,3vw,32px);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.bchht-kick{
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--bchht-gold); margin: 0 0 8px;
}
.bchht-head h2{
  font-family: 'Inter', system-ui, sans-serif; font-weight: 900;
  color: var(--bchht-paper); font-size: clamp(1.5rem,2.6vw,2.1rem);
  margin: 0; line-height: 1.15;
}
.bchht-sub{
  font-family: system-ui, sans-serif;
  color: var(--bchht-paper-2); font-size: .92rem; margin: 8px 0 0;
}

/* progress dial */
.bchht-prog{ display: flex; align-items: center; gap: 16px; }
.bchht-dial{
  --p: 0;
  width: 74px; height: 74px; border-radius: 50%; flex: none;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--bchht-gold) calc(var(--p)*1%), rgba(255,255,255,.1) 0);
}
.bchht-dial::after{
  content: ""; position: absolute; width: 56px; height: 56px;
  border-radius: 50%; background: var(--bchht-navy);
}
.bchht-dial b{
  position: relative; z-index: 1;
  font-family: 'Inter', system-ui, sans-serif; font-weight: 900;
  font-size: 1.05rem; color: var(--bchht-paper);
}
.bchht-lbl{
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .78rem; color: var(--bchht-paper-2); line-height: 1.5; max-width: 16ch;
}
.bchht-lbl b{ color: var(--bchht-gold); }

/* legend */
.bchht-legend{
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 16px clamp(22px,3vw,32px);
  border-bottom: 1px solid rgba(255,255,255,.1);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .72rem; color: var(--bchht-paper-2);
}
.bchht-lg{ display: flex; align-items: center; gap: 8px; }
.bchht-lg .bchht-cell{ width: 18px; height: 18px; cursor: default; pointer-events: none; }

.bchht-empty{
  padding: 24px clamp(22px,3vw,32px);
  color: var(--bchht-paper-2); font-family: system-ui, sans-serif;
}

/* scroll area so many cells stay usable on small screens */
.bchht-scroll{ overflow-x: auto; padding: 8px clamp(14px,3vw,24px) clamp(18px,3vw,26px); }
.bchht-grid{ min-width: 760px; }

/* day-number header */
.bchht-daynums{
  display: grid; grid-template-columns: 180px 1fr; gap: 0 16px; align-items: end;
  padding: 14px 8px 10px;
}
.bchht-nums{ display: grid; grid-template-columns: repeat(var(--bchht-days), 1fr); gap: 6px; min-width: 0; }
.bchht-nums span{
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .6rem; color: var(--bchht-paper-2); text-align: center;
}
.bchht-nums span.wk{ color: var(--bchht-gold); }

/* habit rows */
.bchht-row{
  display: grid; grid-template-columns: 180px 1fr; gap: 0 16px; align-items: center;
  padding: 11px 8px; border-top: 1px solid rgba(255,255,255,.07);
}
.bchht-name{ display: flex; align-items: center; gap: 10px; min-width: 0; }
.bchht-ic{
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(244,211,94,.14); font-size: .85rem;
}
.bchht-t{ min-width: 0; }
.bchht-t b{
  display: block; font-family: 'Inter', system-ui, sans-serif; font-weight: 700;
  font-size: .95rem; color: var(--bchht-paper); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bchht-t small{
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .66rem; color: var(--bchht-paper-2);
}
.bchht-cells{ display: grid !important; grid-template-columns: repeat(var(--bchht-days), 1fr) !important; gap: 6px; min-width: 0; }

/* a single day cell — opacity/fill reflects the logged level.
   `all: unset` first strips inherited/theme button chrome, then every
   sizing-relevant property below is `!important`. This site runs Elementor's
   still-in-development "atomic widgets" system (4.2.0-dev2), which ships its
   own global button/sizing rules — `all: unset` alone wasn't enough to beat
   those on this host, so importance is the only lever left that's guaranteed
   to win regardless of what else targets a bare <button> here. Content (the
   PHP template) never sets width/height/border-radius inline, so there's
   nothing legitimate for these !importants to fight within this file. */
.bchht-cell{
  all: unset;
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  aspect-ratio: 1 !important;
  border-radius: 8px !important;
  border-width: 1.5px !important; border-style: solid !important; border-color: rgba(255,255,255,.16);
  background: var(--bchht-gold); background-clip: padding-box;
  cursor: pointer; margin: 0 !important; padding: 0 !important; position: relative;
  transition: transform .1s ease;
}
.bchht-cell:hover:not(:disabled){ transform: translateY(-2px); }
.bchht-cell:disabled{ cursor: default; opacity: .25 !important; background: transparent !important; }
.bchht-cell[data-level="0"]{ background: transparent; }
.bchht-cell[data-level="1"]{ background: rgba(244,211,94,.30); border-color: rgba(244,211,94,.35); }
.bchht-cell[data-level="2"]{ background: rgba(244,211,94,.55); border-color: rgba(244,211,94,.6); }
.bchht-cell[data-level="3"]{ background: rgba(244,211,94,.78); border-color: rgba(244,211,94,.8); }
.bchht-cell[data-level="4"]{ background: rgba(244,211,94,1); border-color: var(--bchht-gold); }
.bchht-cell:focus-visible{ outline: 2px solid var(--bchht-gold); outline-offset: 2px; }
.bchht-cell.bchht-error-flash{ outline: 2px solid #EF4444; }

/* widget footer */
.bchht-foot{
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 18px clamp(22px,3vw,32px); border-top: 1px solid rgba(255,255,255,.1);
}
.bchht-month{ font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .8rem; color: var(--bchht-paper-2); }
.bchht-month b{ color: var(--bchht-paper); }

@media (max-width: 560px){
  .bchht-daynums, .bchht-row{ grid-template-columns: 120px 1fr; }
}
