/*
 * HakoForge Custom Styles for HakoCore Documentation
 * Version: 1.0
 */

/* ===== COLOR VARIABLES ===== */
:root {
    --hf-yellow: #FFD700;
    --hf-yellow-dark: #FFC107;
    --hf-orange: #FF8C00;
    --hf-orange-dark: #FF6F00;
    --hf-dark: #1a1a1a;
    --hf-dark-light: #2d2d2d;
    --hf-gray: #666666;
    --hf-light-gray: #f5f5f5;
  }
  
  /* ===== HEADER CUSTOMIZATION ===== */
  .md-header {
    background-color: var(--hf-dark);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  .md-header__title {
    color: var(--hf-yellow);
    font-weight: 600;
  }
  
  .md-header__button {
    color: var(--hf-yellow);
  }
  
  /* Search bar styling */
  .md-search__input {
    background-color: white;
    color: var(--hf-dark);
    border-radius: 4px;
  }
  
  .md-search__input::placeholder {
    color: var(--hf-gray);
  }
  
  /* Repository link styling */
  .md-source {
    color: var(--hf-yellow);
  }
  
  .md-source:hover {
    color: var(--hf-yellow-dark);
  }
  
  /* ===== NAVIGATION ===== */
  .md-nav__title {
    color: var(--hf-orange);
    font-weight: 600;
  }
  
  .md-nav__item--active > .md-nav__link {
    color: var(--hf-orange);
    font-weight: 500;
  }
  
  /* ===== CUSTOM ADMONITIONS ===== */
  .md-typeset .admonition.hakoforge {
    border-color: var(--hf-yellow);
    border-left: 4px solid var(--hf-yellow);
  }
  
  .md-typeset .admonition.hakoforge > .admonition-title {
    background-color: var(--hf-yellow);
    color: var(--hf-dark);
    font-weight: 600;
  }
  
  .md-typeset .admonition.hakoforge > .admonition-title::before {
    background-color: var(--hf-dark);
    content: "🔧";
    mask: none;
    -webkit-mask: none;
  }
  
  /* Safety warning customization */
  .md-typeset .admonition.danger {
    border-left-color: #ff4444;
  }
  
  .md-typeset .admonition.warning {
    border-left-color: var(--hf-orange);
  }
  
  /* ===== TABLES ===== */
  /* Specification tables */
  .md-typeset table.specs {
    border: 2px solid var(--hf-yellow);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  
  .md-typeset table.specs th {
    background-color: var(--hf-yellow);
    color: var(--hf-dark);
    font-weight: 700;
    text-align: center;
  }
  
  .md-typeset table.specs td {
    border-bottom: 1px solid #e0e0e0;
  }
  
  .md-typeset table.specs tr:nth-child(even) td {
    background-color: var(--hf-light-gray);
  }
  
  /* Connection tables */
  .md-typeset table.connections th {
    background-color: var(--hf-orange);
    color: white;
  }
  
  /* ===== BUTTONS ===== */
  .md-button.hf-primary {
    background-color: var(--hf-yellow);
    color: var(--hf-dark);
    border: 2px solid var(--hf-yellow);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
  }
  
  .md-button.hf-primary:hover {
    background-color: var(--hf-orange);
    border-color: var(--hf-orange);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  }

  /* Homepage product cards: equal-width, center-aligned manual buttons */
  .md-typeset .grid.cards .md-button.hf-primary {
    display: block;
    width: 100%;
    text-align: center;
  }
  
  .md-button.hf-secondary {
    background-color: transparent;
    color: var(--hf-orange);
    border: 2px solid var(--hf-orange);
    font-weight: 600;
  }
  
  .md-button.hf-secondary:hover {
    background-color: var(--hf-orange);
    color: white;
  }
  
  /* ===== CODE BLOCKS ===== */
  .md-typeset .highlight {
    background-color: var(--hf-dark-light);
    border-radius: 6px;
    border: 1px solid var(--hf-gray);
  }
  
  .md-typeset .highlight code {
    color: var(--hf-yellow);
  }
  
  /* ===== CONTENT BOXES ===== */
  .specs-box {
    background-color: var(--hf-light-gray);
    border: 2px solid var(--hf-yellow);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
  }
  
  .specs-box h3 {
    color: var(--hf-orange);
    margin-top: 0;
    border-bottom: 2px solid var(--hf-yellow);
    padding-bottom: 10px;
  }
  
  /* ===== CUSTOM ICONS ===== */
  .icon-hakoforge {
    background-color: var(--hf-yellow);
    border-radius: 50%;
    padding: 8px;
    margin-right: 10px;
  }
  
  /* ===== RESPONSIVE DESIGN ===== */
  .video-center {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
  }
  .video-center iframe {
    max-width: 100%;
  }

  /* Center tables when wrapped in a .table-center container */
  .table-center {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 1rem 0;
  }
  .table-center .md-typeset__table {
    display: inline-block;
    max-width: 100%;
  }

  @media screen and (max-width: 768px) {
    .md-typeset table.specs {
      font-size: 0.8rem;
    }
    
    .specs-box {
      padding: 15px;
      margin: 15px 0;
    }
  }
  
  /* ===== PRINT STYLES ===== */
  @media print {
    .md-header,
    .md-sidebar,
    .md-footer {
      display: none !important;
    }
    
    .md-main__inner {
      margin: 0;
      padding: 0;
    }
    
    .md-content {
      max-width: none;
    }
  }
  
  /* ===== ACCESSIBILITY ===== */
  .md-typeset a:focus,
  .md-button:focus {
    outline: 3px solid var(--hf-yellow);
    outline-offset: 2px;
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
    :root {
      --hf-yellow: #FFFF00;
      --hf-orange: #FF8000;
      --hf-dark: #000000;
    }
  }
  
  /* Reduced motion support */
  @media (prefers-reduced-motion: reduce) {
    .md-button.hf-primary:hover {
      transform: none;
    }

    * {
      transition: none !important;
      animation: none !important;
    }
  }

  /* ===== IMAGE PLACEHOLDERS ===== */
  .hf-placeholder {
    border: 2px dashed var(--hf-orange);
    background: var(--hf-light-gray);
    color: var(--hf-dark);
    padding: 1.25rem;
    margin: 1.5rem 0;
    border-radius: 8px;
    text-align: center;
  }

  .hf-placeholder code {
    background: rgba(0,0,0,.06);
    color: var(--hf-orange-dark);
  }

  [data-md-color-scheme="slate"] .hf-placeholder {
    box-shadow: 0 2px 8px rgba(0,0,0,.4);
  }

  /* ===== HF-L1 PRODUCT GALLERY ===== */
  .hf-product-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
  }
  .hf-product-gallery img {
    flex: 1 1 300px;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
  }
  @media screen and (max-width: 600px) {
    .hf-product-gallery img { flex-basis: 100%; }
  }

  /* ===== PHOTO ALBUM (compact thumbnail grid, click to open lightbox) ===== */
  .hf-photo-album {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .5rem;
    margin: 1.5rem 0;
  }
  /* let markdown-wrapped images/anchors participate directly in the grid */
  .hf-photo-album p { display: contents; }
  .hf-photo-album a { display: block; line-height: 0; }
  .hf-photo-album img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    margin: 0;
    transition: transform .15s ease, box-shadow .15s ease;
  }
  .hf-photo-album a:hover img,
  .hf-photo-album img:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  }

  /* ===== CLICKABLE CARD GRID (whole card is the link) ===== */
  .hf-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
  }
  .hf-card-grid > a.hf-card,
  .hf-card-grid > .hf-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 130px;
    padding: 1.75rem 1.25rem;
    border: 1px solid var(--hf-yellow);
    border-radius: 8px;
    background: var(--md-default-bg-color);
    text-decoration: none;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  }
  .hf-card-grid > a.hf-card:hover,
  .hf-card-grid > a.hf-card:focus {
    border-color: var(--hf-orange);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    transform: translateY(-3px);
  }
  .hf-card-grid .hf-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--md-default-fg-color);
  }
  .hf-card-grid .hf-card-desc {
    margin-top: .5rem;
    font-size: .78rem;
    font-weight: 400;
    color: var(--md-default-fg-color--light);
    line-height: 1.4;
  }
  /* Non-clickable placeholder card */
  .hf-card-grid > .hf-card-muted {
    border-style: dashed;
    opacity: .7;
    cursor: default;
  }

  /* ===================================================================
     VISUAL REFRESH v1 — warmer palette + clearer nav section headings
     =================================================================== */

  /* ---- Left nav: section/group headings stand apart from entries ---- */
  .md-nav--primary label.md-nav__link {
    color: var(--hf-orange);
    text-transform: uppercase;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    margin-top: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid currentColor;
  }
  .md-nav--primary a.md-nav__link {
    font-size: 0.72rem;
  }

  /* ---- Dark (slate) scheme: warm charcoal instead of blue-grey ---- */
  [data-md-color-scheme="slate"] {
    --md-hue: 30;
    --md-default-bg-color: #1c1b1a;
    --md-default-bg-color--light: #232221;
    --md-default-bg-color--lighter: #2b2a28;
    --md-default-bg-color--lightest: #333230;
    --md-default-fg-color: rgba(255, 255, 255, 0.90);
    --md-default-fg-color--light: rgba(255, 255, 255, 0.70);
    --md-default-fg-color--lighter: rgba(255, 255, 255, 0.45);
    --md-code-bg-color: #262523;
    --md-typeset-a-color: var(--hf-yellow);
  }
  [data-md-color-scheme="slate"] .md-nav--primary label.md-nav__link {
    color: var(--hf-yellow);
  }

  /* ---- Light (default) scheme: warm off-white + readable links ---- */
  [data-md-color-scheme="default"] {
    --md-default-bg-color: #f7f6f3;
    --md-typeset-a-color: #c05600;
  }

  /* ---- Headings: a touch of industrial authority ---- */
  .md-typeset h1 {
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--hf-orange);
  }
  .md-typeset h2 {
    font-weight: 700;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--hf-orange);
  }

  /* ---- Left nav product/section title + page H1: brand color, not grey ---- */
  .md-nav--primary .md-nav__title {
    color: var(--hf-orange) !important;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.09em;
    border-bottom: 1px solid currentColor;
  }
  [data-md-color-scheme="slate"] .md-nav--primary .md-nav__title {
    color: var(--hf-yellow) !important;
  }
  [data-md-color-scheme="slate"] .md-typeset h1 {
    color: var(--hf-yellow);
  }

  /* Desktop "lifted" nav colors the top section title grey — override it */
  @media screen and (min-width: 76.25em) {
    [data-md-color-scheme="default"] .md-nav--lifted > .md-nav__list > .md-nav__item > .md-nav__link {
      color: var(--hf-orange);
    }
    [data-md-color-scheme="slate"] .md-nav--lifted > .md-nav__list > .md-nav__item > .md-nav__link {
      color: var(--hf-yellow);
    }
  }

  /* ---- Header: contact email next to the repo link ---- */
  .md-header__source {
    width: auto;
    max-width: none;
  }
  .hf-header-source {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: 100%;
  }
  .hf-header-mail {
    display: inline-flex;
    align-items: center;
    color: var(--hf-yellow);
    flex-shrink: 0;
  }
  .hf-header-mail svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: currentColor;
  }
  .hf-header-mail:hover {
    color: var(--hf-yellow-dark);
  }

  /* ---- Remove the bottom footer entirely ---- */
  .md-footer {
    display: none;
  }

  /* ---- Header: center + widen the search; palette ends up by the email ---- */
  @media screen and (min-width: 60em) {
    .md-header__inner {
      position: relative;
    }
    .md-header__inner .md-search {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 32rem;
      max-width: 40vw;
    }
    /* the visible box floats right at 11.7rem by default — fill & center it */
    .md-header__inner .md-search .md-search__inner {
      float: none !important;
      width: 100% !important;
    }
    .md-header__inner .md-search .md-search__form,
    .md-header__inner .md-search .md-search__input {
      width: 100%;
    }
    /* tighten the gap between the light/dark toggle and the email button */
    .md-header__source {
      margin-left: 0.3rem;
    }
  }