@font-face {
  font-family: 'Favorit-Book'; 
  src: url('./font/Favorit-Book.woff2') format('woff2'),
       url('./font/Favorit-Book.woff2') format('woff');
}
@font-face {
  font-family: 'Gaisyr-Book'; 
  src: url('./font/Gaisyr-Book.woff2') format('woff2'),
       url('./font/Gaisyr-Book.woff2') format('woff');
}
@font-face{
    font-family: 'Gaisyr-MediumItalic';
    src: url('./font/Gaisyr-MediumItalic.woff2'), format('woff2');
}
@font-face{
    font-family: 'Gaisyr-BookItalic';
    src: url('./font/Gaisyr-BookItalic.woff2'), format('woff2');
}
:root {
    --beige: #FFF3ED;
    --brown: #432D1C;
    --black: #000000;

    --bg-01: var(--beige);
    --bg-02: var(--brown);

    --main-font: 'Favorit-Book', sans-serif;
    --data-font: 'Gaisyr-Book', serif;
    --data-font-selected: 'Gaisyr-MediumItalic', serif;
    --main-size:10.5px;
    --data-size:11px;

    --col-categories: 145px;
    --col-flow: 100px;      
    --col-motifs: 180px;
    --col-flow2: 100px;     
    --col-meaning: 155px;

    --detail-width: 390px;

    --nav-height: 38px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--main-font);
}

body{
    background-color: var(--bg-01);
    padding-top: var(--nav-height);
}
html, body{
  height:100%;
  overflow:hidden;
}
a{
  text-decoration:none;
}
#container {
    display: flex;
    flex-direction: row; 
    align-items:stretch;
    padding: 0px;
    gap: 0px;
    height: calc(100vh - var(--nav-height));
}
.section{
  display:flex;
  flex-direction:column;
}

.section-header{
  height:36px;
  display:flex;
  align-items:center;
  font-size:13px;
  color:var(--brown);
  border-bottom:1px dashed var(--brown);
  padding: 0px;
}

#seals-section-header{
  padding-left:18px;
  padding-right:18px;
  justify-content: space-between;
}

#seals-header-right {
  display: flex;
  align-items: center;
}

/* ── Show original toggle ── */
#show-original-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

#show-original-label {
  font-size: var(--main-size);
  color: var(--brown);
  opacity: 0.7;
}

#toggle-track {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 16px;
  background-color: #D6BAA9;
  border-radius: 9px;
  transition: background-color 0.25s ease;
  flex-shrink: 0;
}

#show-original-toggle.active #toggle-track {
  background-color: var(--brown);
}

#toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background-color: var(--beige);
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#show-original-toggle.active #toggle-thumb {
  transform: translateX(16px);
}

/* In original mode, de-emphasise color highlight on seals */
#seals.seals--original .seal:hover {
  background-color: rgb(255, 248, 245);
}
#seals.seals--original .seal--selected {
  background-color: #f0e8e0 !important;
}

/* In original mode, seals grid goes white */
#seals.seals--original,
#seals.seals--original .seal {
  background-color: #ffffff;
  transition: background-color 0.25s ease;
}

/* ── Seals ── */
#seals-section{
  flex:1;
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  transition: flex 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When a seal is selected, collapse the seal column to narrow single-col */
#seals-section.seals--narrow {
  /* flex: 0 0 var(--seal-grid-width); */
    flex: 1 1 auto;

}

#seals {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    flex: 1;
    overflow-y:auto;
    scroll-behavior:smooth;
    transition: grid-template-columns 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* narrow mode: single column */
#seals-section.seals--narrow #seals {
    /* grid-template-columns: 1fr; */
}

#seals::-webkit-scrollbar{
    display:none;
}

.seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
  min-height:210px;
  border-bottom: #D6BAA9 dashed 1px;
  border-left: #D6BAA9 dashed 1px;
  transition: background-color 0.2s ease, min-height 0.3s ease;
  gap:18px;
  padding:20px 18px 20px;
}
.seal svg {
  width: 100%;
  height: auto;
  max-height: 100%; 
  display: block; 
}

.seal-name {
  text-align: center;
  font-size:var(--main-size);
  color: var(--brown);
  word-break: break-word;
  padding: 0px 0px;
  display:flex;
  align-items: center;
  height:36px;
}

.seal:hover{
    cursor: pointer;
    background-color:rgb(255, 248, 245);
    background-color:#ffede3;
}

/* Selected seal in narrow grid */
.seal--selected {
  background-color: #f5e0d2 !important;
  border-bottom-color: #c4a08a !important;
}

/* Seals header becomes clickable in detail view */
#seals-section.seals--narrow #seals-section-header {
  cursor: pointer;
}
#seals-section.seals--narrow #seals-section-header:hover {
  background-color: rgba(214, 186, 169, 0.2);
}

/* In narrow mode, reduce the min-height for compact display */
#seals-section.seals--narrow .seal {
  min-height: 140px;
  gap: 10px;
  padding: 16px 12px 14px;
  min-height: 200px;
  gap: 18px;
  padding: 24px 18px 22px;
}

#seals-section.seals--narrow .seal-name {
  font-size: 10.5px;
  height: auto;
  min-height: 24px;
}

/* ── Legend section ── */
#legend-section {
  background-color: var(--bg-02);
  color: var(--beige);
  display: flex;
  flex-direction: column;
  border-left: var(--brown) 1px dashed;
  overflow: hidden;
  transition: flex-basis 0.45s cubic-bezier(0.4, 0, 0.2, 1);

  /* collapsed: just categories col width */
  flex: 0 0 var(--col-categories);
}

#legend-section.expanded {
  flex: 0 0 calc(var(--col-categories) + var(--col-flow) + var(--col-motifs) + var(--col-flow2) + var(--col-meaning));
}

/* header row aligned to columns */
#legend-section-header {
  color: var(--beige);
  border-bottom: 1px dashed var(--beige);
  padding: 0;
  gap: 0;
  overflow: hidden;
}

/* Motif and meaning headers slide in */
#legend-header-motifs,
#legend-header-meaning {
  opacity: 0;
  transition: opacity 0.3s ease 0.2s;
}
#legend-section.expanded #legend-header-motifs,
#legend-section.expanded #legend-header-meaning {
  opacity: 1;
}

.legend-col-header {
  display: flex;
  align-items: center;
  text-align:left;
  gap: 8px;
  height: 36px;
  font-size: 13px;
  padding: 0px;
  white-space: nowrap;
}

#legend-header-categories {
  width: var(--col-categories);
  flex-shrink: 0;
}

#legend-header-motifs {
  width: calc(var(--col-flow) + var(--col-motifs));
  flex-shrink: 0;
  padding-left: var(--col-flow);
}

#legend-header-meaning {
  width: calc(var(--col-flow2) + var(--col-meaning));
  flex-shrink: 0;
  padding-left: calc(var(--col-flow2) - 6px);
  /* padding-left: var(--col-flow2); */
  gap:0px;

}

/* ── wrapper holds SVG overlay + columns ── */
#legend-columns-wrapper {
  position: relative;
  flex: 1;
  display: flex;
}

#legend-links {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

#legend-columns {
  display: flex;
  flex-direction: row;
  height: calc(100vh - var(--nav-height) - 36px);
  width: 100%;
}

/* ── individual columns ── */
#legend-categories {
  width: var(--col-categories);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--data-font);
  border-right: 1px dashed rgba(255,243,237,0.35);
}

/* In collapsed state, color bars are 130px wide */
#legend-categories .legend-color {
  width: 50px;
  transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
#legend-section.expanded #legend-categories .legend-color {
  width: 50px;
}

/* Labels in categories col always visible */
#legend-categories .legend-label {
  white-space: nowrap;
}

/* flow gap between categories and motifs */
#legend-flow-gap {
  width: var(--col-flow);
  flex-shrink: 0;
}

#legend-motifs {
  width: var(--col-motifs);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px dashed rgba(255,243,237,0.35);
}

/* flow gap between motifs and meaning */
#legend-flow-gap2,
#legend-flow2-gap {
  width: var(--col-flow2);
  flex-shrink: 0;
}

#legend-meaning {
  width: var(--col-meaning);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── legend items ── */
.legend-item {
  display: flex;
  align-items: flex-start;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}
.legend-item:hover {
  opacity: 0.9;
}

.legend-color {
  width: 50px;
  flex-shrink: 0;
}

.legend-label {
  margin-left: 10px;
  font-size: var(--data-size);
  color: var(--beige);
  font-family: var(--data-font);
  font-weight: 200;
  display: flex;
  align-items: top;
  height: 100%;
  white-space: nowrap;
}

/* First item label in each legend column gets a 2px top nudge */
#legend-categories .legend-item:first-child .legend-label,
#legend-motifs .legend-item:first-child .legend-label,
#legend-meaning .legend-item:first-child .legend-label {
  padding-top: 3px;
}

/* meaning column items use narrower color bar */
#legend-meaning .legend-color {
  width: 50px;
}

#legend-section-header {
  color: var(--beige);
  border-bottom: 1px dashed var(--beige);
}
#legend-categories {
  display: flex;
  flex-direction: column;
  font-family: var(--data-font);
}

#legend button {
  border: none;
  color: var(--brown);
  font-family: var(--data-font);
  font-weight: bold;
  cursor: pointer;
  display: flex;
  flex-direction: row;
}

#legend button:hover {
  opacity: 0.8;
}

/* ── Detail Panel ── */
#detail-panel {
  flex: 0 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: var(--beige);
  /* border-left: 1px solid #c4a08a; */
  transition: flex-basis 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 0;
}

#detail-panel.detail-panel--open {
  flex: 0 0 var(--detail-width);
}

#detail-header {
  color: var(--brown);
  border-bottom: 1px dashed var(--brown);
  padding: 0 18px;
  gap: 10px;
  flex-shrink: 0;
}

#detail-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--brown);
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
#detail-back-btn:hover {
  opacity: 1;
}

#detail-header-label {
  font-size: 13px;
  color: var(--brown);
}

#detail-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 26px 24px 32px;
  gap: 28px;
  min-width: var(--detail-width);
}
#detail-body::-webkit-scrollbar {
  display: none;
}

#detail-seal-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height:270px;
}

#detail-seal-preview svg {
  width: 100%;
  height: auto;
  /* max-height: 270px; */
  height:100%;
  display: block;
}

#detail-info {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-label {
  font-size: var(--main-size);
  color: var(--brown);
  opacity: 0.55;
  font-family: var(--main-font);
  letter-spacing: 0.06em;
}

.detail-value {
  font-size: 20px;
  color: var(--brown);
  font-family: var(--main-font);
  line-height: 1.2;
}

.detail-value.detail-motto {
  font-size: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-motto-tr{
  opacity:0.6;
}

/* ── Top Nav ── */
#top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 100;
  background-color: #EDDFD5;
  border-bottom: 1px solid var(--brown);
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-size: 13px;
}

#nav-left {
  flex: 1;
  display: flex;
  align-items: center;
}

#nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

#nav-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#nav-title {
  color: var(--brown);
  text-decoration: none;
  font-size: 13px;
}

#nav-index {
  color: var(--brown);
  font-size: 13px;
}

#nav-sep {
  color: var(--brown);
  opacity: 0.6;
  font-size: 13px;
}

#nav-timeline {
  color: var(--brown);
  opacity: 0.6;
  text-decoration: none;
  font-size: 13px;
  transition: opacity 0.15s;
}

#nav-timeline:hover {
  opacity: 1;
}

#nav-about {
  color: var(--brown);
  text-decoration: none;
  font-size: 13px;
  transition: opacity 0.15s;
}

#nav-about:hover {
  opacity: 0.7;
}