@layer reset, base, components;

@font-face {
  font-family: "NomNaTong";

  src: url("../styles/NomNaTong-Regular.ttf") format("truetype");

  font-weight: normal;
  font-style: normal;
}

@layer reset {
  /* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

  html,
  body,
  div,
  span,
  applet,
  object,
  iframe,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  blockquote,
  pre,
  a,
  abbr,
  acronym,
  address,
  big,
  cite,
  code,
  del,
  dfn,
  em,
  img,
  ins,
  kbd,
  q,
  s,
  samp,
  small,
  strike,
  strong,
  sub,
  sup,
  tt,
  var,
  b,
  u,
  i,
  center,
  dl,
  dt,
  dd,
  ol,
  ul,
  li,
  fieldset,
  form,
  label,
  legend,
  table,
  caption,
  tbody,
  tfoot,
  thead,
  tr,
  th,
  td,
  article,
  aside,
  canvas,
  details,
  embed,
  figure,
  figcaption,
  footer,
  header,
  hgroup,
  menu,
  nav,
  output,
  ruby,
  section,
  summary,
  time,
  mark,
  audio,
  video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
  }

  /* HTML5 display-role reset for older browsers */
  article,
  aside,
  details,
  figcaption,
  figure,
  footer,
  header,
  hgroup,
  menu,
  nav,
  section {
    display: block;
  }

  ol,
  ul {
    list-style: none;
  }

  blockquote,
  q {
    quotes: none;
  }

  blockquote:before,
  blockquote:after,
  q:before,
  q:after {
    content: "";
    content: none;
  }

  table {
    border-collapse: collapse;
    border-spacing: 0;
  }

  * {
    box-sizing: border-box;
    margin: 0;
  }

  html,
  body {
    background-color: black;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    border: 1px solid transparent;
    font-family: "Merriweather", serif;
  }
}

/* Print styles */
/* 
All of these styles are made for a specific printers we have at an event 
and it's not recommended to use them in production 
*/
@media print {

  html,
  body {
    height: auto !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 8px;
    color: black !important;
    line-height: 1;
  }

  .no-print {
    display: none;
  }

  main,
  #boi-kieu,
  #chatbot-answer {
    word-wrap: break-word;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    display: block !important;
  }

  .top-nav,
  footer,
  #print-pdf-btn,
  .nav-controls {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
  }

  body {
    background: white !important;
    margin: 0;
    padding: 20px;
  }

  main {
    margin: 0;
    padding: 0;
  }

  textarea {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    resize: none !important;
    padding: 0 !important;
    border-radius: unset;
    margin-bottom: -10px;
    padding: 5px;

    /* 2. Style as plain text */
    font-size: 9px;
    font-weight: bold;
    width: 100%;
    color: black;

    /* 3. Force height to expand and wrap */
    height: auto !important;
    overflow: visible !important;
    display: block;

    /* 4. Ensure wrapping and line breaks are preserved */
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;

    /* 5. Modern browser magic for auto-height */
    field-sizing: content;
  }

  #boi-kieu form button {
    display: none !important;
  }

  #boi-kieu,
  #chatbot-answer {
    display: block;
    word-wrap: break-word;
  }

  .kieu-analysis-container {
    margin-top: 5px;
  }

  .empty-space {
    height: 1px;
  }
}

@layer base {

  /* Site-wide base styles */
  footer {
    color: white;
    padding: 10px;
  }

  main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    padding: 0 10px;
    flex: 1;
  }

  /* Screen reader only utility class */
  .sr-only {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  /* CHATBOT ANSWER TYPOGRAPHY & LAYOUT */
  #chatbot-answer {
    color: white;
    margin: 20px auto 40px auto;
  }

  #chatbot-answer p {
    margin-block: 1rem;
  }

  #chatbot-answer strong {
    font-weight: 700;
  }

  .kieu-analysis-container {
    margin-top: 30px;
    line-height: 1.5;
  }

  /* GENERIC HEADINGS (If they apply globally) */
  h1 {
    font-size: 1.2rem;
    margin: 0 auto;
    text-align: left;
  }

  h2 {
    margin: 0 auto;
    text-align: left;
  }
}

@layer components {

  /* Reusable UI components */
  .typed-cursor {
    color: white;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.5s ease-out;
  }

  /* Animation elements */
  .js-main-container {
    font-family: "NomNaTong", serif;
    font-size: 1.2rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 50vh;
  }

  .js-prose-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: 0;
    display: block;
    text-wrap: nowrap;
    width: auto;
  }

  .js-text-element {
    position: relative;
    display: inline-block;
    transition: opacity 0.5s ease-out;
  }

  .js-text-element .clip-wrap {
    overflow: hidden;
    display: block;
  }

  .js-text-element .clip-wrap {
    overflow: hidden;
    display: block;
  }

  /* Navigation bar */
  .top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    width: 100%;
    padding: 0 30px;
  }

  .nav-brand {
    font-size: 1.5em;
    font-weight: 700;
    color: #fff;
  }

  .nav-controls select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
  }

  /* Chat interface */
  img {
    display: block;
    width: 20px;
    height: auto;
  }

  #boi-kieu {
    max-width: 1000px;
    margin: 0 auto;
    margin-top: 20px;
    border: 1px solid transparent;
  }

  form {
    display: flex;
    justify-content: space-between;
    margin: 20px auto;
  }

  textarea {
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid black;
    background-color: white;
    width: 90%;

    resize: none;
    display: block;
    margin: 0 auto;

    /* Wrapping */
    word-wrap: break-word;
    white-space: pre-wrap;
    word-break: normal;
    line-height: 1.5;

    overflow: hidden;
    resize: none;
    transition: height 0.1s ease;
  }

  textarea:focus {
    outline: none;
    border-color: #555;
  }

  form button {
    font-size: 1.1rem;
    margin-inline: 0.5rem;
    border: none;
    border-radius: 50px;
    background-color: white;
    width: 10%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .empty-space {
    height: 10px;
  }

  .print-button-style {
    display: block;
    cursor: pointer;
    margin: 30px auto 0 auto;
    padding: 10px 15px;
    border-radius: 50px;
    background-color: white;
    font-size: 1rem;
    color: black;
    font-family: "Merriweather", serif;
  }
}