/* ============================================================
   WHISKEY FAMILY TREE — TREE VISUALIZATION STYLESHEET
   tree.css — Visual hierarchy, connectors, nodes
   ============================================================ */

/* ── Tree Container ──────────────────────────────────────────── */
.tree-wrap {
  overflow-x: auto;
  padding: var(--space-xl) var(--space-md);
  -webkit-overflow-scrolling: touch;
}

.tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 900px;
  position: relative;
}

/* ── Root Node ───────────────────────────────────────────────── */
.tree-root {
  background: linear-gradient(135deg, #2a1a05, #1a0e00);
  border: 2px solid var(--gold-bright);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-2xl);
  text-align: center;
  position: relative;
  box-shadow: 0 0 40px rgba(200,134,10,.25), var(--shadow-lg);
  margin-bottom: 0;
}

.tree-root-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold-bright);
  letter-spacing: .06em;
}

.tree-root-sub {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* ── Vertical connector from root to branch row ────────────── */
.tree-root-line {
  width: 2px;
  height: 40px;
  background: var(--border-strong);
  margin: 0 auto;
}

/* ── Branch Row ─────────────────────────────────────────────── */
.tree-branches {
  display: flex;
  justify-content: center;
  gap: 0;
  position: relative;
  width: 100%;
}

/* Horizontal spanning line across top of branches */
.tree-branches::before {
  content: '';
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 2px;
  background: var(--border-strong);
}

/* ── Branch Column ───────────────────────────────────────────── */
.tree-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  position: relative;
}

/* Vertical line from top connector down to branch header */
.tree-branch::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 36px;
  background: var(--border-strong);
}

/* ── Branch Header ───────────────────────────────────────────── */
.tree-branch-header {
  margin-top: 36px;
  border-radius: var(--radius-lg);
  padding: .7rem 1rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: .88rem;
  font-weight: 700;
  width: 88%;
  position: relative;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  display: block;
  line-height: 1.3;
}

.tree-branch-header:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.tree-branch-header-flag {
  font-size: 1.4rem;
  display: block;
  margin-bottom: .2rem;
}

.tree-branch-header-name {
  display: block;
  font-size: .82rem;
}

/* Region-coloured headers */
.tree-branch--american .tree-branch-header {
  background: rgba(200,134,10,.15);
  border: 2px solid var(--american);
  color: var(--american);
  box-shadow: 0 0 16px rgba(200,134,10,.15);
}
.tree-branch--american .tree-branch-header:hover {
  box-shadow: 0 0 24px rgba(200,134,10,.3);
}

.tree-branch--scotch .tree-branch-header {
  background: rgba(46,125,50,.15);
  border: 2px solid var(--scotch);
  color: var(--scotch);
  box-shadow: 0 0 16px rgba(46,125,50,.15);
}
.tree-branch--scotch .tree-branch-header:hover {
  box-shadow: 0 0 24px rgba(46,125,50,.3);
}

.tree-branch--irish .tree-branch-header {
  background: rgba(21,101,192,.15);
  border: 2px solid var(--irish);
  color: var(--irish);
  box-shadow: 0 0 16px rgba(21,101,192,.15);
}
.tree-branch--irish .tree-branch-header:hover {
  box-shadow: 0 0 24px rgba(21,101,192,.3);
}

.tree-branch--canadian .tree-branch-header {
  background: rgba(183,28,28,.15);
  border: 2px solid var(--canadian);
  color: var(--canadian);
  box-shadow: 0 0 16px rgba(183,28,28,.15);
}
.tree-branch--canadian .tree-branch-header:hover {
  box-shadow: 0 0 24px rgba(183,28,28,.3);
}

.tree-branch--japanese .tree-branch-header {
  background: rgba(106,27,154,.15);
  border: 2px solid var(--japanese);
  color: var(--japanese);
  box-shadow: 0 0 16px rgba(106,27,154,.15);
}
.tree-branch--japanese .tree-branch-header:hover {
  box-shadow: 0 0 24px rgba(106,27,154,.3);
}

.tree-branch--world .tree-branch-header {
  background: rgba(0,105,92,.15);
  border: 2px solid var(--world);
  color: var(--world);
  box-shadow: 0 0 16px rgba(0,105,92,.15);
}
.tree-branch--world .tree-branch-header:hover {
  box-shadow: 0 0 24px rgba(0,105,92,.3);
}

/* ── Connector from branch header down to children ──────────── */
.tree-branch-line {
  width: 2px;
  height: 24px;
  margin: 0 auto;
}

.tree-branch--american .tree-branch-line { background: var(--american); }
.tree-branch--scotch   .tree-branch-line { background: var(--scotch); }
.tree-branch--irish    .tree-branch-line { background: var(--irish); }
.tree-branch--canadian .tree-branch-line { background: var(--canadian); }
.tree-branch--japanese .tree-branch-line { background: var(--japanese); }
.tree-branch--world    .tree-branch-line { background: var(--world); }

/* ── Leaf Nodes ─────────────────────────────────────────────── */
.tree-leaves {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 88%;
}

.tree-leaf {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: .45rem .75rem;
  font-size: .72rem;
  color: var(--text-secondary);
  text-align: center;
  text-decoration: none;
  width: 100%;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  line-height: 1.3;
}

.tree-leaf:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.tree-branch--american .tree-leaf { border-left-color: rgba(200,134,10,.4); }
.tree-branch--scotch   .tree-leaf { border-left-color: rgba(46,125,50,.4); }
.tree-branch--irish    .tree-leaf { border-left-color: rgba(21,101,192,.4); }
.tree-branch--canadian .tree-leaf { border-left-color: rgba(183,28,28,.4); }
.tree-branch--japanese .tree-leaf { border-left-color: rgba(106,27,154,.4); }
.tree-branch--world    .tree-leaf { border-left-color: rgba(0,105,92,.4); }

/* ── Legend ─────────────────────────────────────────────────── */
.tree-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
  padding: var(--space-lg);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-top: var(--space-xl);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: .82rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Flavor Wheel ────────────────────────────────────────────── */
.flavor-wheel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl) 0;
}

.flavor-wheel {
  position: relative;
  width: 320px;
  height: 320px;
}

.flavor-wheel svg {
  width: 100%;
  height: 100%;
}

.flavor-wheel-segment {
  cursor: pointer;
  transition: fill-opacity .15s ease;
}

.flavor-wheel-segment:hover,
.flavor-wheel-segment:focus-visible {
  fill-opacity: 1;
}

.flavor-wheel-segment:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 1px;
}

.flavor-wheel-caption {
  min-height: 1.4em;
  max-width: 440px;
  margin: 0;
  text-align: center;
  font-size: .95rem;
  color: var(--text-muted);
}

.flavor-wheel-caption strong {
  color: var(--gold-bright);
}

.flavor-center-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.flavor-center-label span {
  display: block;
  font-family: var(--font-display);
  font-size: .85rem;
  color: var(--gold-bright);
  line-height: 1.3;
}

/* ── Scotch Regions Map ──────────────────────────────────────── */
.region-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.region-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.region-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.region-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.region-card--speyside::after  { background: #388e3c; }
.region-card--islay::after     { background: #546e7a; }
.region-card--highlands::after { background: #1976d2; }
.region-card--lowlands::after  { background: #f9a825; }
.region-card--campbeltown::after { background: #7b1fa2; }
.region-card--islands::after   { background: #00838f; }

.region-card-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold-bright);
  margin-bottom: .3rem;
}

.region-card-character {
  font-size: .8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  font-style: italic;
}

.region-card-distilleries {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* ── Mash Bill Compare (index page) ─────────────────────────── */
.mashbill-compare {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.mashbill-compare-title {
  font-family: var(--font-display);
  color: var(--gold-bright);
  margin-bottom: var(--space-lg);
  font-size: 1.1rem;
}

.mashbill-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.mashbill-name {
  font-size: .82rem;
  color: var(--text-secondary);
  text-align: right;
}

.mashbill-bars {
  display: flex;
  height: 20px;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.mashbill-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  font-weight: 700;
  color: rgba(0,0,0,.75);
  transition: width .8s ease;
}

@media (max-width: 600px) {
  .mashbill-row { grid-template-columns: 1fr; }
  .mashbill-name { text-align: left; }
  .tree-branches { flex-direction: column; align-items: center; }
  .tree-branches::before { display: none; }
  .tree-branch { min-width: 260px; max-width: 320px; }
  .tree-branch::before { display: none; }
}
