/* Nocturne Component Classes — Plain CSS for Grantha Storefront */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  background: var(--g-bg);
  color: var(--g-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
  color: var(--g-text);
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

p { margin: 0 0 var(--space-3); }

a {
  color: var(--g-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--color-accent-400);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 2px;
}
::selection {
  background: color-mix(in srgb, var(--g-accent) 30%, transparent);
}

/* — Nocturne Signature Fading Rule — */
.hr {
  height: 1px;
  border: 0;
  margin: var(--space-4) 0;
  background: linear-gradient(to right,
    transparent, var(--g-line) 48px,
    var(--g-line) calc(100% - 48px), transparent);
}

/* — Buttons — */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 13.5px;
  line-height: 1.2;
  color: var(--g-text);
  background: transparent;
  border: 1px solid var(--g-line-strong);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn svg, .btn i {
  display: block;
  font-size: 16px;
}
.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  color: var(--g-accent);
  border-color: var(--g-accent);
}
.btn-primary:hover {
  background: var(--g-accent-tint);
  color: var(--g-accent);
}
.btn-primary:active {
  background: var(--g-accent-tint-strong);
}

.btn-secondary {
  border-color: var(--g-line-strong);
  color: var(--g-text);
}
.btn-secondary:hover {
  background: var(--g-hover-strong);
}
.btn-secondary:active {
  background: var(--g-line-strong);
}

.btn-ghost {
  border-color: transparent;
  color: var(--g-soft);
  padding-inline: var(--space-2);
}
.btn-ghost:hover {
  background: var(--g-hover-strong);
  color: var(--g-accent);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* — Forms & Inputs — */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: var(--space-3);
}
.field > label {
  font-size: 12px;
  color: var(--g-muted2);
  font-weight: 500;
}
.input, input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--g-text);
  caret-color: var(--g-accent);
  background: var(--g-surface);
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.input:hover, select:hover, textarea:hover {
  border-color: var(--g-line-strong2);
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--g-accent);
  outline: none;
}
textarea {
  min-height: 90px;
  resize: vertical;
}

/* — Cards — */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--g-surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--g-line-3);
  transition: all var(--transition-fast);
}
.card:hover {
  border-color: var(--g-accent-line);
}
.card-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--g-accent);
}
.card-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 16px;
  line-height: 1.25;
}
.card-body {
  margin: 0;
  font-size: 13px;
  color: var(--g-soft);
  flex: 1;
}

/* — Tags & Badges — */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--g-badge-bg);
  color: var(--g-badge-text);
}
.tag-outline {
  background: transparent;
  border: 1px solid var(--g-accent-line);
  color: var(--g-accent-text);
}

/* — Rail Scroller — */
[data-rail] {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 168px;
  gap: 18px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
[data-rail]::-webkit-scrollbar {
  display: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--g-scroll-thumb);
  border-radius: 6px;
}
::-webkit-scrollbar-track {
  background: var(--g-cover-bg);
}

/* ==========================================================================
   Modals, Overlays & Tooltips

   Magento's modal widget (authentication popup, minicart confirmations,
   product options) ships markup on every page and relies on the theme to keep
   it hidden until `_show` is applied. The blank theme's styles-m.css is
   removed, so without these rules that markup renders inline at the foot of
   every page.
   ========================================================================== */
/*
 * Hidden with opacity + visibility, never `display`, and the transition is load-bearing
 * rather than decorative. Magento's closeModal() removes the `_show` class and then waits
 * for a `transitionend` on the modal before running _close(), which is what tears down
 * .modals-overlay and unlocks the body. `display` is not an animatable property, so with
 * a display toggle that event never fired: dismissing a modal left the blurred backdrop
 * on screen and the page unscrollable until a reload.
 */
.modals-wrapper .modal-popup,
.modals-wrapper .modal-slide,
.modals-wrapper .modal-custom {
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}
.modals-wrapper .modal-popup._show,
.modals-wrapper .modal-slide._show,
.modals-wrapper .modal-custom._show {
  opacity: 1;
  visibility: visible;
}

.modals-overlay {
  position: fixed;
  inset: 0;
  z-index: 899;
  background: rgba(12, 13, 20, 0.55);
  backdrop-filter: blur(2px);
}

body._has-modal {
  overflow: hidden;
}

.modal-popup .modal-inner-wrap {
  position: relative;
  width: min(560px, calc(100vw - 32px));
  margin: 6vh auto 40px;
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.modal-slide .modal-inner-wrap {
  position: relative;
  width: min(460px, 100vw);
  min-height: 100%;
  margin: 0 0 0 auto;
  background: var(--g-surface-elevated);
  border-left: 1px solid var(--g-line);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 0;
}
.modal-header .modal-title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: var(--font-heading-weight);
  margin: 0;
}
.modal-content { padding: 16px 22px 22px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 22px 22px;
}

.modal-header .action-close,
.modal-popup .action-close,
.modal-slide .action-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--g-muted);
  font-size: 0;
  cursor: pointer;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}
.modal-popup .action-close::before,
.modal-slide .action-close::before {
  content: "\2715";
  font-size: 15px;
  line-height: 32px;
}
.modal-popup .action-close:hover,
.modal-slide .action-close:hover {
  color: var(--g-text);
  background: var(--g-hover);
}

/* Core tooltips (e.g. the persistent-cart "What's this?" hint) reveal on
   hover and focus; without this the hint text sits inline in the form. */
.tooltip.wrapper {
  position: relative;
  display: inline-block;
}
.tooltip.wrapper .tooltip.toggle {
  cursor: help;
  font-weight: 500;
  border-bottom: 1px dotted var(--g-line-strong2);
}
.tooltip.wrapper .tooltip.content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 100;
  display: none;
  width: max-content;
  max-width: 280px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--g-text);
  background: var(--g-surface-elevated);
  border: 1px solid var(--g-line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.tooltip.wrapper:hover .tooltip.content,
.tooltip.wrapper:focus-within .tooltip.content {
  display: block;
}

/* Persistent-cart "Remember Me" row */
.block-customer-login .field.choice,
.auth-card .field.choice {
  display: flex;
  /* `.field` defaults to column; checkbox rows read as a single line. */
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: var(--space-3);
}
.block-customer-login .field.choice input[type="checkbox"],
.auth-card .field.choice input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
  accent-color: var(--g-accent);
}
.block-customer-login .field.choice > label,
.auth-card .field.choice > label {
  margin: 0;
  font-size: 13.5px;
  color: var(--g-soft2);
}
